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

On Fri, Jul 14, 2017 at 4:01 PM, rsteppac2 <r...@steppacher.name> wrote:
> 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 resource is at the root of the bundle that has the code
> trying to load it as a stream. The calling code is in a library embed in the
> bundle JAR. Whether I inline the library or not does not seem to matter. The
> call that now returns null instead of a stream instance is:
>
> Thread.currentThread().getContextClassLoader().getResourceAsStream("httl.properties");
>
> The resource is loaded as part of the factory triggered via Blueprint:
>
> <bean id="httlEngine" class="httl.Engine" factory-method="getEngine" />
>
> Am I possibly hitting https://issues.apache.org/jira/browse/CAMEL-5223?
> Is there a known workaround?
>
>
> Thanks!
> Ralf
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/getResourceAsStream-in-OSGi-bundle-not-working-with-Camel-2-19-tp5807017.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

Reply via email to