[ http://jira.codehaus.org/browse/MNG-1178?page=comments#action_48794 ] 

fabrizio giustina commented on MNG-1178:
----------------------------------------

Here you can find a project which shows this problem:
http://cvs.sourceforge.net/viewcvs.py/displaytag/

I recently refactored the displaytag build in order to use m2 with a 4-modules 
build.
The parent project is displaytag-doc, displaytag and displaytag-export poi are 
two jar projects and displaytag-examples is a war.

Building displaytag-examples alone works, but if you run mvn install from 
displaytag-doc the build breaks at displaytag-examples (a war project without 
junit tests) with the error:
[INFO] Error executing surefire
tried to access method junit.framework.TestCase.<init>()V from class 
org.codehaus.surefire.battery.assertion.BatteryAssert


NOTE that at the moment I added the junit dependency as a workaround to 
displaytag-examples/pom.xml . If anybody wants to give a look at this issue 
using this project as an example he will have to comment out the dependency 
(with this additional dependency everything works, as described by Matthew).
I'll try to track down the cause of the error and to reproduce it with a 
simpler testcase.



> weird junit classloader issue
> -----------------------------
>
>          Key: MNG-1178
>          URL: http://jira.codehaus.org/browse/MNG-1178
>      Project: Maven 2
>         Type: Bug
>  Environment: java 1.5, linux
>     Reporter: Matthew Pocock
>     Assignee: Brett Porter
>      Fix For: 2.0.1

>
>
> In some cases (that I've not narrowed down), I get this exception when doing 
> m2 install. The affected projects have no test cases and no dependencies taht 
> use JUnit in any way. i can get rid of this exceptino if Junit is added as a 
> test scope dependency. It smells like a class loader issue where something 
> funkey is going on to make the no-args constructor of UnitTest unavailable 
> for chaining from BatteryAssert. Beats me.
> org.apache.maven.plugin.MojoExecutionException: Error executing surefire
>         at 
> org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:294)
>         at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:419)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:599)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:546)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:529)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:326)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:152)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:237)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:251)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>         at 
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.codehaus.surefire.SurefireBooter.run(SurefireBooter.java:104)
>         at 
> org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:289)
>         ... 16 more
> Caused by: java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>         at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>         at 
> org.codehaus.surefire.Surefire.instantiateBatteries(Surefire.java:274)
>         at org.codehaus.surefire.Surefire.run(Surefire.java:82)
>         at org.codehaus.surefire.Surefire.run(Surefire.java:76)
>         ... 22 more
> Caused by: java.lang.IllegalAccessError: tried to access method 
> junit.framework.TestCase.<init>()V from class 
> org.codehaus.surefire.battery.assertion.BatteryAssert
>         at 
> org.codehaus.surefire.battery.assertion.BatteryAssert.<init>(BatteryAssert.java:23)
>         at 
> org.codehaus.surefire.battery.AbstractBattery.<init>(AbstractBattery.java:31)
>         at 
> org.codehaus.surefire.battery.DirectoryBattery.<init>(DirectoryBattery.java:39)
>         ... 29 more

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to