[
https://issues.apache.org/jira/browse/CAMEL-3481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12981521#action_12981521
]
Aaron Mulder commented on CAMEL-3481:
-------------------------------------
I have a patch that resolves this issue. It relies on looking for script
engines in org.apache.camel.impl.osgi.Activator (same as when it looks for
components and data formats and the like). Then in ScriptBuider in
camel-script, if the normal mechanism for loading script engines fails, it
checks whether OSGi is available and attempts to load the script engines found
by the Activator.
The main issue with this approach is that it adds a dependency on javax.script
to camel-core (where the OSGi Activator lives). It uses the same pattern as
the other stuff in there -- a ScriptEngineResolver that uses the
ScriptEngineFactory and so on. This is fine for Java 6 and up (where
javax.script is integrated). I'm not clear whether people feel it's OK to add
the javax.script dependency for Java 5 support.
Thoughts on that?
I also have a new test for camel-itest-osgi that demonstrates the problem and
solution, and I will go ahead and commit that in any case. However, the test
will be @Ignore'd because it doesn't run even with the new code without a JRuby
OSGi bundle and the default JRuby distribution in Maven does not seem to work
for that.
> camel-script doesn't work in OSGi
> ---------------------------------
>
> Key: CAMEL-3481
> URL: https://issues.apache.org/jira/browse/CAMEL-3481
> Project: Camel
> Issue Type: Improvement
> Components: camel-script
> Affects Versions: 2.5.0
> Reporter: Aaron Mulder
> Priority: Minor
> Fix For: 2.6.0
>
>
> In an OSGi environment, the ScriptEngineManager that ScriptBuilder uses can't
> find any scripting engines except the ones packaged in the JDK (Rhino, maybe
> AppleScript, etc.). It's possible that setting a better ClassLoader would
> work, or perhaps using a singleton ScriptEngineManager and setting up the
> scripting engines in an OSGi Activator instead of relying on the META-INF
> lookup every time a script is invoked.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.