You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Johan Romme (JIRA)" <ji...@codehaus.org> on 2008/05/21 11:21:42 UTC

[jira] Created: (SUREFIRE-500) puzzling NoClassDefFoundError instead of meaningfull stacktrace

puzzling NoClassDefFoundError instead of meaningfull stacktrace
---------------------------------------------------------------

                 Key: SUREFIRE-500
                 URL: http://jira.codehaus.org/browse/SUREFIRE-500
             Project: Maven Surefire
          Issue Type: Bug
          Components: classloading
    Affects Versions: 2.4.2
         Environment: maven 2.0.9 , linux/ubuntu, jdk-sun-1.5.0_13
            Reporter: Johan Romme


We are using maven-2.0.9 for some project using spring/hibernate.

When I made an incorrect change to the spring configuration (or actually I removed a hbm.xml file that was still referenced in the spring config), maven/surefire failed with an NoClassDefFoundError on one of our abstract test classes (where the spring config was loaded). Running in debug mode (-X) or increasing log4j levels did not reveal more info as to the cause of the problem. 

After some time I switched back to maven-2.0.7,  maven/surefire also failed but with a meaningfull stacktrace that pointed immediately to the cause of the problem. 

So I fixed the problem, switched again to maven-2.0.9, with a succesfull build as result.





-- 
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

        

[jira] Issue Comment Edited: (SUREFIRE-500) puzzling NoClassDefFoundError instead of meaningfull stacktrace

Posted by "James Hood (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=212035#action_212035 ] 

James Hood edited comment on SUREFIRE-500 at 3/1/10 11:18 AM:
--------------------------------------------------------------

I was having a similar problem and I think I have nailed down the interaction (I don't have any insight into what's causing the problem, however).

Attached is a simple maven project that contains two tests and one suite. The two tests are ExplodingTest, which throws a java.lang.NoClassDefFoundError inside a static block, and PassingTest which has a number of tests that, well, pass.

The suite combines the two tests together.

Running "mvn clean test -Dtest=Suite" demonstrates the unexpected behavior from surefire: No xml reports are generated describing the outcomes of the tests in {{target/surefire-reports}}

To fix update the JUnit dependency in the pom.xml from 4.4 to 4.8.1. Doing that and rerunning the command results in an accurate xml test result report being generated.

I hope this helps clarify the problem. It was certainly a pain to track this down. Since Spring < 3.0 requires JUnit <= 4.4 my guess is that most who have experienced the issue are using Spring. So while it may *seem* like a Spring issue I'm guessing it is really a JUnit 4.4 issue.

Cheers,
jim

      was (Author: hoodja):
    I was having a similar problem and I think I have nailed down the interaction (I don't have any insight into what's causing the problem, however).

Attached is a simple maven project that contains two tests and one suite. The two tests are ExplodingTest, which throws a java.lang.NoClassDefFoundError inside a static block, and PassingTest which has a nummber of tests that, well, pass.

The suite combines the two tests together.

Running "mvn clean test -Dtest=Suite" demonstrates the unexpected behavior from surefire: No xml reports are generated describing the outcomes of the tests in {{target/surefire-reports}}

To fix update the JUnit dependency in the pom.xml from 4.4 to 4.8.1. Doing that and rerunning the command results in an accurate xml test result report being generated.

I hope this helps clarify the problem. It was certainly a pain to track this down. Since Spring < 3.0 requires JUnit <= 4.4 my guess is that most who have experienced the issue are using Spring. So while it may *seem* like a Spring issue I'm guessing it is really a JUnit 4.4 issue.

Cheers,
jim
  
> puzzling NoClassDefFoundError instead of meaningfull stacktrace
> ---------------------------------------------------------------
>
>                 Key: SUREFIRE-500
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-500
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading
>    Affects Versions: 2.4.2
>         Environment: maven 2.0.9 , linux/ubuntu, jdk-sun-1.5.0_13
>            Reporter: Johan Romme
>         Attachments: surefireTest.zip
>
>
> We are using maven-2.0.9 for some project using spring/hibernate.
> When I made an incorrect change to the spring configuration (or actually I removed a hbm.xml file that was still referenced in the spring config), maven/surefire failed with an NoClassDefFoundError on one of our abstract test classes (where the spring config was loaded). Running in debug mode (-X) or increasing log4j levels did not reveal more info as to the cause of the problem. 
> After some time I switched back to maven-2.0.7,  maven/surefire also failed but with a meaningfull stacktrace that pointed immediately to the cause of the problem. 
> So I fixed the problem, switched again to maven-2.0.9, with a succesfull build as result.

-- 
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

        

[jira] Closed: (SUREFIRE-500) puzzling NoClassDefFoundError instead of meaningfull stacktrace

Posted by "Kristian Rosenvold (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Rosenvold closed SUREFIRE-500.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.7.2
         Assignee: Kristian Rosenvold

Fixed with integration test in r1058735

> puzzling NoClassDefFoundError instead of meaningfull stacktrace
> ---------------------------------------------------------------
>
>                 Key: SUREFIRE-500
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-500
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading
>    Affects Versions: 2.4.2
>         Environment: maven 2.0.9 , linux/ubuntu, jdk-sun-1.5.0_13
>            Reporter: Johan Romme
>            Assignee: Kristian Rosenvold
>             Fix For: 2.7.2
>
>         Attachments: surefireTest.zip
>
>
> We are using maven-2.0.9 for some project using spring/hibernate.
> When I made an incorrect change to the spring configuration (or actually I removed a hbm.xml file that was still referenced in the spring config), maven/surefire failed with an NoClassDefFoundError on one of our abstract test classes (where the spring config was loaded). Running in debug mode (-X) or increasing log4j levels did not reveal more info as to the cause of the problem. 
> After some time I switched back to maven-2.0.7,  maven/surefire also failed but with a meaningfull stacktrace that pointed immediately to the cause of the problem. 
> So I fixed the problem, switched again to maven-2.0.9, with a succesfull build as result.

-- 
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

        

[jira] Issue Comment Edited: (SUREFIRE-500) puzzling NoClassDefFoundError instead of meaningfull stacktrace

Posted by "James Ravn (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=172468#action_172468 ] 

James Ravn edited comment on SUREFIRE-500 at 4/8/09 1:14 PM:
-------------------------------------------------------------

I'm also experiencing this issue. If a class fails during static initialization, surefire spits out the cryptic NoClassDefFoundError instead of a meaningful stack trace.

Surefire 2.0 does not suffer from this problem. All recent versions do.

      was (Author: jsravn):
    I also see this issue. If your class fails during static initialization, surefire spits out the cryptic NoClassDefFoundError instead of a meaningful stack trace.

Surefire 2.0 does not suffer from this problem. All recent versions do.
  
> puzzling NoClassDefFoundError instead of meaningfull stacktrace
> ---------------------------------------------------------------
>
>                 Key: SUREFIRE-500
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-500
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading
>    Affects Versions: 2.4.2
>         Environment: maven 2.0.9 , linux/ubuntu, jdk-sun-1.5.0_13
>            Reporter: Johan Romme
>
> We are using maven-2.0.9 for some project using spring/hibernate.
> When I made an incorrect change to the spring configuration (or actually I removed a hbm.xml file that was still referenced in the spring config), maven/surefire failed with an NoClassDefFoundError on one of our abstract test classes (where the spring config was loaded). Running in debug mode (-X) or increasing log4j levels did not reveal more info as to the cause of the problem. 
> After some time I switched back to maven-2.0.7,  maven/surefire also failed but with a meaningfull stacktrace that pointed immediately to the cause of the problem. 
> So I fixed the problem, switched again to maven-2.0.9, with a succesfull build as result.

-- 
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

        

[jira] Updated: (SUREFIRE-500) puzzling NoClassDefFoundError instead of meaningfull stacktrace

Posted by "James Hood (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Hood updated SUREFIRE-500:
--------------------------------

    Attachment: surefireTest.zip

I was having a similar problem and I think I have nailed down the interaction (I don't have any insight into what's causing the problem, however).

Attached is a simple maven project that contains two tests and one suite. The two tests are ExplodingTest, which throws a java.lang.NoClassDefFoundError inside a static block, and PassingTest which has a nummber of tests that, well, pass.

The suite combines the two tests together.

Running "mvn clean test -Dtest=Suite" demonstrates the unexpected behavior from surefire: No xml reports are generated describing the outcomes of the tests in {{target/surefire-reports}}

To fix update the JUnit dependency in the pom.xml from 4.4 to 4.8.1. Doing that and rerunning the command results in an accurate xml test result report being generated.

I hope this helps clarify the problem. It was certainly a pain to track this down. Since Spring < 3.0 requires JUnit <= 4.4 my guess is that most who have experienced the issue are using Spring. So while it may *seem* like a Spring issue I'm guessing it is really a JUnit 4.4 issue.

Cheers,
jim

> puzzling NoClassDefFoundError instead of meaningfull stacktrace
> ---------------------------------------------------------------
>
>                 Key: SUREFIRE-500
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-500
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading
>    Affects Versions: 2.4.2
>         Environment: maven 2.0.9 , linux/ubuntu, jdk-sun-1.5.0_13
>            Reporter: Johan Romme
>         Attachments: surefireTest.zip
>
>
> We are using maven-2.0.9 for some project using spring/hibernate.
> When I made an incorrect change to the spring configuration (or actually I removed a hbm.xml file that was still referenced in the spring config), maven/surefire failed with an NoClassDefFoundError on one of our abstract test classes (where the spring config was loaded). Running in debug mode (-X) or increasing log4j levels did not reveal more info as to the cause of the problem. 
> After some time I switched back to maven-2.0.7,  maven/surefire also failed but with a meaningfull stacktrace that pointed immediately to the cause of the problem. 
> So I fixed the problem, switched again to maven-2.0.9, with a succesfull build as result.

-- 
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

        

[jira] Commented: (SUREFIRE-500) puzzling NoClassDefFoundError instead of meaningfull stacktrace

Posted by "James Ravn (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=172468#action_172468 ] 

James Ravn commented on SUREFIRE-500:
-------------------------------------

I also see this issue. If your class fails during static initialization, surefire spits out the cryptic NoClassDefFoundError instead of a meaningful stack trace.

Surefire 2.0 does not suffer from this problem. All recent versions do.

> puzzling NoClassDefFoundError instead of meaningfull stacktrace
> ---------------------------------------------------------------
>
>                 Key: SUREFIRE-500
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-500
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading
>    Affects Versions: 2.4.2
>         Environment: maven 2.0.9 , linux/ubuntu, jdk-sun-1.5.0_13
>            Reporter: Johan Romme
>
> We are using maven-2.0.9 for some project using spring/hibernate.
> When I made an incorrect change to the spring configuration (or actually I removed a hbm.xml file that was still referenced in the spring config), maven/surefire failed with an NoClassDefFoundError on one of our abstract test classes (where the spring config was loaded). Running in debug mode (-X) or increasing log4j levels did not reveal more info as to the cause of the problem. 
> After some time I switched back to maven-2.0.7,  maven/surefire also failed but with a meaningfull stacktrace that pointed immediately to the cause of the problem. 
> So I fixed the problem, switched again to maven-2.0.9, with a succesfull build as result.

-- 
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

        

[jira] Commented: (SUREFIRE-500) puzzling NoClassDefFoundError instead of meaningfull stacktrace

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196954#action_196954 ] 

Brett Porter commented on SUREFIRE-500:
---------------------------------------

I can't reproduce this. I added this to a static init:

static { if ( true ) throw new RuntimeException( "die!" ); }

Do you have a sample project?

> puzzling NoClassDefFoundError instead of meaningfull stacktrace
> ---------------------------------------------------------------
>
>                 Key: SUREFIRE-500
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-500
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading
>    Affects Versions: 2.4.2
>         Environment: maven 2.0.9 , linux/ubuntu, jdk-sun-1.5.0_13
>            Reporter: Johan Romme
>
> We are using maven-2.0.9 for some project using spring/hibernate.
> When I made an incorrect change to the spring configuration (or actually I removed a hbm.xml file that was still referenced in the spring config), maven/surefire failed with an NoClassDefFoundError on one of our abstract test classes (where the spring config was loaded). Running in debug mode (-X) or increasing log4j levels did not reveal more info as to the cause of the problem. 
> After some time I switched back to maven-2.0.7,  maven/surefire also failed but with a meaningfull stacktrace that pointed immediately to the cause of the problem. 
> So I fixed the problem, switched again to maven-2.0.9, with a succesfull build as result.

-- 
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

        

[jira] Commented: (SUREFIRE-500) puzzling NoClassDefFoundError instead of meaningfull stacktrace

Posted by "Gabriele Columbro (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=171919#action_171919 ] 

Gabriele Columbro commented on SUREFIRE-500:
--------------------------------------------

I'm also experiencing this issue with maven 2.0.9, with a weird NoClassDefFoundError on the base Spring test class AbstractDependencyInjectionSpringContextTests, which is instead declared with 'test' scope in the pom.

Luckily a 'mvn clean' saved the day :)

> puzzling NoClassDefFoundError instead of meaningfull stacktrace
> ---------------------------------------------------------------
>
>                 Key: SUREFIRE-500
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-500
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading
>    Affects Versions: 2.4.2
>         Environment: maven 2.0.9 , linux/ubuntu, jdk-sun-1.5.0_13
>            Reporter: Johan Romme
>
> We are using maven-2.0.9 for some project using spring/hibernate.
> When I made an incorrect change to the spring configuration (or actually I removed a hbm.xml file that was still referenced in the spring config), maven/surefire failed with an NoClassDefFoundError on one of our abstract test classes (where the spring config was loaded). Running in debug mode (-X) or increasing log4j levels did not reveal more info as to the cause of the problem. 
> After some time I switched back to maven-2.0.7,  maven/surefire also failed but with a meaningfull stacktrace that pointed immediately to the cause of the problem. 
> So I fixed the problem, switched again to maven-2.0.9, with a succesfull build as result.

-- 
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