Red Hat Bugzilla – Bug 1244351
RFC: Rebase rhino in RHEL-6 to provide JSON support via OpenJDK
Last modified: 2016-05-10 15:37:42 EDT
Created attachment 1053234 [details] js.jar The expected output is: $ java -jar js.jar "a":"b" b what works on rhel7 and fedora 18, but on rhel6 it outputs: Exception in thread "main" javax.script.ScriptException: sun.org.mozilla.javascript.EcmaError: ReferenceError: "JSON" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1 at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:224) at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:240) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) at js.JSMain2.main(JSMain2.java:11) Caused by: sun.org.mozilla.javascript.EcmaError: ReferenceError: "JSON" is not defined. (<Unknown source>#1) ... From my understanding, it would be fixed with these steps: 1. rhel6 updates to rhino-1.7R4 so that it would have a real /usr/share/java/js.jar, that is, js.jar would not be a symlink to rhino.jar 2. After the above, java-1.7.0-openjdk would need to be rebuilt with the newer rhino, so that on rhel6 $ jar tvf /usr/lib/jvm/java-1.7.0-openjdk.x86_64/jre/lib/rhino.jar | grep -i json would show something. As an example, on rhel7 I see: $ jar tvf /usr/lib/jvm/java-1.7.0-openjdk/jre/lib/rhino.jar |grep -i json 0 Mon May 11 22:08:40 BRT 2015 sun/org/mozilla/javascript/json/ 7273 Mon May 11 22:08:40 BRT 2015 sun/org/mozilla/javascript/json/JsonParser.class 748 Mon May 11 22:08:40 BRT 2015 sun/org/mozilla/javascript/json/JsonParser$ParseException.class 14224 Mon May 11 22:08:40 BRT 2015 sun/org/mozilla/javascript/NativeJSON.class 1603 Mon May 11 22:08:40 BRT 2015 sun/org/mozilla/javascript/NativeJSON$StringifyState.class
Created attachment 1053235 [details] JSMain2.java Source for the js.jar. It may be useful for extra testing, as with java-1.8.0-openjdk, the sample test fail as: $ java -jar js.jar Exception in thread "main" javax.script.ScriptException: ReferenceError: "println" is not defined in <eval> at line number 1 at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:455) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:439) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:401) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:397) at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:152) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) at js.JSMain2.main(JSMain2.java:11) Caused by: <eval>:1 ReferenceError: "println" is not defined ...
Hi Paulo, as you noted, fixing this will require an update to rhino itself, which may have consequences for other packages. Since this is a rebase request then, I am updating the summary a bit and changing the component.
Re-assigning to Severin for update (after acks are granted) and to investigate the OpenJDK8 error in comment #1.
The OpenJDK 8 issue should probably be a separate bug; 8 doesn't use Rhino, but its own Javascript implementation called Nashorn.
(In reply to Deepak Bhole from comment #2) > Since this is a rebase request then, I am updating the summary a bit and > changing the component. Just to clarify: The fix requires rebasing rhino *and* a rebuild of java-1.7.0-openjdk (with the rebased rhino).
(In reply to Paulo Andrade from comment #0) > From my understanding, it would be fixed with these steps: > 1. rhel6 updates to rhino-1.7R4 so that it would have a > real /usr/share/java/js.jar, that is, js.jar would not > be a symlink to rhino.jar > 2. After the above, java-1.7.0-openjdk would need to be > rebuilt with the newer rhino, so that on rhel6 > $ jar tvf /usr/lib/jvm/java-1.7.0-openjdk.x86_64/jre/lib/rhino.jar | grep > -i json > would show something. That's right. On my local RHEL-6 system: $ rpm -q rhino rhino-1.7R4-5.el6.noarch $ rpm -qf /usr/share/java/js.jar rhino-1.7R4-5.el6.noarch $ jar tvf /usr/share/java/js.jar | grep -i json 1551 Tue Jan 01 00:00:00 CET 1980 org/mozilla/javascript/NativeJSON$StringifyState.class 14004 Tue Jan 01 00:00:00 CET 1980 org/mozilla/javascript/NativeJSON.class 0 Tue Jan 01 00:00:00 CET 1980 org/mozilla/javascript/json/ 736 Tue Jan 01 00:00:00 CET 1980 org/mozilla/javascript/json/JsonParser$ParseException.class 7209 Tue Jan 01 00:00:00 CET 1980 org/mozilla/javascript/json/JsonParser.class Then after a java-1.7.0-openjdk rebuild with this: $ jar tvf /usr/lib/jvm/java-1.7.0-openjdk.x86_64/jre/lib/rhino.jar | grep -i json 0 Mon Jul 20 18:35:30 CEST 2015 sun/org/mozilla/javascript/json/ 748 Mon Jul 20 18:35:30 CEST 2015 sun/org/mozilla/javascript/json/JsonParser$ParseException.class 7273 Mon Jul 20 18:35:30 CEST 2015 sun/org/mozilla/javascript/json/JsonParser.class 14284 Mon Jul 20 18:35:30 CEST 2015 sun/org/mozilla/javascript/NativeJSON.class 1603 Mon Jul 20 18:35:32 CEST 2015 sun/org/mozilla/javascript/NativeJSON$StringifyState.class $ /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin/java JSMain2 "a":"b" b
*** Bug 911278 has been marked as a duplicate of this bug. ***
I'd make one tiny adjustment to the docs: "previously missing manual page and README and LICENSE files have been added" to "the previously missing manual page, README and LICENSE files have been added"
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHEA-2016-0746.html