groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alain Stalder <astal...@span.ch>
Subject Re: Grape and loading classes that extend java.lang.Exception from compiled Groovy bytecode
Date Sat, 04 Mar 2017 08:08:35 GMT
Paul King wrote:

 > Is there a reason you don't want to use:
 >
 > @GrabConfig(systemClassLoader=true)
 >
 > along with your @Grab?

Actually, it looks like I found a reason that really makes this
no option: It apparently does not work in a web container, tried
in a Tomcat (8.0) and an embedded Jetty.

I get a "java.lang.RuntimeException: No suitable ClassLoader found for 
grab".

The stack trace for Tomcat is further below, the exception occurs when
parsing the script, the webapp is written in Groovy and calls the test
script of my first post in this thread (plus 
@GrabConfig(systemClassLoader=true)).

Not important to me to have this working, since I chose a different,
more generic/flexible approach anyway.

Alain


java.lang.RuntimeException: No suitable ClassLoader found for grab
     at 
org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
     at groovy.grape.GrapeIvy.chooseClassLoader(GrapeIvy.groovy:182)
     at 
org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
     at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:249)
     at groovy.grape.Grape.grab(Grape.java:167)
     at 
groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:378)
     at 
org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:321)
     at 
org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)
     at 
org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
     at 
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
     at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
     at 
groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
     at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
     at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:254)
     at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:211)
     at groovy.lang.GroovyClassLoader$parseClass.call(Unknown Source)
     at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
     at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
     at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
     at net.jexler.war.Test.run(Test.groovy:34)
     at 
net.jexler.war.JexlerContextListener.contextInitialized(JexlerContextListener.groovy:72)
     at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853)
     at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
     at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
     at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
     at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
     at 
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1092)
     at 
org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1834)
     at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
     at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
     at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
     at java.lang.Thread.run(Thread.java:745)


Mime
View raw message