[x3d-public] Errors in my X3DJSAIL HelloWorldProgramOutput.java command line, generating XML, JSON and JS

Don Brutzman brutzman at nps.edu
Sat Jan 13 02:43:33 PST 2018


On 1/11/2018 11:10 AM, John Carlson wrote:
> I don't see as why I need the original source file, as the X3DObject is loaded 
> into memory and passed to CommandLine.

yes that sounds OK... i was just working from email in airport lounge earlier.

> Loading an XML file was not required 
> with the old handleArguments(),

actually the other way around, in general if arguments are provided then the 
main method in a X3D-to-Java converted class simply invokes 
X3DObjection.handleArgument() to then get CommandLine parsing/processing.

> and I think a test to see whether the object is 
> loaded into memory may be all that is required.  I will look at modifying the 
> source code.
> John

sounds good.

next: here is what i get in console when i run X3DJSAIL build.xml target 
"test.nashorn", with log then followed by the block of ant build.xml apparently 
triggering the exception.  Not seeing what the problem is since all of your 
load('nashorn/***') calls seem to be pointing to files that are present:

=========================================================
ant -f C:\\x3d-code\\www.web3d.org\\x3d\\stylesheets\\java test.nashorn
test.nashorn:
Compile:
Compiling 2 source files to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\classes
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
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
script:
C:\x3d-code\www.web3d.org\x3d\stylesheets\java\build.xml:98:
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.GeneratedMethodAccessor102.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$\^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: 9 seconds)

=========================================================
<!--    <script language="nashorn"> TODO debugging -->
<script language="javascript" manager="javax">
         <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>

=========================================================

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



More information about the x3d-public mailing list