Hi,
I am working with the following tools:
- JDK 1.7
- Groovy 2.3.7
- Eclipse Luna
I tested the method to run an external script by overriding its base class as documented in your doc page:
http://groovy.codehaus.org/Embedding+Groovy
However, when I apply this method, I have the following error:
java.lang.NoSuchMethodError: data.ScriptBaseTest$AbsScriptBaseTestScript: method <init>()V not found
at Script1.<init>(Script1.groovy)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:379)
at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:420)
at groovy.lang.GroovyShell.parse(GroovyShell.java:686)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:568)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:608)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:579)
at groovy.lang.GroovyShell$evaluate$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at data.ScriptBaseTest.invalidTest(ScriptBaseTest.groovy:37)
Can you explain with this error is happening. Can I correct it in any way ?
In addition, I tried the method explained the method explained here, which works:
http://stackoverflow.com/questions/27027581/execute-groovy-script-in-java-with-specific-root-object
Is this method is better, can the documentation be updated?
Thanks,
Loïc.
--
Loïc Decloedt
CAD & Software Manager
eVaderis
Minatec Entreprise BHT
7, Parvis Louis Néel
38054 Grenoble Cedex 9
France
--
Loïc Decloedt
CAD & Software Manager
eVaderis
Minatec Entreprise BHT
7, Parvis Louis Néel
38054 Grenoble Cedex 9
France
Office : 04 38 7 81109
Mobile : 06 85 55 33 95