Dears,

I have wrapped CamelTestSupport in a service to allow testing Camel Routes
from GUI. The service works fine in a standalone application (unit tests) as
well as in a JEE application. When I tried the same service within an OSGI
environment (Karaf), I got the following error:

java.lang.RuntimeException: javax.naming.NoInitialContextException: We could
not find a provider for the InitialContextFactory
org.apache.camel.util.jndi.CamelInitialContextFactory

After some research, I have found that Camel 'itests' class
OSGiIntegrationTestSupport extends also the CamelTestSupport class and
override 'createCamelContext()' where 'CamelContextFactory' is used to
instantiate the context instead of using an instance of
'DefaultCamelContext'.

My issue with 'CamelContextFactory' is that it requires a dependency to the
'BundleContext' and makes my service coupled to OSGI API.

My questions are:
* Is my diagnostic is correct?
* Is this the only way to use CamelTestSupport from within an OSGI
environment?

Some information about my environment:
* Camel: 2.8.0
* Karaf: 2.2.1
* Aries: 0.3.1
* JDK: 1.6

Warm regards

Younes Ouadi



--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-CamelTestSupport-within-OSGI-Environment-tp4637949p4637949.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to