-
1. Re: camel xslt an osgi - java.io.FileNotFoundException
ffang Jun 30, 2013 1:52 AM (in response to labo32)Hi,
Append your camel router or even a testcase is more helpful here.
In camel-itest-osgi module, there's a XsltRouteTest, you may wanna check it out.
Freeman
-
2. Re: camel xslt an osgi - java.io.FileNotFoundException
labo32 Jun 30, 2013 2:40 PM (in response to ffang)Hi,
to reproduce the problem download a karaf 2.3.1.
Then install some camel bundles
features:chooseurl camel 2.11-SNAPSHOT
features:install camel-core camel-spring camel-restlet camel-jetty camel-josql camel-jpa camel-xmljson camel-gson camel-xstream camel-stream camel-freemarker camel-script camel-groovy camel-http camel-blueprint camel-jms
add the resource file in etc folder (subdir net/test/resources) and deploy the route
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<bean id="restletComponent" class="org.restlet.Component"/>
<bean id="camelRestletComponent" class="org.apache.camel.component.restlet.RestletComponent">
<argument index="0" type="org.restlet.Component" ref="restletComponent"/>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/blueprint" id="init-match-context">
<route id="init-match-route">
<from uri="restlet:http://localhost:8888/rs/match/{leagueSaison}/{leagueShortcut}?restletMethods=GET"/>
<to uri="freemarker:net/test/resources/GetMatchdataByLeagueSaison.ftl"/>
<setHeader headerName="Content-Type">
<constant>text/xml; charset=UTF-8</constant>
</setHeader>
<to uri="http://www.openligadb.de/Webservices/Sportsdata.asmx"/>
<to uri="xslt:net/test/resources/removeNS.xsl"/>
<to uri="xslt:net/test/resources/openliga.xsl"/>
<split>
<xpath>//matches/match</xpath>
<to uri="log:match:{body}?level=DEBUG"/>
</split>
</route>
</camelContext>
</blueprint>
The freemarker template seems to be found the xsl file not :-(
Looks like https://issues.apache.org/jira/browse/CAMEL-5223 but this problem should be solved.
Regards
labo
-
3. Re: camel xslt an osgi - java.io.FileNotFoundException
labo32 Jul 3, 2013 4:51 PM (in response to labo32)Make a bundle with all the resource files did it.
Is this the only way in an osgi camel route to put the resources in a separate bundle ?
Is it not possible to load them from the classpath ?
Note to myself: learn more about osgi
Thanks
labo
-
4. Re: camel xslt an osgi - java.io.FileNotFoundException
ffang Jul 6, 2013 1:10 AM (in response to labo32)We suggest put the resource file into bundle, as this way the bundle is self-contained and easy for management.
Though you can also put the resource file into a folder outside the bundle, provided the folder is on the classpath. This way generally is a little bit tricky as it depend on how your code looks like and which classloader is used.
Freeman