So here is my question that I have. I am using some JNDI lib : org.apache.qpid.jndi.PropertiesFileInitialContextFactory
and I am trying to connect to the RED HAT mrg. One bundle A exports this lib, and another bundle B imports this class (org.apache.qpid.jndi.PropertiesFileInitialContextFactory). Because this is JNDI it needs a correctly set class loader to work, otherwise I will get a ClassNotFoundException, even if bundle A is exporting this class.
Until now we were using Virgo, and had two solutions for this issue:
1. Use the <Import-Bundle> inside maven bundle plugin, specific for virgo.
2. Use Thread.currentThread().setContextClassLoader(PropertiesFileInitialContextFactory.class.getClassLoader());
whenever I needed to access the JNDI class.
Unfortunately neither of these seem to work in Karaf.