Hi,

Try it like this:
ClassLoader origCL = Thread.currentThread().getContextClassLoader();
try
{ // OSGi classloader mess hack
    
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
    ctxJNDI = new InitialContext(props);
} finally
{
    Thread.currentThread().setContextClassLoader(origCL);
}

Regards,
Ales

-----Original Message-----
From: Xavier Millieret [mailto:[email protected]] 
Sent: Friday, May 10, 2013 1:29 PM
To: [email protected]
Subject: Qpid in OSGI

Hi,

I am starting with Qpid, in OSGI.
when I try to have a connection through jndi like:

Hashtable<String, String> env = new Hashtable<String, String>(); 
env.put(Context.PROVIDER_URL, "qpidConnection.properties"); 
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.qpid.jndi.PropertiesFileInitialContextFactory");

Context context = new InitialContext(env); ConnectionFactory connectionFactory 
= (ConnectionFactory) context.lookup("localhost");

I have the following error:

 javax.naming.NoInitialContextException: Cannot instantiate class:
org.apache.qpid.jndi.PropertiesFileInitialContextFactory [Root exception is
java.lang.ClassNotFoundException:
org.apache.qpid.jndi.PropertiesFileInitialContextFactory]

I try to use following bundles:
org.apache.servicemix.bundles.qpid-1.0-incubating-M2.1_1.jar

depends on:
org.apache.servicemix.bundles.commons-collections-3.2.1_1.jar
org.apache.servicemix.bundles.mina-1.1.7_3.jar

someone could help me please.

Thank you

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to