How to enable javax.script in Websphere liberty profile on Bluemix?

349 Views Asked by At

I want to use JavaScript in one of my Java applications. So I ran this test:

javax.script.ScriptEngineManager manager = new ScriptEngineManager();
javax.script.ScriptEngine engine = manager.getEngineByName("JavaScript");
System.out.println(engine);
javax.script.List<ScriptEngineFactory> factories = manager.getEngineFactories();
System.out.println(factories.isEmpty());

Result:

null
true

So there's no JavaScript on default liberty profile. How do I activate that?

1

There are 1 best solutions below

0
On BEST ANSWER

You may need to build up a server.xml similar to the default one in liberty on Bluemix. You can do this by uploading Liberty and your server.xml to Bluemix. Bluemix will pull out the server.xml and enable that feature. Go here for more info.

Basically everything in wlp/usr/servers/<yourservername> needs to be uploaded to Bluemix with a cf push from wlp/usr/servers/<yourservername>.