javascriptjavatomcat9shibboleth

No scripting engine associated with scripting language JavaScript


I am installing Shibboleth IDP on a CentOS 7 server. I installed JDK 15.0.2 and Tomcat 9.0.44

Java version is:

java version "15.0.2" 2021-01-19
Java(TM) SE Runtime Environment (build 15.0.2+7-27)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)

I compiled Shibboleth war and deployed it to Tomcat. However, on trying to start the application, I get this error in Tomcat log:

2021-03-16 13:02:41.218 [ WARN] : net.shibboleth.ext.spring.context.DelimiterAwareApplicationContext: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shibboleth.ProtocolLookupFunction' defined in file [/opt/shibboleth-idp/system/conf/audit-system.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [net.shibboleth.idp.profile.context.navigate.ScriptedContextLookupFunction]: Factory method 'inlineScript' threw exception; nested exception is net.shibboleth.utilities.java.support.logic.ConstraintViolationException: No scripting engine associated with scripting language JavaScript
2021-03-16 13:02:41.240 [ERROR] : org.springframework.web.context.ContextLoader: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shibboleth.ProtocolLookupFunction' defined in file [/opt/shibboleth-idp/system/conf/audit-system.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [net.shibboleth.idp.profile.context.navigate.ScriptedContextLookupFunction]: Factory method 'inlineScript' threw exception; nested exception is net.shibboleth.utilities.java.support.logic.ConstraintViolationException: No scripting engine associated with scripting language JavaScript
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)

If I understand correctly, there should be a script engine in the JRE to execute JavaScript. Does it need to be enabled? How?


Solution

  • Java 15 and later no longer includes a bundled JavaScript engine.

    The simplest way to deal with this is to use an earlier version of Java. Note that the Shibboleth project only formally supports Long Term Support releases of Java, which for IdP V4.0.1 means Java 11.

    Another commenter notes that you can add a separate JavaScript engine to your classpath if you really need to use the latest Java and the current IdP version, but it's not a supported configuration.

    Going forward, the Shibbleth IdP 4.1 release (which is coming out very soon now) has a plug-in mechanism to help support this use case, but using Java 11 will still be the simplest approach.

    The complete System Requirements documentation for the current version of the Shibboleth IdP is here: https://wiki.shibboleth.net/confluence/display/IDP4/SystemRequirements