play-scala-websocket-example icon indicating copy to clipboard operation
play-scala-websocket-example copied to clipboard

When node is not installed, rhino engine throws NoSuchMethodError

Open wsargent opened this issue 8 years ago • 2 comments
trafficstars

This is an example of https://github.com/sbt/sbt-js-engine/issues/56, where an old version of Rhino seems to be causing errors:

[info] LESS compiling on 1 source(s)
[error] java.lang.NoSuchMethodError: org.mozilla.javascript.ScriptRuntime.setObjectProp(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;Lorg/mozilla/javascript/Context;Lorg/mozilla/javascript/Scriptable;)Ljava/lang/Object;
[error] 	at io.apigee.trireme.node10.main.trireme._c_anonymous_1(trireme.js:37)
[error] 	at io.apigee.trireme.node10.main.trireme.call(trireme.js)
[error] 	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
[error] 	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3102)
[error] 	at io.apigee.trireme.node10.main.trireme.call(trireme.js)
[error] 	at io.apigee.trireme.core.internal.ScriptRunner.runScript(ScriptRunner.java:762)
[error] 	at io.apigee.trireme.core.internal.ScriptRunner$4.run(ScriptRunner.java:702)
[error] 	at org.mozilla.javascript.Context.call(Context.java:488)
[error] 	at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:504)
[error] 	at io.apigee.trireme.core.internal.ScriptRunner.call(ScriptRunner.java:697)
[error] 	at io.apigee.trireme.core.ScriptFuture.run(ScriptFuture.java:183)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[error] 	at java.lang.Thread.run(Thread.java:748)

The note in https://github.com/ksoichiro/gradle-web-resource-plugin/blob/master/build.gradle#L51 seems to explain why:

// java.lang.NoSuchMethodError: org.mozilla.javascript.ScriptRuntime.setObjectProp
--
  | // Gradle distribution has an older Rhino (1.7R3) and causing conflict.
  | // In 1.7R3, ScriptRuntime does not have setObjectProp() method, which causes the above error.

So the solution should be to update Rhino. I'm not sure how/why an outdated Rhino would be loaded, but that's another question.

The workaround is to install an up-to-date node.js from https://nodejs.org/en/download/package-manager/

wsargent avatar Jul 12 '17 19:07 wsargent

@wsargent I am just wondering why we had this problem with play 2.6.1 version. With the M- releases we had no problems with this? Are there any changes in the play framework related to this problem? Best wishes, Btw: Thank you for your excellent work!!! Freshwood

Freshwood avatar Jul 17 '17 12:07 Freshwood

The updated sbt-web plugins happened fairly late in the process. It's probably connected to https://github.com/playframework/playframework/issues/7045

wsargent avatar Jul 17 '17 21:07 wsargent