[x3d-public] Before further discussions: moving directoriescompleted; antversion

John Carlson yottzumm at gmail.com
Mon Dec 18 01:39:39 PST 2017


https://coderextreme.net/X3DJSONLD/nashorn.zip

Unpack in www.web3d.org/x3d/stylesheets/java

License.txt is under nashorn. There’s an apache license, an MIT license (optionally LGPL), a Web3D license, and a CC Share alike license.  The share alike is my best guess at what’s at MDN.  The webpage that I pulled the code from is referenced.  I don’t know how to find a link to the license from that page, so I just googled something like Mozilla license and found the share alike license for the wiki.  If you have a better spot on the Mozilla license from the web page, go ahead and replace the license in the license.txt.

When nashorn gets String.prototype.repeat (Java 9, I hope), we should be able to remove the Mozilla license.

Xmldom is pretty vital to any DOM manipulation.  There may be an alternate implementation in Nashorn.

Jvm-npm.js is an implementation of require (and we may need it to load javascript objects from a jar—I may have removed that.   The package is under npm, jvm-npm, but not in package.json as I have modified it).

Let me know if you have any more difficulties.

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Monday, December 18, 2017 4:07 AM
To: Don Brutzman
Cc: x3d-public at web3d.org
Subject: RE: Before further discussions: moving directoriescompleted;antversion

My guess is you are missing java/nashorn/jvm-npm.js.  I will send you the zip of nashorn.

John

Sent from Mail for Windows 10

From: Don Brutzman
Sent: Monday, December 18, 2017 12:42 AM
To: John Carlson
Cc: x3d-public at web3d.org
Subject: Re: Before further discussions: moving directories completed;antversion

On 12/17/2017 5:00 PM, John Carlson wrote:
> Looks like you’re using Rhino. Delete the script. We will do something else, like run it from X3DJSAIL.

I have a stock setup for JDK1.8 and Ant.  Haven't configured anything with rhino or nashorn.

Looking at manual for Ant script task and stackoverflow offered some ideas but no explicit fix:

                https://ant.apache.org/manual/Tasks/script.html

Experimented with changing

                <script language="nashorn">
to
                <script language="javascript" manager="javax">

... which got farther.  Checked in that variant, kept old form as a comment in build.xml.

This changed the run-time exception to something nashorn-related, at least.  Not seeing what is wrong now however.

===========================================================
C:\x3d-code\www.web3d.org\x3d\stylesheets\java\build.xml:90:
javax.script.ScriptException: TypeError: Cannot load script from nashorn/jvm-npm.js in <eval> at line number 3
                at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:470)
                at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:454)
                at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406)
                at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)
                at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155)
                at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at org.apache.tools.ant.util.ReflectUtil.invoke(ReflectUtil.java:109)
                at org.apache.tools.ant.util.ReflectWrapper.invoke(ReflectWrapper.java:81)
                at org.apache.tools.ant.util.optional.JavaxScriptRunner.evaluateScript(JavaxScriptRunner.java:103)
                at org.apache.tools.ant.util.optional.JavaxScriptRunner.executeScript(JavaxScriptRunner.java:67)
                at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:53)
                at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
                at sun.reflect.GeneratedMethodAccessor137.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
                at org.apache.tools.ant.Task.perform(Task.java:348)
                at org.apache.tools.ant.Target.execute(Target.java:435)
                at org.apache.tools.ant.Target.performTasks(Target.java:456)
                at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
                at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
                at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
                at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
                at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
                at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
                at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Caused by: <eval>:3 TypeError: Cannot load script from nashorn/jvm-npm.js
                at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)
                at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:213)
                at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:185)
                at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:172)
                at jdk.nashorn.internal.runtime.Context.load(Context.java:868)
                at jdk.nashorn.internal.objects.Global.load(Global.java:1545)
                at jdk.nashorn.internal.scripts.Script$1$\^eval\_.:program(<eval>:3)
                at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
                at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
                at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
                at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:449)
                ... 28 more
BUILD FAILED (total time: 2 seconds)
===========================================================


> *From: *Don Brutzman <mailto:brutzman at nps.edu>
> *Sent: *Sunday, December 17, 2017 7:56 PM
> *To: *John Carlson <mailto:yottzumm at gmail.com>
> *Cc: *x3d-public at web3d.org <mailto:x3d-public at web3d.org>
> *Subject: *Re: Before further discussions: moving directories completed; antversion
> 
> On 12/17/2017 3:53 PM, John Carlson wrote:
> 
>  > It’s at the right level until I can put more work in.  There may be some rearrangement, but would like to get whole thing working first, before attempting to rearrange.  Thanks!
> 
>  >
> 
>  > It would be idea to get it into the jars, but let’s get it working outside the jars first.
> 
> Thanks for discussion over skype.
> 
> Subdirectory nashorn and test.bat are now moved into java subdirectory so that our work can be at the right level.
> 
> Also moved test.nashorn ant target from stylesheets/build.xml to stylesheets/java/build.xml for inclusion with X3DJSAIL
> 
>  > Were you able to upgrade ant?
> 
>  >
> 
>  > John
> 
> No changes.  I am using apache-ant-1.10.1 which is latest greatest as of 6 FEB 2017.
> 
>                  http://ant.apache.org
> 
> Moved a bunch of properties, test.nashorn target is running as before for me, not recognizing "script" "nashorn":
> 
> ant -f C:\\x3d-code\\www.web3d.org\\x3d\\stylesheets\\java test.nashorn
> 
> test.nashorn:
> 
> Compile:
> 
> Run:
> 
> Warning: toFileJavaScript() is overwriting prior file nashorn/examples/HelloWorldProgramOutput.js
> 
> Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
> 
> Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
> 
> HelloWorldProgramOutput self-validation test results: success
> 
> script:
> 
> C:\x3d-code\www.web3d.org\x3d\stylesheets\java\build.xml:90:
> 
> org.apache.bsf.BSFException: unsupported language: nashorn
> 
>                  at org.apache.bsf.BSFManager.loadScriptingEngine(BSFManager.java:686)
> 
>                  at org.apache.bsf.BSFManager.exec(BSFManager.java:485)
> 
>                  at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:98)
> 
>                  at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:53)
> 
>                  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
> 
>                  at sun.reflect.GeneratedMethodAccessor695.invoke(Unknown Source)
> 
>                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 
>                  at java.lang.reflect.Method.invoke(Method.java:498)
> 
>                  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
> 
>                  at org.apache.tools.ant.Task.perform(Task.java:348)
> 
>                  at org.apache.tools.ant.Target.execute(Target.java:435)
> 
>                  at org.apache.tools.ant.Target.performTasks(Target.java:456)
> 
>                  at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
> 
>                  at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
> 
>                  at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> 
>                  at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
> 
>                  at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
> 
>                  at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
> 
>                  at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
> 
> BUILD FAILED (total time: 3 seconds)
> 
> offending block:
> 
>                                  <script language="nashorn">
> 
>                                                  <classpath>
> 
>                                                                  <fileset dir="${saxon.dir}"      includes="${saxon.jar}"/>
> 
>                                                                  <fileset dir="${exificient.dir}" includes="${exificient.jar}"/>
> 
>                                                                  <fileset dir="${openexi.dir}"    includes="${openexi.jar}"/>
> 
>                                                                  <fileset dir="${java.jars.dir}"  includes="${jsai.classes.archive.jar.name}"/>
> 
>                                                  </classpath>
> 
>                                                  load('nashorn/jvm-npm.js');
> 
>                                                  load('nashorn/repeatPolyfill.js');
> 
>                                                  load('nashorn/examples/HelloWorldProgramOutput.js.intermediate.js');
> 
>                                                  load('nashorn/examples/HelloWorldProgramOutput.js');
> 
>                                  </script>
> 
> new to me...  apparent reference:
> 
>                  Ant Manual: Script
> 
>                  https://ant.apache.org/manual/Tasks/script.html
> 
> There is an example 2/3 down that page with
> 
>                  <script language="javascript"> <![CDATA[
> 
> If I make that change (not checked in) the error moves a bit:
> 
> script:
> 
> C:\x3d-code\www.web3d.org\x3d\stylesheets\java\build.xml:90:
> 
> org.mozilla.javascript.EcmaError: ReferenceError: "load" is not defined.
> 
>                  at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
> 
>                  at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
> 
>                  at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3413)
> 
>                  at org.mozilla.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:1951)
> 
>                  at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:95)
> 
>                  at org.mozilla.javascript.gen.c1._c0(Unknown Source)
> 
>                  at org.mozilla.javascript.gen.c1.call(Unknown Source)
> 
>                  at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
> 
>                  at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
> 
>                  at org.mozilla.javascript.gen.c1.call(Unknown Source)
> 
>                  at org.mozilla.javascript.gen.c1.exec(Unknown Source)
> 
>                  at org.mozilla.javascript.Context.evaluateString(Context.java:1196)
> 
>                  at org.apache.bsf.engines.javascript.JavaScriptEngine.eval(JavaScriptEngine.java:138)
> 
>                  at org.apache.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:141)
> 
>                  at org.apache.bsf.BSFManager$6.run(BSFManager.java:493)
> 
>                  at java.security.AccessController.doPrivileged(Native Method)
> 
>                  at org.apache.bsf.BSFManager.exec(BSFManager.java:491)
> 
>                  at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:98)
> 
>                  at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:53)
> 
>                  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
> 
>                  at sun.reflect.GeneratedMethodAccessor695.invoke(Unknown Source)
> 
>                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 
>                  at java.lang.reflect.Method.invoke(Method.java:498)
> 
>                  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
> 
>                  at org.apache.tools.ant.Task.perform(Task.java:348)
> 
>                  at org.apache.tools.ant.Target.execute(Target.java:435)
> 
>                  at org.apache.tools.ant.Target.performTasks(Target.java:456)
> 
>                  at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
> 
>                  at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
> 
>                  at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> 
>                  at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
> 
>                  at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
> 
>                  at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
> 
>                  at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
> 
> BUILD FAILED (total time: 50 seconds)
> 
> Perhaps you are using a Java 9 capability?  i am (staying) at java version "1.8.0_152"
> 
>  > *From: *Don Brutzman <mailto:brutzman at nps.edu>
> 
>  > *Sent: *Sunday, December 17, 2017 6:34 PM
> 
>  > *To: *John Carlson <mailto:yottzumm at gmail.com>
> 
>  > *Cc: *x3d-public at web3d.org <mailto:x3d-public at web3d.org>
> 
>  > *Subject: *Re: Before further discussions:
> 
>  >
> 
>  > John: our mails crossed but yes this was done this afternoon, renamed as test.nashorn for consistency.
> 
>  >
> 
>  > Key question before rebuild/redeploy: is the nashorn directory at the right level?
> 
> all the best, Don
> 
> -- 
> 
> Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
> 
> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
> 
> X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman
> 


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20171218/197f8a92/attachment-0001.html>


More information about the x3d-public mailing list