grails/grails-maven

mvn install fails with InvocationTargetException jline_.dll already loaded

kjeldahl opened this issue · 5 comments

After mavenizing a grails project I get the following when running mvn install:

...
[INFO] Surefire report directory: C:\efpi\workspaces\ehp\Efpi\Portal\portal\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- grails-maven-plugin:2.0.0:maven-test (default) @ portal ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.854s
[INFO] Finished at: Tue Jan 31 14:18:13 CET 2012
[INFO] Final Memory: 51M/92M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.0.0:maven-test (default) on project portal: Unable to st
art Grails: java.lang.reflect.InvocationTargetException: Native Library C:\Users\jkj\AppData\Local\Temp\jline_.dl
l already loaded in another classloader -> [Help 1]

Any ideas?

/Jacob

It seems that jline does not like to be loaded several times. So I ended up patching jline to use a random name for the dll each time it is initialized.

How did you patch jline? I'm having the same problem...

In file WindowsTerminal.java around line 276 I changed

        File f = new File(System.getProperty("java.io.tmpdir"), name + "_"
                + version + ".dll");

to

        File f = File.createTempFile(name+"_"+version, ".dll");

So it is a bit of a hack

cool - thanks :-)

A better choice than patching jline is to load jline into its own classloader and hold onto that classloader as a static, then each run through runGrails uses that classloader as its parent instead of the sytem classloader.