camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Younes Ouadi <>
Subject Using CamelTestSupport within OSGI Environment
Date Wed, 27 Jul 2011 08:21:02 GMT

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

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

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

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:
Sent from the Camel - Users mailing list archive at

View raw message