You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Stevo Slavić <ss...@gmail.com> on 2016/02/02 14:28:17 UTC

Corrupt surefire booter?

Hello Apache Maven community,

In a Maven 3.3.3 and surefire 2.19 build I got this build failure on a CI
server:

error	02-Feb-2016 01:20:27	java.lang.NoClassDefFoundError:
org/apache/maven/surefire/report/LegacyPojoStackTraceWriter
error	02-Feb-2016 01:20:27		at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:133)
error	02-Feb-2016 01:20:27	Caused by:
java.lang.ClassNotFoundException:
org.apache.maven.surefire.report.LegacyPojoStackTraceWriter
error	02-Feb-2016 01:20:27		at
java.net.URLClassLoader$1.run(URLClassLoader.java:370)
error	02-Feb-2016 01:20:27		at
java.net.URLClassLoader$1.run(URLClassLoader.java:362)
error	02-Feb-2016 01:20:27		at
java.security.AccessController.doPrivileged(Native Method)
error	02-Feb-2016 01:20:27		at
java.net.URLClassLoader.findClass(URLClassLoader.java:361)
error	02-Feb-2016 01:20:27		at
java.lang.ClassLoader.loadClass(ClassLoader.java:424)
error	02-Feb-2016 01:20:27		at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
error	02-Feb-2016 01:20:27		at
java.lang.ClassLoader.loadClass(ClassLoader.java:357)
error	02-Feb-2016 01:20:27		... 1 more
error	02-Feb-2016 01:20:27	Caused by: java.util.zip.ZipException:
error reading zip file
error	02-Feb-2016 01:20:27		at java.util.zip.ZipFile.read(Native Method)
error	02-Feb-2016 01:20:27		at
java.util.zip.ZipFile.access$1400(ZipFile.java:61)
error	02-Feb-2016 01:20:27		at
java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:717)
error	02-Feb-2016 01:20:27		at
java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:420)
error	02-Feb-2016 01:20:27		at
java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
error	02-Feb-2016 01:20:27		at sun.misc.Resource.getBytes(Resource.java:124)
error	02-Feb-2016 01:20:27		at
java.net.URLClassLoader.defineClass(URLClassLoader.java:462)
error	02-Feb-2016 01:20:27		at
java.net.URLClassLoader.access$100(URLClassLoader.java:73)
error	02-Feb-2016 01:20:27		at
java.net.URLClassLoader$1.run(URLClassLoader.java:368)
error	02-Feb-2016 01:20:27		... 7 more
error	02-Feb-2016 01:20:27	Exception in thread "main"
java.lang.NoClassDefFoundError:
org/apache/maven/surefire/booter/ForkedBooter$5
error	02-Feb-2016 01:20:27		at
org.apache.maven.surefire.booter.ForkedBooter.exit(ForkedBooter.java:217)
error	02-Feb-2016 01:20:27		at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:150)
error	02-Feb-2016 01:20:27	Caused by:
java.lang.ClassNotFoundException:
org.apache.maven.surefire.booter.ForkedBooter$5
error	02-Feb-2016 01:20:27		at
java.net.URLClassLoader$1.run(URLClassLoader.java:370)
error	02-Feb-2016 01:20:27		at
java.net.URLClassLoader$1.run(URLClassLoader.java:362)
error	02-Feb-2016 01:20:27		at
java.security.AccessController.doPrivileged(Native Method)
error	02-Feb-2016 01:20:27		at
java.net.URLClassLoader.findClass(URLClassLoader.java:361)
error	02-Feb-2016 01:20:27		at
java.lang.ClassLoader.loadClass(ClassLoader.java:424)
error	02-Feb-2016 01:20:27		at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
error	02-Feb-2016 01:20:27		at
java.lang.ClassLoader.loadClass(ClassLoader.java:357)
error	02-Feb-2016 01:20:27		... 2 more
error	02-Feb-2016 01:20:27	Caused by: java.util.zip.ZipException:
error reading zip file
error	02-Feb-2016 01:20:27		at java.util.zip.ZipFile.read(Native Method)
error	02-Feb-2016 01:20:27		at
java.util.zip.ZipFile.access$1400(ZipFile.java:61)
error	02-Feb-2016 01:20:27		at
java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:717)
error	02-Feb-2016 01:20:27		at
java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:420)
error	02-Feb-2016 01:20:27		at
java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
error	02-Feb-2016 01:20:27		at sun.misc.Resource.getBytes(Resource.java:124)
error	02-Feb-2016 01:20:27		at
java.net.URLClassLoader.defineClass(URLClassLoader.java:462)
error	02-Feb-2016 01:20:27		at
java.net.URLClassLoader.access$100(URLClassLoader.java:73)
error	02-Feb-2016 01:20:27		at
java.net.URLClassLoader$1.run(URLClassLoader.java:368)
error	02-Feb-2016 01:20:27		... 8 more


Few other builds before and after broken one use clean workspace and so far
didn't have this issue yet. I'd like to understand what could be root cause
of the issue and if it is likely to occur in future, and how to fix/prevent
it.

So, what could cause this issue? I checked local repo on agent that ran the
failed build, at least now, surefire-booter-2.19 jar itself is not corrupt
there. If I understood well
https://maven.apache.org/surefire/maven-surefire-plugin/examples/class-loading.html
build execution specific surefire booter jar gets constructed - could it be
that the generated jar was corrupt and if so what could be the cause?

As immediate measure I will upgrade to latest Maven and Surefire version.
Still, would like to understand the failure. Thanks for any help in advance!

Kind regards,
Stevo Slavic.

Re: Corrupt surefire booter?

Posted by Stefan Seidel <ss...@vub.de>.
Hi,

Caused by: java.util.zip.ZipException: error reading zip file

this is most likely because of a corrupt filesystem, or (more common) because 
another process updated the jar file at the same time. So for example, if you 
have two maven processes starting at the same time, and deciding it is time to 
re-download the jar, this can happen if they access the same .m2/repository.


Stefan

-------------------------------------
On Tuesday 02 February 2016 14:28:17 Stefan Seidel wrote:
> Hello Apache Maven community,
> 
> In a Maven 3.3.3 and surefire 2.19 build I got this build failure on a CI
> server:
> 
> error	02-Feb-2016 01:20:27	java.lang.NoClassDefFoundError:
> org/apache/maven/surefire/report/LegacyPojoStackTraceWriter
> error	02-Feb-2016 01:20:27		at
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:133)
> error	02-Feb-2016 01:20:27	Caused by:
> java.lang.ClassNotFoundException:
> org.apache.maven.surefire.report.LegacyPojoStackTraceWriter
> error	02-Feb-2016 01:20:27		at
> java.net.URLClassLoader$1.run(URLClassLoader.java:370)
> error	02-Feb-2016 01:20:27		at
> java.net.URLClassLoader$1.run(URLClassLoader.java:362)
> error	02-Feb-2016 01:20:27		at
> java.security.AccessController.doPrivileged(Native Method)
> error	02-Feb-2016 01:20:27		at
> java.net.URLClassLoader.findClass(URLClassLoader.java:361)
> error	02-Feb-2016 01:20:27		at
> java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> error	02-Feb-2016 01:20:27		at
> sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
> error	02-Feb-2016 01:20:27		at
> java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> error	02-Feb-2016 01:20:27		... 1 more
> error	02-Feb-2016 01:20:27	Caused by: java.util.zip.ZipException:
> error reading zip file
> error	02-Feb-2016 01:20:27		at java.util.zip.ZipFile.read(Native Method)
> error	02-Feb-2016 01:20:27		at
> java.util.zip.ZipFile.access$1400(ZipFile.java:61)
> error	02-Feb-2016 01:20:27		at
> java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:717)
> error	02-Feb-2016 01:20:27		at
> java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:420)
> error	02-Feb-2016 01:20:27		at
> java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
> error	02-Feb-2016 01:20:27		at 
sun.misc.Resource.getBytes(Resource.java:124)
> error	02-Feb-2016 01:20:27		at
> java.net.URLClassLoader.defineClass(URLClassLoader.java:462)
> error	02-Feb-2016 01:20:27		at
> java.net.URLClassLoader.access$100(URLClassLoader.java:73)
> error	02-Feb-2016 01:20:27		at
> java.net.URLClassLoader$1.run(URLClassLoader.java:368)
> error	02-Feb-2016 01:20:27		... 7 more
> error	02-Feb-2016 01:20:27	Exception in thread "main"
> java.lang.NoClassDefFoundError:
> org/apache/maven/surefire/booter/ForkedBooter$5
> error	02-Feb-2016 01:20:27		at
> org.apache.maven.surefire.booter.ForkedBooter.exit(ForkedBooter.java:217)
> error	02-Feb-2016 01:20:27		at
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:150)
> error	02-Feb-2016 01:20:27	Caused by:
> java.lang.ClassNotFoundException:
> org.apache.maven.surefire.booter.ForkedBooter$5
> error	02-Feb-2016 01:20:27		at
> java.net.URLClassLoader$1.run(URLClassLoader.java:370)
> error	02-Feb-2016 01:20:27		at
> java.net.URLClassLoader$1.run(URLClassLoader.java:362)
> error	02-Feb-2016 01:20:27		at
> java.security.AccessController.doPrivileged(Native Method)
> error	02-Feb-2016 01:20:27		at
> java.net.URLClassLoader.findClass(URLClassLoader.java:361)
> error	02-Feb-2016 01:20:27		at
> java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> error	02-Feb-2016 01:20:27		at
> sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
> error	02-Feb-2016 01:20:27		at
> java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> error	02-Feb-2016 01:20:27		... 2 more
> error	02-Feb-2016 01:20:27	Caused by: java.util.zip.ZipException:
> error reading zip file
> error	02-Feb-2016 01:20:27		at java.util.zip.ZipFile.read(Native Method)
> error	02-Feb-2016 01:20:27		at
> java.util.zip.ZipFile.access$1400(ZipFile.java:61)
> error	02-Feb-2016 01:20:27		at
> java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:717)
> error	02-Feb-2016 01:20:27		at
> java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:420)
> error	02-Feb-2016 01:20:27		at
> java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
> error	02-Feb-2016 01:20:27		at 
sun.misc.Resource.getBytes(Resource.java:124)
> error	02-Feb-2016 01:20:27		at
> java.net.URLClassLoader.defineClass(URLClassLoader.java:462)
> error	02-Feb-2016 01:20:27		at
> java.net.URLClassLoader.access$100(URLClassLoader.java:73)
> error	02-Feb-2016 01:20:27		at
> java.net.URLClassLoader$1.run(URLClassLoader.java:368)
> error	02-Feb-2016 01:20:27		... 8 more
> 
> 
> Few other builds before and after broken one use clean workspace and so far
> didn't have this issue yet. I'd like to understand what could be root cause
> of the issue and if it is likely to occur in future, and how to fix/prevent
> it.
> 
> So, what could cause this issue? I checked local repo on agent that ran the
> failed build, at least now, surefire-booter-2.19 jar itself is not corrupt
> there. If I understood well
> https://maven.apache.org/surefire/maven-surefire-plugin/examples/class-loadi
> ng.html build execution specific surefire booter jar gets constructed -
> could it be that the generated jar was corrupt and if so what could be the
> cause?
> 
> As immediate measure I will upgrade to latest Maven and Surefire version.
> Still, would like to understand the failure. Thanks for any help in advance!
> 
> Kind regards,
> Stevo Slavic.