Main /
JSWebStartInformation about running JS under WebStart. Resources
ProblemsNashorn load() failsPtolemy fails to load the JSAccessor class with: ptolemy.kernel.util.IllegalActionException: Failed to load basicFunctions.js in .configuration.actor library.Accessors.audio.AudioCapture Because: java.io.FileNotFoundException: /Users/cxh/file:/Users/cxh/ptII/signed/ptolemy/actor/lib/jjs/jjs.jar!/ptolemy/actor/lib/jjs/external/require.js (No such file or directory) at ptolemy.actor.lib.jjs.JavaScript._createEngineAndEvaluateSetup(JavaScript.java:2008) at ptolemy.actor.lib.jjs.JavaScript.attributeChanged(JavaScript.java:502) at org.terraswarm.accessor.JSAccessor.attributeChanged(JSAccessor.java:267) at ptolemy.data.expr.Variable._setTokenAndNotify(Variable.java:2261) at ptolemy.data.expr.Variable.setToken(Variable.java:1227) at ptolemy.actor.parameters.PortParameter.setToken(PortParameter.java:504) at ptolemy.actor.lib.jjs.JavaScript.<init>(JavaScript.java:428) at org.terraswarm.accessor.JSAccessor.<init>(JSAccessor.java:127) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at ptolemy.moml.MoMLParser._createInstance(MoMLParser.java:4599) at ptolemy.moml.MoMLParser._createEntity(MoMLParser.java:4399) at ptolemy.moml.MoMLParser.startElement(MoMLParser.java:2792) at com.microstar.xml.XmlParser.parseElement(XmlParser.java:921) at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1104) at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924) at com.microstar.xml.XmlParser.parseDocument(XmlParser.java:481) at com.microstar.xml.XmlParser.doParse(XmlParser.java:159) at com.microstar.xml.XmlParser.parse(XmlParser.java:132) at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1636) at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1579) at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1751) at org.terraswarm.accessor.AccessorLibrary.populate(AccessorLibrary.java:173) at ptolemy.moml.EntityLibrary.attributeList(EntityLibrary.java:226) at ptolemy.vergil.tree.VisibleTreeModel._attributes(VisibleTreeModel.java:152) at ptolemy.vergil.tree.FullTreeModel.getChildCount(FullTreeModel.java:114) at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1479) at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1288) at javax.swing.tree.VariableHeightLayoutCache.ensurePathIsExpanded(VariableHeightLayoutCache.java:984) at javax.swing.tree.VariableHeightLayoutCache.setExpandedState(VariableHeightLayoutCache.java:182) at javax.swing.plaf.basic.BasicTreeUI.updateExpandedDescendants(BasicTreeUI.java:1696) at javax.swing.plaf.basic.BasicTreeUI$Handler.treeExpanded(BasicTreeUI.java:3805) at javax.swing.JTree.fireTreeExpanded(JTree.java:2764) at javax.swing.JTree.setExpandedState(JTree.java:3629) at javax.swing.JTree.expandPath(JTree.java:2212) at javax.swing.plaf.basic.BasicTreeUI.toggleExpandState(BasicTreeUI.java:2286) at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(BasicTreeUI.java:2395) at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(BasicTreeUI.java:3609) at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(BasicTreeUI.java:3548) at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279) at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279) at java.awt.Component.processMouseEvent(Component.java:6532) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6300) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4891) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4713) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4522) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) at java.awt.Container.dispatchEventImpl(Container.java:2280) at java.awt.Window.dispatchEventImpl(Window.java:2750) at java.awt.Component.dispatchEvent(Component.java:4713) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /Users/cxh/file:/Users/cxh/ptII/signed/ptolemy/actor/lib/jjs/jjs.jar!/ptolemy/actor/lib/jjs/external/require.js (No such file or directory) at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:397) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:446) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:403) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:399) at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:150) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249) at ptolemy.actor.lib.jjs.JavaScript._createEngineAndEvaluateSetup(JavaScript.java:2004) ... 73 more Caused by: java.io.FileNotFoundException: /Users/cxh/file:/Users/cxh/ptII/signed/ptolemy/actor/lib/jjs/jjs.jar!/ptolemy/actor/lib/jjs/external/require.js (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.<init>(FileInputStream.java:138) at java.io.FileInputStream.<init>(FileInputStream.java:93) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188) at jdk.nashorn.internal.runtime.Source$URLData.load(Source.java:329) at jdk.nashorn.internal.runtime.Source.sourceFor(Source.java:114) at jdk.nashorn.internal.runtime.Source.sourceFor(Source.java:469) at jdk.nashorn.internal.runtime.Source.sourceFor(Source.java:454) at jdk.nashorn.internal.runtime.Context.load(Context.java:803) at jdk.nashorn.internal.objects.Global.load(Global.java:1536) at jdk.nashorn.internal.scripts.Script$2$\^eval\_.:program(<eval>:253) at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:640) at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:228) at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393) ... 79 more Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /Users/cxh/file:/Users/cxh/ptII/signed/ptolemy/actor/lib/jjs/jjs.jar!/ptolemy/actor/lib/jjs/external/require.js (No such file or directory) at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:397) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:446) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:403) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:399) at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:150) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249) at ptolemy.actor.lib.jjs.JavaScript._createEngineAndEvaluateSetup(JavaScript.java:2004) at ptolemy.actor.lib.jjs.JavaScript.attributeChanged(JavaScript.java:502) at org.terraswarm.accessor.JSAccessor.attributeChanged(JSAccessor.java:267) at ptolemy.data.expr.Variable._setTokenAndNotify(Variable.java:2261) at ptolemy.data.expr.Variable.setToken(Variable.java:1227) at ptolemy.actor.parameters.PortParameter.setToken(PortParameter.java:504) at ptolemy.actor.lib.jjs.JavaScript.<init>(JavaScript.java:428) at org.terraswarm.accessor.JSAccessor.<init>(JSAccessor.java:127) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at ptolemy.moml.MoMLParser._createInstance(MoMLParser.java:4599) at ptolemy.moml.MoMLParser._createEntity(MoMLParser.java:4399) at ptolemy.moml.MoMLParser.startElement(MoMLParser.java:2792) at com.microstar.xml.XmlParser.parseElement(XmlParser.java:921) at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1104) at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924) at com.microstar.xml.XmlParser.parseDocument(XmlParser.java:481) at com.microstar.xml.XmlParser.doParse(XmlParser.java:159) at com.microstar.xml.XmlParser.parse(XmlParser.java:132) at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1636) at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1579) at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1751) at org.terraswarm.accessor.AccessorLibrary.populate(AccessorLibrary.java:173) at ptolemy.moml.EntityLibrary.attributeList(EntityLibrary.java:226) at ptolemy.vergil.tree.VisibleTreeModel._attributes(VisibleTreeModel.java:152) at ptolemy.vergil.tree.FullTreeModel.getChildCount(FullTreeModel.java:114) at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1479) at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1288) at javax.swing.tree.VariableHeightLayoutCache.ensurePathIsExpanded(VariableHeightLayoutCache.java:984) at javax.swing.tree.VariableHeightLayoutCache.setExpandedState(VariableHeightLayoutCache.java:182) at javax.swing.plaf.basic.BasicTreeUI.updateExpandedDescendants(BasicTreeUI.java:1696) at javax.swing.plaf.basic.BasicTreeUI$Handler.treeExpanded(BasicTreeUI.java:3805) at javax.swing.JTree.fireTreeExpanded(JTree.java:2764) at javax.swing.JTree.setExpandedState(JTree.java:3629) at javax.swing.JTree.expandPath(JTree.java:2212) at javax.swing.plaf.basic.BasicTreeUI.toggleExpandState(BasicTreeUI.java:2286) at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(BasicTreeUI.java:2395) at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(BasicTreeUI.java:3609) at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(BasicTreeUI.java:3548) at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279) at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279) at java.awt.Component.processMouseEvent(Component.java:6532) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6300) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4891) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4713) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4522) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) at java.awt.Container.dispatchEventImpl(Container.java:2280) at java.awt.Window.dispatchEventImpl(Window.java:2750) at java.awt.Component.dispatchEvent(Component.java:4713) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) Caused by: java.io.FileNotFoundException: /Users/cxh/file:/Users/cxh/ptII/signed/ptolemy/actor/lib/jjs/jjs.jar!/ptolemy/actor/lib/jjs/external/require.js (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.<init>(FileInputStream.java:138) at java.io.FileInputStream.<init>(FileInputStream.java:93) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188) at jdk.nashorn.internal.runtime.Source$URLData.load(Source.java:329) at jdk.nashorn.internal.runtime.Source.sourceFor(Source.java:114) at jdk.nashorn.internal.runtime.Source.sourceFor(Source.java:469) at jdk.nashorn.internal.runtime.Source.sourceFor(Source.java:454) at jdk.nashorn.internal.runtime.Context.load(Context.java:803) at jdk.nashorn.internal.objects.Global.load(Global.java:1536) at jdk.nashorn.internal.scripts.Script$2$\^eval\_.:program(<eval>:253) at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:640) at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:228) at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393) ... 79 more What it looks like is happening is that the Nashorn
Partial SolutionIt turned out that we had code like: /** A string giving the full path to the root directory for installed modules. */ var _moduleRoot = Java.type('ptolemy.util.FileUtilities').nameToFile( '$CLASSPATH/ptolemy/actor/lib/jjs/', null).getAbsolutePath(); The partial solution was to check for /!: var __moduleFile = Java.type('ptolemy.util.FileUtilities').nameToFile( '$CLASSPATH/ptolemy/actor/lib/jjs/', null) /** A string giving the full path to the root directory for installed modules. */ var _moduleRoot = __moduleFile.getAbsolutePath(); // Check to see if _moduleFile is a Jar URL like // file:/Users/cxh/ptII/signed/ptolemy/actor/lib/jjs/jjs.jar!/ptolemy/actor/lib/jj if ( _moduleRoot.indexOf("!/") != -1) { _moduleRoot = "jar:" + __moduleFile.toString(); }
|