Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZipException when running Mwe2Launcher in IntelliJ IDEA (caused by broken classpath) #1953

Closed
jselbach opened this issue Feb 22, 2021 · 7 comments
Assignees
Labels
Milestone

Comments

@jselbach
Copy link

When executing the Mwe2Launcher in an xText project using Maven and IntelliJ IDEA, the execution fails with a ZipException. As far as I can tell (using the debugger), this is caused by a non-JAR file (plexus-classworlds.license) being on the classpath. I have already opened an issue in the IntelliJ bugtracker for this but I think this also should be adressed in Mwe2/xText: a broken classpath entry should not (in my opinion) cause the execution to fail, a warning would suffice (including the broken file).

1    [org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main()] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - java.util.zip.ZipException: zip END header not found
org.eclipse.emf.common.util.WrappedException: java.util.zip.ZipException: zip END header not found
	at org.eclipse.xtext.mwe.PathTraverser.traverseArchive(PathTraverser.java:73)
	at org.eclipse.xtext.mwe.PathTraverser.findAllResourceUris(PathTraverser.java:50)
	at org.eclipse.xtext.mwe.PathTraverser.resolvePathes(PathTraverser.java:36)
	at org.eclipse.xtext.mwe.RuntimeResourceSetInitializer.getPathToUriMap(RuntimeResourceSetInitializer.java:55)
	at org.eclipse.xtext.mwe.RuntimeResourceSetInitializer.getInitializedResourceSet(RuntimeResourceSetInitializer.java:74)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.getConfiguredResourceSet(Mwe2Runner.java:132)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:57)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:53)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:79)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:37)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.util.zip.ZipException: zip END header not found
	at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1581)
	at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1476)
	at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1483)
	at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1288)
	at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1251)
	at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:732)
	at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:849)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:247)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:177)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:191)
	at org.eclipse.xtext.mwe.PathTraverser.traverseArchive(PathTraverser.java:58)
	... 15 more
@cdietrich
Copy link
Member

maybe there is something broken in your maven repo.
can you try with a dedicated maven repo from command line?
e.g. -Dmaven.repo.local=.m2 or debug the workflow and check which is the bad zip?

@jselbach
Copy link
Author

jselbach commented Feb 22, 2021

The "bad ZIP" is the file plexus-classworlds.license which is part of the IntelliJ installation. This is a plain text file, not a ZIP.
grafik

@cdietrich
Copy link
Member

cdietrich commented Feb 22, 2021

thus the question would be: why is this file added to pathes.
is license a file extension of yours?

@jselbach
Copy link
Author

jselbach commented Feb 22, 2021

The file is part of the IntelliJ IDEA installation, which is why I've initially opened the bug report there (link in my first post). Why the file is there and why it gets added to the classpath by IntelliJ is beyond me.

I have opened this issue to see if the problem could also be adressed in xText: I believe it is problematic that the Maven goal fails with a ZIP exception and no information which file causes the problem. This had stumped several colleages until I decided to debug the build process. So either more information (i.e. which file caused the exception to be thrown) or not failing the build at all and only issuing a warning would be great.

Also I'm sorry if this is the wrong bug tracker and it should be moved to one of the Mwe2 projects at eclipse.org. But the top stack trace entry says org.eclipse.xtext, so I figured this is the right place.

@cdietrich
Copy link
Member

PathTraverser is part of the xtext-core codebase the issue location is correct.

@cdietrich cdietrich self-assigned this Feb 22, 2021
cdietrich added a commit to eclipse/xtext-core that referenced this issue Feb 22, 2021
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
@cdietrich cdietrich added this to the Release_2.25 milestone Feb 22, 2021
cdietrich added a commit to eclipse/xtext-core that referenced this issue Feb 22, 2021
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
cdietrich added a commit to eclipse/xtext-core that referenced this issue Feb 22, 2021
[eclipse/xtext#1953] print  broken zip file when traversing archive fails
@cdietrich
Copy link
Member

logging added.

@SimonCockx
Copy link

I'm experiencing the same issue on Xtext 2.27.0. Although the logging helps with identifying the faulty file, it would be nice if PathTraverser would just ignore this file, instead of crashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants