[groovy-user] Issue with documented way to run a script with a user base class

0 views
Skip to first unread message

DECLOEDT Loic EVADERIS

unread,
Jan 26, 2015, 8:43:04 AM1/26/15
to us...@groovy.codehaus.org

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

eVaderis-logo-CMJN-small1

 

Minatec Entreprise BHT

7, Parvis Louis Néel

38054 Grenoble Cedex 9

France

 

 

 

--

Loïc Decloedt

CAD & Software Manager

eVaderis

eVaderis-logo-CMJN-small1

 

Minatec Entreprise BHT

7, Parvis Louis Néel

38054 Grenoble Cedex 9

France

Office : 04 38 7 81109

Mobile : 06 85 55 33 95

 

Reply all
Reply to author
Forward
0 new messages