I am using Apache Aries with Camel, as part of my test with pax-jdbc I have 
registered the JNDI datasource via Karaf cfg – it all works fine when deployed 
in Karaf, when doing the testing via CamelBlueprintTest am getting the 
following error :

“
Caused by: javax.naming.NoInitialContextException: The calling code's 
BundleContext could not be determined.
at 
org.apache.aries.jndi.OSGiInitialContextFactoryBuilder.getInitialContext(OSGiInitialContextFactoryBuilder.java:46)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:341)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at 
org.apache.ibatis.datasource.jndi.JndiDataSourceFactory.setProperties(JndiDataSourceFactory.java:52)
“

Where the “ org.apache.ibatis.datasource.jndi.JndiDataSourceFactory.” is a 
non-OSGi bundle.  After debugging I see the failure happens in  
Utils#doGetBundleContext, when it does the “Object bc = env == 
null?null:env.get("osgi.service.jndi.bundleContext");”, wondering if I am 
missing any environment property I miss to set. 
    

-Kamesh

Reply via email to