ScriptEngineManager and ScriptEngine can not be loaded in Karaf OSGi (Nashorn not found)

青春壹個敷衍的年華 提交于 2019-12-03 16:37:38

Go to file etc/config.properties (located inside of Karaf installation), find configuration property org.osgi.framework.bootdelegation and add jdk.nashorn.* to it. Complete configuration will be like this:

org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,org.apache.karaf.jaas.boot.principal,sun.*,com.sun.*,javax.transaction,javax.transaction.*,javax.xml.crypto,javax.xml.crypto.*,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom,sun.*,jdk.nashorn.*

Bug is reported to Karaf community.

Edit: If you use Pax Exam Container 4.x for Karaf in your tests then don't forget to add org.ops4j.pax.exam.CoreOptions.bootDelegationPackage("jdk.nashorn.*") to the configuration of your test container.

You'll need to make sure you have a bundle or the system to actually export those packages in question:

So either install the corresponding bundle, or you need to tweak on the exports of the system bundle, in that case edit the jre.properties and make sure the package in question is exported from the system bundle.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!