I have an OSGi bundle (deployed into Karaf 2.2.4) that starts a Camel (2.10.0) context. The Camel context’s routebuilder has some xquery endpoint URIs such as
"xquery:classpath:Dir1/Dir2/example.xq"
When the context tried to resolve that URI, it failed since the Camel bundle is not in the same classpath as where the .xq file resides. So, I created a url expand function that turns
"xquery:classpath:..."
into
"xquery:bundle://42.0:6/..."
since I had dealt with bundle URIs and the OsgiBundleResourcePatternResolver earlier in my project when dealing with a ClassPathScanningCandidateComponentProvider (Spring 3.1.1). Unfortunately, I can’t seem to find a way to make Camel’s XQueryComponent use my OsgiBundleResourcePatternResolver.
- Am I going about this the right way? Is there an easier way to do this?
- If I am, how can I make sure the
XQueryComponentcan understand abundle:URI? - Also, is it possible for me to make sure any camel component can understand a
bundle:URI?
Thanks to Claus’ answer, I was able to realize that my .xq file was not in the right directory in its .jar.
Dir1 resided in root of its .jar file. While running the application in a non-OSGi web container worked fine, Karaf appears to be more strict regarding where resources should be in my .war file. I moved the .xq files to
WEB-INF/classes/Dir1/...and now am no longer receivingFileNotFoundExceptionswhen the code usesxquery:classpath:Dir1/Dir2/example.xq