In pure OSGi that is not the way to load resources from the classpath. OSGi has its own set of APIs for that.
You should load via BundleContext and Bundle https://osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html https://osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html That is also what Camel uses when its runs in OSGi and its ClassResolver via the OsgiClassResolver class. It may be that the current thread in the past may have worked, but there is no guarantee. And what have changed is hard to tell as Karaf and Camel upgrades are using newer version of OSGi and Blueprint etc. On Fri, Jul 14, 2017 at 5:39 PM, rsteppac2 <[email protected]> wrote: > Hello Claus, > > thanks for your suggestions! > > it is 3rd party library code, so I cannot just change it. What I could do, I > guess, is to wrap the library's factory code in my own and set the context > classloader of the current thread to the application context class loader > before delegating to the actual factory. > > What I do not quite understand is why the code works consistently with Camel > versions < 2.19.0 and consistently not with >= 2.19.0. > And why would the classloader of the thread that builds the blueprint > context based on the XML in my bundle not have access to a resource that is > at the root of that very same bundle? > > > Thanks again. > Ralf > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/getResourceAsStream-in-OSGi-bundle-not-working-with-Camel-2-19-tp5807017p5807021.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
