Eclipse and Nashorn throwing java.lang.RuntimeException: java.lang.ClassNotFoundException - javascript

I am using the Eclipse SCADA framework which uses Nashorn to integrate JavaScript into Java.
One feature of Nashorn is that you are able to call Java code directly from the JavaScript fragments.
I have read on some tutorials that in order to invoke a java method you have to use:
var MyJavaClass = Java.type('countdown2.test2');
but I get the following errors:
!ENTRY org.eclipse.scada.vi.ui.draw2d 4 0 2018-05-09 15:45:08.572
!MESSAGE countdown2.test2 cannot be found by org.eclipse.scada.vi.ui.draw2d_0.3.0.v20160226-1536
!STACK 0
java.lang.RuntimeException: java.lang.ClassNotFoundException: countdown2.test2 cannot be found by org.eclipse.scada.vi.ui.draw2d_0.3.0.v20160226-1536
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:397)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:421)
at jdk.nashorn.api.scripting.NashornScriptEngine.access$300(NashornScriptEngine.java:73)
at jdk.nashorn.api.scripting.NashornScriptEngine$3.eval(NashornScriptEngine.java:514)
at org.eclipse.scada.utils.script.ScriptExecutor.executeScript(ScriptExecutor.java:259)
at org.eclipse.scada.utils.script.ScriptExecutor.access$1(ScriptExecutor.java:239)
at org.eclipse.scada.utils.script.ScriptExecutor$3.call(ScriptExecutor.java:295)
at org.eclipse.scada.utils.script.Scripts.executeWithClassLoader(Scripts.java:123)
at org.eclipse.scada.utils.script.ScriptExecutor.execute(ScriptExecutor.java:290)
at org.eclipse.scada.utils.script.ScriptExecutor.execute(ScriptExecutor.java:285)
at org.eclipse.scada.vi.ui.draw2d.SymbolController.runUpdate(SymbolController.java:560)
at org.eclipse.scada.vi.ui.draw2d.SymbolController.handleDataUpdate(SymbolController.java:550)
at org.eclipse.scada.vi.ui.draw2d.SymbolController$2.run(SymbolController.java:503)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4155)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3772)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:694)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:606)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at ejemplo.Application.start(Application.java:20)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
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.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
at org.eclipse.equinox.launcher.Main.main(Main.java:1488)
Caused by: java.lang.ClassNotFoundException: countdown2.test2 cannot be found by org.eclipse.scada.vi.ui.draw2d_0.3.0.v20160226-1536
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:439)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at jdk.nashorn.internal.runtime.Context.findClass(Context.java:1051)
at jdk.nashorn.internal.objects.NativeJava.simpleType(NativeJava.java:498)
at jdk.nashorn.internal.objects.NativeJava.type(NativeJava.java:322)
at jdk.nashorn.internal.objects.NativeJava.type(NativeJava.java:314)
at jdk.nashorn.internal.objects.NativeJava.type(NativeJava.java:310)
at jdk.nashorn.internal.scripts.Script$Recompilation$23$1510$cilindrovertical.updateValve(cilindrovertical.js:46)
at jdk.nashorn.internal.scripts.Script$2$onUpdate.:program(onUpdate:1)
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)
... 38 more
Am I doing something wrong? I am writing the JavaScript code in the "cilindrovertical.js" file and I am referencing the "test2" class which is in the "src" file. How should I write the Java.type code?
Eclipse Project Explorer
Thanks in advance for answers.

Related

How should I do to identify an error point in assetic:dump of Symfony2?

This is an error of assetic:dump in Symfony2.
[Assetic\Exception\FilterException]
An error occurred while running:
'/usr/bin/java' '-jar' '/path/to/java/yuicompressor-2.4.8.jar' '--charset' 'UTF-8' '-o' '/tmp/YUI-OUT-NynbGd' '--type' 'js' '/tmp/YUI-IN-2GZ9rr'
Error Output:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:635)
at java.util.ArrayList.get(ArrayList.java:411)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.getToken(JavaScriptCompressor.java:578)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSymbolTree(JavaScriptCompressor.java:1094)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.compress(JavaScriptCompressor.java:556)
at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:186)
... 5 more
Input:
I think an error is somewhere of a script.
How should I do to identify an error point?
In the most cases the problem is occured by the parameters or paths. I had similar problem with assetic previously, then I managed to solve it using:
Try to figure it out from the documentation: http://symfony.com/doc/current/cookbook/assetic/yuicompressor.html
You can find the exact parameters in vendor/symfony/assetic-bundle/Resources/config/filters
Usually you have to play a bit with the assetic.java.bin or assetic.filter.yui_js.jar
Edit: it looks that you have forgotten to set the yui compressor path: "/path/to/java/yuicompressor-2.4.8.jar"

JCIFS Package Reference Error in Javascript

I am trying to use JCIFS to access file in a shared folder and it works perfectly fine using a java program. But when I try to use this code in a javascript which is embedded in a ant script file I get the below error. I do see the jcifs-1.3.17.jar in the classpath of ANT but still it is complaining of reference error (ReferenceError: "jcifs" is not defined.).
Appreciate your inputs/thoughts on this. Thanks in Advance!!!
2014-07-17 11:41:32,739 ERROR org.apache.bsf.BSFManager - Exception :
java.security.PrivilegedActionException: org.apache.bsf.BSFException: JavaScript Error: Internal Error: org.mozilla.javascript.EcmaError: **ReferenceError: "jcifs" is not defined.**
at java.security.AccessController.doPrivileged(AccessController.java:255)
at org.apache.bsf.BSFManager.exec(BSFManager.java:491)
at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:100)
at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:52)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:600)
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:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: org.apache.bsf.BSFException: JavaScript Error: Internal Error: org.mozilla.javascript.EcmaError: ReferenceError: "jcifs" is not defined.
at org.apache.bsf.engines.javascript.JavaScriptEngine.handleError(JavaScriptEngine.java:195)
at org.apache.bsf.engines.javascript.JavaScriptEngine.eval(JavaScriptEngine.java:147)
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(AccessController.java:251)
... 19 more
Need to preface the package name with Packages.
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Scripting_Java#External_Packages_and_Classes

Geb Tests for pages with javascript in grails 2.3.5

I am upgrading from grails 2.2.4 to grails 2.3.5 and the last problem I am having is with geb functional tests. I have upgraded geb to 0.9.2.
The first problem is that it seems like it is first trying to run the geb tests as spock tests even though there aren't any geb spock tests, before running as a regular geb test.
The second problem is that in both cases when javascript is enabled, i.e.
in GebConfig.groovy
driver = {
def driver = new HtmlUnitDriver()
driver.javascriptEnabled = true
return driver
}
I get the following exception :
| ======= EXCEPTION START ========
Exception class=[net.sourceforge.htmlunit.corejs.javascript.EvaluatorException]
com.gargoylesoftware.htmlunit.ScriptException: syntax error (http://localhost:8081/xyz/static/IKfETRJERwBRdVMGxGDGgTIvzB2B464w7472lQKpd3b.js#156)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:684)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:602)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:524)
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1144)
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:1039)
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:409)
at com.gargoylesoftware.htmlunit.html.HtmlScript$3.execute(HtmlScript.java:266)
at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:286)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:683)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:642)
at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1170)
at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1072)
at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)
at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:330)
at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3116)
at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2083)
at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:918)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:899)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:242)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:188)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:268)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:156)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:437)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:311)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:393)
at com.gargoylesoftware.htmlunit.html.HtmlPage.refresh(HtmlPage.java:2234)
at org.openqa.selenium.htmlunit.HtmlUnitDriver$HtmlUnitNavigation.refresh(HtmlUnitDriver.java:1282)
at geb.Browser.go(Browser.groovy:395)
at geb.Page.to(Page.groovy:184)
at geb.Browser.via(Browser.groovy:475)
at geb.Browser.to(Browser.groovy:434)
at geb.Browser.to(Browser.groovy:412)
at geb.junit4.GebTest.methodMissing(GebTest.groovy:52)
......
Caused by: net.sourceforge.htmlunit.corejs.javascript.EvaluatorException: syntax error (http://localhost:8081/xyz/static/IKfETRJERwBRdVMGxGDGgTIvzB2B464w7472lQKpd3b.js#156)
at com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter.error(StrictErrorReporter.java:64)
at net.sourceforge.htmlunit.corejs.javascript.Parser.addError(Parser.java:187)
at net.sourceforge.htmlunit.corejs.javascript.Parser.addError(Parser.java:167)
at net.sourceforge.htmlunit.corejs.javascript.Parser.reportError(Parser.java:219)
at net.sourceforge.htmlunit.corejs.javascript.Parser.reportError(Parser.java:214)
at net.sourceforge.htmlunit.corejs.javascript.Parser.mustMatchToken(Parser.java:366)
at net.sourceforge.htmlunit.corejs.javascript.Parser.mustMatchToken(Parser.java:357)
at net.sourceforge.htmlunit.corejs.javascript.Parser.xmlInitializer(Parser.java:2292)
at net.sourceforge.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2252)
at net.sourceforge.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2184)
at net.sourceforge.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2170)
at net.sourceforge.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2153)
at net.sourceforge.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2130)
at net.sourceforge.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2104)
at net.sourceforge.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2095)
at net.sourceforge.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2086)
at net.sourceforge.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2077)
at net.sourceforge.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2068)
at net.sourceforge.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2059)
at net.sourceforge.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2025)
at net.sourceforge.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:1998)
at net.sourceforge.htmlunit.corejs.javascript.Parser.expr(Parser.java:1979)
at net.sourceforge.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1025)
at net.sourceforge.htmlunit.corejs.javascript.Parser.statement(Parser.java:891)
at net.sourceforge.htmlunit.corejs.javascript.Parser.parse(Parser.java:535)
at net.sourceforge.htmlunit.corejs.javascript.Parser.parse(Parser.java:456)
at net.sourceforge.htmlunit.corejs.javascript.Context.compileImpl(Context.java:2496)
at net.sourceforge.htmlunit.corejs.javascript.Context.compileString(Context.java:1456)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory$TimeoutContext.compileString(HtmlUnitContextFactory.java:201)
at net.sourceforge.htmlunit.corejs.javascript.Context.compileString(Context.java:1448)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$2.doRun(JavaScriptEngine.java:515)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:669)
... 38 more
Enclosed exception:
net.sourceforge.htmlunit.corejs.javascript.EvaluatorException: syntax error (http://localhost:8081/xyz/static/IKfETRJERwBRdVMGxGDGgTIvzB2B464w7472lQKpd3b.js#156)
at com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter.error(StrictErrorReporter.java:64)
at net.sourceforge.htmlunit.corejs.javascript.Parser.addError(Parser.java:187)
at net.sourceforge.htmlunit.corejs.javascript.Parser.addError(Parser.java:167)
at net.sourceforge.htmlunit.corejs.javascript.Parser.reportError(Parser.java:219)
at net.sourceforge.htmlunit.corejs.javascript.Parser.reportError(Parser.java:214)
at net.sourceforge.htmlunit.corejs.javascript.Parser.mustMatchToken(Parser.java:366)
at net.sourceforge.htmlunit.corejs.javascript.Parser.mustMatchToken(Parser.java:357)
at net.sourceforge.htmlunit.corejs.javascript.Parser.xmlInitializer(Parser.java:2292)
at net.sourceforge.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2252)
at net.sourceforge.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2184)
at net.sourceforge.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2170)
at net.sourceforge.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2153)
at net.sourceforge.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2130)
at net.sourceforge.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2104)
at net.sourceforge.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2095)
at net.sourceforge.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2086)
at net.sourceforge.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2077)
at net.sourceforge.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2068)
at net.sourceforge.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2059)
at net.sourceforge.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2025)
at net.sourceforge.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:1998)
at net.sourceforge.htmlunit.corejs.javascript.Parser.expr(Parser.java:1979)
at net.sourceforge.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1025)
at net.sourceforge.htmlunit.corejs.javascript.Parser.statement(Parser.java:891)
at net.sourceforge.htmlunit.corejs.javascript.Parser.parse(Parser.java:535)
at net.sourceforge.htmlunit.corejs.javascript.Parser.parse(Parser.java:456)
at net.sourceforge.htmlunit.corejs.javascript.Context.compileImpl(Context.java:2496)
at net.sourceforge.htmlunit.corejs.javascript.Context.compileString(Context.java:1456)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory$TimeoutContext.compileString(HtmlUnitContextFactory.java:201)
at net.sourceforge.htmlunit.corejs.javascript.Context.compileString(Context.java:1448)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$2.doRun(JavaScriptEngine.java:515)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:669)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:602)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:524)
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1144)
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:1039)
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:409)
at com.gargoylesoftware.htmlunit.html.HtmlScript$3.execute(HtmlScript.java:266)
at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:286)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:683)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:642)
at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1170)
at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1072)
at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)
at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:330)
at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3116)
at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2083)
at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:918)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:899)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:242)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:188)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:268)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:156)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:437)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:311)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:393)
at com.gargoylesoftware.htmlunit.html.HtmlPage.refresh(HtmlPage.java:2234)
at org.openqa.selenium.htmlunit.HtmlUnitDriver$HtmlUnitNavigation.refresh(HtmlUnitDriver.java:1282)
at geb.Browser.go(Browser.groovy:395)
at geb.Page.to(Page.groovy:184)
at geb.Browser.via(Browser.groovy:475)
at geb.Browser.to(Browser.groovy:434)
at geb.Browser.to(Browser.groovy:412)
at geb.junit4.GebTest.methodMissing(GebTest.groovy:52)
.....
When javascript is not enabled, the tests for pages without javascript pass but tests for pages with javascript get the following:
java.lang.UnsupportedOperationException: Javascript is not enabled for this HtmlUnitDriver instance
at org.openqa.selenium.htmlunit.HtmlUnitDriver.getPageToInjectScriptInto(HtmlUnitDriver.java:639)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.executeScript(HtmlUnitDriver.java:590)
at geb.js.JavascriptInterface._execjs(JavascriptInterface.groovy:41)
at geb.js.JavascriptInterface.exec(JavascriptInterface.groovy:71)
at geb.js.JQueryAdapter._callJQueryMethod(JQueryAdapter.groovy:33)
at geb.js.JQueryAdapter.methodMissing(JQueryAdapter.groovy:60)
at com.sra.ridge.geb.page.RidgePage.populateSecurityQuestions(RidgePage.groovy:95)
at geb.Browser.methodMissing(Browser.groovy:194)
Any suggestions for how to handle these issues? These tests passed when using grails 2.2.3 and geb 0.9.0-RC-1
The syntax error was apparently due to the hashing of javascript files by the resource plugin and setting
grails.resources.mappers.hashandcache.excludes = ['*/']
in the test environment in Config.groovy fixed the issue of the exception.
Using geb 0.9.0-RC1 fixed the issue of the tests running twice. It is unfortunate that we can't upgrade to 0.9.2 of geb.

Eclipse: Create new JavaScript file error

To start of, i made a project in GitHub, imported it into Eclipse (kepler) with Egit, and made it a JavaScript project (with the standard javascript plugin). I worked in this project no problem. I pushed the complete project (including .project files etc. ) into GitHub.
Now, when i import this project on another computer, things go weird. I Imported it with from the GitHub repository with Egit. Then i used the import as existing project, as i uploaded all the project files with it. Now this works great and all, until i want to create a new JavaScript file.
When i do, the new Create a new JavaScript file. window apears, but when i enter a name, the Finish button remains disabled. Also, when i click one of the parent folders i get an nullpointer exception:
Can anyone tell me what i'm doing wrong here? is it a bug? can't i just import other projects on different pc's? Or is something going wrong with git?
Here is the error log:
Problems occurred when invoking code from plug-in: "org.eclipse.jface".
java.lang.NullPointerException
at org.eclipse.wst.jsdt.internal.ui.wizards.NewJSFileWizardPage.validatePage(NewJSFileWizardPage.java:122)
at org.eclipse.ui.dialogs.WizardNewFileCreationPage.handleEvent(WizardNewFileCreationPage.java:676)
at org.eclipse.ui.internal.ide.misc.ResourceAndContainerGroup.handleEvent(ResourceAndContainerGroup.java:367)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1081)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Text.wmCommandChild(Text.java:2974)
at org.eclipse.swt.widgets.Control.WM_COMMAND(Control.java:4752)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4614)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4977)
at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2443)
at org.eclipse.swt.widgets.Text.callWindowProc(Text.java:260)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4706)
at org.eclipse.swt.widgets.Text.windowProc(Text.java:2597)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4977)
at org.eclipse.swt.internal.win32.OS.SetWindowTextW(Native Method)
at org.eclipse.swt.internal.win32.OS.SetWindowText(OS.java:3473)
at org.eclipse.swt.widgets.Text.setText(Text.java:2252)
at org.eclipse.ui.internal.ide.misc.ContainerSelectionGroup.containerSelectionChanged(ContainerSelectionGroup.java:190)
at org.eclipse.ui.internal.ide.misc.ContainerSelectionGroup$1.selectionChanged(ContainerSelectionGroup.java:276)
at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:164)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:162)
at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2188)
at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1211)
at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1241)
at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:239)
at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:233)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:403)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:826)
at org.eclipse.jface.window.Window.open(Window.java:802)
at org.eclipse.ui.internal.actions.NewWizardShortcutAction.run(NewWizardShortcutAction.java:135)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
The problem doesn't occur when i take the next steps:
import the project with Git (projects files excluded)
add the project as a general project
convert it to a JavaScript project.
This has solved my issue, but still i would like to have an answer about what i'm doing wrong with my other method.
Greets, David

Grails ui-performance plugin not working with CKEditor

I installed Grails ui-performance plugin and made the necessary changes in the code. It didn't seem to work for development, I was getting files which name was ending with "_vnull" so I disabled it for development and tried to test with a WAR file. However, when generating the WAR file I get the following error and exception:
[ERROR] 1:0:Compilation produced 55 syntax errors. in lineSource: null sourceName: null
ERROR: problem minifying /Users/maricel/.grails/1.3.5/projects/community-services/stage/plugins/ckeditor-3.4.1.1-SNAPSHOT/js/ofm/scripts/languages/ca.js: Compilation produced 55 syntax errors.
org.mozilla.javascript.EvaluatorException: Compilation produced 55 syntax errors.
at com.studentsonly.grails.plugins.uiperformance.JsErrorReporter.runtimeError(JsErrorReporter.groovy:35)
at org.mozilla.javascript.Parser.parse(Parser.java:410)
at org.mozilla.javascript.Parser.parse(Parser.java:355)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.versionAndMinifyJs(ResourceVersionHelper.groovy:230)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.this$2$versionAndMinifyJs(ResourceVersionHelper.groovy)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper$this$2$versionAndMinifyJs.callCurrent(Unknown Source)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.applyVersion(ResourceVersionHelper.groovy:158)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.this$2$applyVersion(ResourceVersionHelper.groovy)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper$_versionResources_closure1.doCall(ResourceVersionHelper.groovy:101)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.versionResources(ResourceVersionHelper.groovy:91)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.this$2$versionResources(ResourceVersionHelper.groovy)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper$this$2$versionResources.callCurrent(Unknown Source)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.version(ResourceVersionHelper.groovy:44)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper$version.call(Unknown Source)
at _Events.versionResources(_Events.groovy:36)
at _Events$_run_closure2.doCall(_Events.groovy:16)
at _GrailsEvents_groovy$_run_closure5.doCall(_GrailsEvents_groovy:58)
at _GrailsEvents_groovy$_run_closure5.call(_GrailsEvents_groovy)
at _GrailsWar_groovy$_run_closure5.doCall(_GrailsWar_groovy:327)
at War$_run_closure1.doCall(War.groovy:38)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
Error executing script War: org.mozilla.javascript.EvaluatorException: Compilation produced 55 syntax errors.
Is this some conflict with the CKEditor plugin? Any idea how to fix it?
Thanks for your help!
I fixed this issue by adding an exclusion for the plugins directory:
uiperformance.exclusions = [
"**/plugins/**"
]
As suggested in this nabble post

Categories

Resources