Re: Grape and loading classes that extend java.lang.Exception from compiled Groovy bytecode

2017-03-05 Thread Alain Stalder
For completeness, I have created a GROOVY issue for this, just to have it reported in case somebody else stumbles into this behavior: https://issues.apache.org/jira/browse/GROOVY-8108

Re: Grape and loading classes that extend java.lang.Exception from compiled Groovy bytecode

2017-03-04 Thread Alain Stalder
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.

Re: Grape and loading classes that extend java.lang.Exception from compiled Groovy bytecode

2017-02-27 Thread Alain Stalder
Correction: if (args.containsKey("classLoader") && args.get("classLoader") != ClassLoader.getSystemClassLoader()) { not: if (args.containsKey("classLoader") && args.get("classLoader" != ClassLoader.getSystemClassLoader())) {

Re: Grape and loading classes that extend java.lang.Exception from compiled Groovy bytecode

2017-02-27 Thread Alain Stalder
I was not aware of that option, that's already better :) ... but I am not sure if it goes far enough, as follows. I have two use cases, both involving Grengine. The more immediate one is a webapp with a single Grengine instance based on a set of Groovy script files and so far it is the only web

Re: Grape and loading classes that extend java.lang.Exception from compiled Groovy bytecode

2017-02-27 Thread Paul King
Is there a reason you don't want to use: @GrabConfig(systemClassLoader=true) along with your @Grab? On Mon, Feb 27, 2017 at 7:51 PM, Alain Stalder wrote: > Maybe someone can point me in the right direction regarding the following > issue with Grape... > > Issue in code (in words further below):

Re: Grape and loading classes that extend java.lang.Exception from compiled Groovy bytecode

2017-02-27 Thread Alain Stalder
Tonight I got this to load the EmailException class a few times without any changes to the source - so it must be a race condition. I guess the static initializer at the bottom is a call to Grape#grab(Map dependency) with the effect of adding the commons-email JAR to the classpath. And I gue

Re: Grape and loading classes that extend java.lang.Exception from compiled Groovy bytecode

2017-02-27 Thread Alain Stalder
PS: Below is what I get when I look at the Demo.class with the "JD" decompiler... Is this maybe some kind of Grape concurrency issue similar to GROOVY-7407? https://issues.apache.org/jira/browse/GROOVY-7407 (I still get the same result when I am applying the workaround listed there - which

Grape and loading classes that extend java.lang.Exception from compiled Groovy bytecode

2017-02-27 Thread Alain Stalder
Maybe someone can point me in the right direction regarding the following issue with Grape... Issue in code (in words further below): -- import org.codehaus.groovy.control.CompilerConfiguration def demoScriptText = """\ @Grab('org.apache.commons:commons-email:1.3.3') import org.apache.commons.