Here is javadoc for javax.script.ScriptEngineManager consturctor:
If the thread context ClassLoader can be accessed by the caller, then the effect of calling this constructor is the same as calling ScriptEngineManager(Thread.currentThread().getContextClassLoader()). Otherwise, the effect is the same as calling ScriptEngineManager(null).
public ScriptEngineManager(ClassLoader loader)
This constructor loads the implementations of ScriptEngineFactory visible to the given ClassLoader using the service provider mechanism.
If loader is null, the script engine factories that are bundled with the platform and that are in the usual extension directories (installed extensions) are loaded.
However, I know that using ClassLoader is prohibited in the EJB.
Then, the only choice - new ScriptEngineManager(null) - would be work?