Quantcast

Intermittent java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Intermittent java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier

Dan Tran
Hi

Lately, my build randomly fails with

  java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier
 at surefire


My environment consists of

  * 200+ modules  running with --builder smart  -T 4
  * surefire 2.19.1 and 2.20, maven 3.3.9 and 3.5
  * Build runs on Sles12SP2 with OpenJDK8

Stack Overflow has a similar issue back in 2014

Any suggestion helping to trouble shoot this issue is greatly appreciated

Thanks

-Dan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Intermittent java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier

Fabian van der Veen
Hey Dan,

Given the symptoms you mention, I think you may be hitting the same issue with your concurrent build as we did a while ago (and which has been reported as https://issues.apache.org/jira/browse/MNG-5960).

Basically, (based on some debugging I did for our build,) having some aggregate plugin running in anything else than your root project may cause this to happen in a multi-threaded build. In our case, it was the default behaviour of the maven-javadoc-plugin. In short, it boils down to the aggregate plugin resolving compile-scope dependencies for _all_ projects in the reactor, which may possibly overwrite already resolved test-scope dependencies for currently building projects; resulting in classpath issues (usually) no longer being able to find junit.

I don't know if there is an easy way to find aggregate plugins other than looking into their mojo source code; so maybe someone else on this list can help you with that..

Good luck!

-- Fabian

On Fri, 2017-05-05 at 00:51 -0700, Dan Tran wrote:

Hi

Lately, my build randomly fails with

  java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier
 at surefire


My environment consists of

  * 200+ modules  running with --builder smart  -T 4
  * surefire 2.19.1 and 2.20, maven 3.3.9 and 3.5
  * Build runs on Sles12SP2 with OpenJDK8

Stack Overflow has a similar issue back in 2014

Any suggestion helping to trouble shoot this issue is greatly appreciated

Thanks

-Dan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Intermittent java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier

mgainty
In reply to this post by Dan Tran


________________________________
From: Dan Tran <[hidden email]>
Sent: Friday, May 5, 2017 3:51 AM
To: Maven Users List
Subject: Intermittent java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier

Hi

Lately, my build randomly fails with

  java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier
 at surefire


My environment consists of

  * 200+ modules  running with --builder smart  -T 4
  * surefire 2.19.1 and 2.20, maven 3.3.9 and 3.5
  * Build runs on Sles12SP2 with OpenJDK8

Stack Overflow has a similar issue back in 2014

MG>assuming you are not using Hamcrest following surefire doc i assume declaring junit-dep as dependency to maven-surefire-plugin will solve

  <dependencies>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit-dep</artifactId>

         <scope>test</scope>
      </dependency>

MG>http://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html
<http://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html>
Maven Surefire Plugin – Using JUnit<http://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html>
maven.apache.org
This is the only step that is required to get started - you can now create tests in your test source directory (e.g., src/test/java). Surefire supports three ...

MG>once junit added as dependency supposedly surefire test classloader will now see junit classes (including org/junit/runner/notification/RunNotifier)
MG>does this help?


Any suggestion helping to trouble shoot this issue is greatly appreciated

Thanks

-Dan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Intermittent java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier

Dan Tran
@Fabian, yes i do recall vaguely with your and I have a good run for a year
:-). Thanks for the reminder, i can search thru new mojos lately introduced
to the build and find out. Thanks

@Martin,  i do use hamcrest

-D

On Fri, May 5, 2017 at 4:42 AM, Martin Gainty <[hidden email]> wrote:

>
>
> ________________________________
> From: Dan Tran <[hidden email]>
> Sent: Friday, May 5, 2017 3:51 AM
> To: Maven Users List
> Subject: Intermittent java.lang.NoClassDefFoundError:
> org/junit/runner/notification/RunNotifier
>
> Hi
>
> Lately, my build randomly fails with
>
>   java.lang.NoClassDefFoundError: org/junit/runner/notification/
> RunNotifier
>  at surefire
>
>
> My environment consists of
>
>   * 200+ modules  running with --builder smart  -T 4
>   * surefire 2.19.1 and 2.20, maven 3.3.9 and 3.5
>   * Build runs on Sles12SP2 with OpenJDK8
>
> Stack Overflow has a similar issue back in 2014
>
> MG>assuming you are not using Hamcrest following surefire doc i assume
> declaring junit-dep as dependency to maven-surefire-plugin will solve
>
>   <dependencies>
>       <dependency>
>         <groupId>junit</groupId>
>         <artifactId>junit-dep</artifactId>
>
>          <scope>test</scope>
>       </dependency>
>
> MG>http://maven.apache.org/surefire/maven-surefire-
> plugin/examples/junit.html
> <http://maven.apache.org/surefire/maven-surefire-
> plugin/examples/junit.html>
> Maven Surefire Plugin – Using JUnit<http://maven.apache.org/
> surefire/maven-surefire-plugin/examples/junit.html>
> maven.apache.org
> This is the only step that is required to get started - you can now create
> tests in your test source directory (e.g., src/test/java). Surefire
> supports three ...
>
> MG>once junit added as dependency supposedly surefire test classloader
> will now see junit classes (including org/junit/runner/notification/
> RunNotifier)
> MG>does this help?
>
>
> Any suggestion helping to trouble shoot this issue is greatly appreciated
>
> Thanks
>
> -Dan
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Intermittent java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier

Dan Tran
@Fabian, one more time you have come to my rescue.   Indeed, we introduce a
new MOJO  and it has aggregate flag set to true

Thanks again

-Dan

On Fri, May 5, 2017 at 8:56 AM, Dan Tran <[hidden email]> wrote:

> @Fabian, yes i do recall vaguely with your and I have a good run for a
> year :-). Thanks for the reminder, i can search thru new mojos lately
> introduced to the build and find out. Thanks
>
> @Martin,  i do use hamcrest
>
> -D
>
> On Fri, May 5, 2017 at 4:42 AM, Martin Gainty <[hidden email]> wrote:
>
>>
>>
>> ________________________________
>> From: Dan Tran <[hidden email]>
>> Sent: Friday, May 5, 2017 3:51 AM
>> To: Maven Users List
>> Subject: Intermittent java.lang.NoClassDefFoundError:
>> org/junit/runner/notification/RunNotifier
>>
>> Hi
>>
>> Lately, my build randomly fails with
>>
>>   java.lang.NoClassDefFoundError: org/junit/runner/notification/
>> RunNotifier
>>  at surefire
>>
>>
>> My environment consists of
>>
>>   * 200+ modules  running with --builder smart  -T 4
>>   * surefire 2.19.1 and 2.20, maven 3.3.9 and 3.5
>>   * Build runs on Sles12SP2 with OpenJDK8
>>
>> Stack Overflow has a similar issue back in 2014
>>
>> MG>assuming you are not using Hamcrest following surefire doc i assume
>> declaring junit-dep as dependency to maven-surefire-plugin will solve
>>
>>   <dependencies>
>>       <dependency>
>>         <groupId>junit</groupId>
>>         <artifactId>junit-dep</artifactId>
>>
>>          <scope>test</scope>
>>       </dependency>
>>
>> MG>http://maven.apache.org/surefire/maven-surefire-plugin/
>> examples/junit.html
>> <http://maven.apache.org/surefire/maven-surefire-plugin/
>> examples/junit.html>
>> Maven Surefire Plugin – Using JUnit<http://maven.apache.org/
>> surefire/maven-surefire-plugin/examples/junit.html>
>> maven.apache.org
>> This is the only step that is required to get started - you can now
>> create tests in your test source directory (e.g., src/test/java). Surefire
>> supports three ...
>>
>> MG>once junit added as dependency supposedly surefire test classloader
>> will now see junit classes (including org/junit/runner/notification/
>> RunNotifier)
>> MG>does this help?
>>
>>
>> Any suggestion helping to trouble shoot this issue is greatly appreciated
>>
>> Thanks
>>
>> -Dan
>>
>
>
Loading...