Skip to content

JarHell check fails for Java 9 libraries (module-info.class) #32985

Closed
@jamesdbaker

Description

@jamesdbaker

Elasticsearch version:

6.3.2, Build: default/zip/053779d/2018-07-20T05:20:23.451332Z, JVM: 9.0.4

JVM version:

java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

OS version:

Linux dendesk-0260147 4.15.0-32-generic # 35~16.04.1-Ubuntu SMP Fri Aug 10 21:54:34 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:

I'm developing a new ingest processor that uses two libraries written for Java 9. As they're written for Java 9, both have a module-info.class in the default package, but the JarHell check is detecting this and throwing an error.

java.lang.RuntimeException: found jar hell in test classpath

	at org.elasticsearch.bootstrap.BootstrapForTesting.<clinit>(BootstrapForTesting.java:95)
	at org.elasticsearch.test.ESTestCase.<clinit>(ESTestCase.java:197)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:375)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:592)
Caused by: java.lang.IllegalStateException: jar hell!
class: module-info
jar1: /home/bakerj/.m2/repository/io/annot8/components/0.1-SNAPSHOT/components-0.1-SNAPSHOT.jar
jar2: /home/bakerj/.m2/repository/io/annot8/core/0.1-SNAPSHOT/core-0.1-SNAPSHOT.jar
	at org.elasticsearch.bootstrap.JarHell.checkClass(JarHell.java:273)
	at org.elasticsearch.bootstrap.JarHell.checkJarHell(JarHell.java:190)
	at org.elasticsearch.bootstrap.JarHell.checkJarHell(JarHell.java:86)
	at org.elasticsearch.bootstrap.BootstrapForTesting.<clinit>(BootstrapForTesting.java:93)
	... 4 more

As it is expected that module-info.class is found in the same place in multiple JARs, a exemption from the check is probably needed.

This has also been flagged by other users here: https://stackoverflow.com/questions/51217252/elasticsearch-6-3-0-jarhell-module-info-class

Steps to reproduce:

  1. Clone the following project: https://github.com/jamesdbaker/es-extract
  2. Run mvn test

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions