Re: getResourceAsStream in OSGi bundle not working with Camel 2.19

2017-07-17 Thread rsteppac2
rsteppac2 wrote > 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. This worked. Though instead of the application classloader I used t

Re: getResourceAsStream in OSGi bundle not working with Camel 2.19

2017-07-14 Thread Grzegorz Grzybek
Hello² And you're problem is described at this issue: https://issues.apache.org/jira/browse/CAMEL-10513. Camel 2.19.0 changed the initialization time in blueprint - so that's why you have different thread/TCCL. regards Grzegorz Grzybek 2017-07-14 19:24 GMT+02:00 Grzegorz Grzybek : > Hello > > Y

Re: getResourceAsStream in OSGi bundle not working with Camel 2.19

2017-07-14 Thread Grzegorz Grzybek
Hello Yes. Never, ever use thread context class loader - in blueprint you can't be sure what thread you're using. And you don't want to cause memory leaks. if you have bundle reference or bundlecontext, you can get any bundle and use it to load resource. regards Grzegorz Grzybek 2017-07-14 17:4

Re: getResourceAsStream in OSGi bundle not working with Camel 2.19

2017-07-14 Thread Claus Ibsen
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 T

Re: getResourceAsStream in OSGi bundle not working with Camel 2.19

2017-07-14 Thread rsteppac2
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 actu

Re: getResourceAsStream in OSGi bundle not working with Camel 2.19

2017-07-14 Thread Claus Ibsen
I suggest to use Camel's ClassResolver to load resources. Or you can try using the class loader from camelCamel.getApplicationContextClassLoader which should be the classloader that startup your osgi bundle. But in OSGi there is no guarantee what classloader the current thread is associated with

getResourceAsStream in OSGi bundle not working with Camel 2.19

2017-07-14 Thread rsteppac2
Hello all, I am trying to migrate to Camel 2.19 and came across an in issue where loading resources from an OSGi bundle stopped working. The issue is not reproducible with versions 2.18.4 and lower. I tried Karaf 4.0.9 and 4.1.1; the Karaf version does not appear to matter. In my case the resourc