I’m using openjdk 1.7.0_65 camel version 2.14.1 and I’ve run into difficulty
trying to use camel-script for javascript in a camel route using blueprint.
I’ve verified that camel-script works fine when building a war with spring and
deploying to a servlet container, but when building a bundle with blueprint I
get a timeout with a message like this when tests are attempted:
Bundle RouteTest is waiting for dependencies
[(&(language=js)(objectClass=org.apache.camel.spi.LanguageResolver))].
I also get this error if i build with skipping tests (builds fine) and then
deploy to an osgi runtime. I’ve tried both a brand new service mix (5.4.0) and
karaf (2.3.7 after following instructions on camel website). Both the
camel-script and camel-script-javascript features are installed in both
instances. In both situations, the bundle gets put into the grace period for a
few moments and then eventually fails.
Both projects are simple edits of maven archetypes. Relevant chunks of poms
and route xmls:
For blueprint:
In the pom
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-blueprint</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-script</artifactId>
<version>2.14.1</version>
</dependency>
and in blueprint xml
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route id="timer-to-log">
<from uri="timer://foo?fixedRate=true&period=10s"/>
<transform>
<javaScript>
request.body = 'Hello OSGI Application, how are you?';
</javaScript>
</transform>
<log message="From Javascript: ${body}" />
</route>
</camelContext>
For war:
In the pom
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-script</artifactId>
<version>2.14.1</version>
</dependency>
and in the spring xml
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="timer-to-log">
<from uri="timer://foo?fixedRate=true&period=10s"/>
<transform>
<javaScript>
request.body = 'Hello Web Application, how are you?';
</javaScript>
</transform>
<log message="From Javascript: ${body}" />
</route>
</camelContext>
I’ve seen https://issues.apache.org/jira/browse/CAMEL-7122, which is apparently
resolved in version 2.13. I’ve also attempted the workaround explained by the
original stack overflow post
http://stackoverflow.com/questions/20997276/jboss-fuse-apache-camel-wont-resolve-language-js-javascript-for-bundle,
but with no luck.
Are there any setup steps or other dependencies that I’m missing for this to
work in osgi?