[NEUTRON-205] Classpath duplicates detected: javax/inject/Inject.class Created: 09/Nov/18  Updated: 09/Nov/18  Resolved: 09/Nov/18

Status: Resolved
Project: neutron
Component/s: None
Affects Version/s: Neon
Fix Version/s: Neon

Type: Bug Priority: Medium
Reporter: Michael Vorburger Assignee: Michael Vorburger
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to INFRAUTILS-52 jHades doesn’t support JDK 9+ Resolved

 Description   

The Neutron build fails in integration-test-standalone due to junit.framework.AssertionFailedError: Classpath duplicates detected: javax/inject/Inject.class.

This is from the (infrautils) ClasspathHellDuplicatesCheckRule used in the NeutronE2ETest.

Fixing this properly is important in light of https://github.com/vorburger/opendaylight-simple/ where a clean "flat" classpath is even more critical tomorrow than it is today in standalone tests.



 Comments   
Comment by Michael Vorburger [ 09/Nov/18 ]

skitt fixed (worked around) this with https://git.opendaylight.org/gerrit/#/c/77327/1/integration/test-standalone/pom.xml but then it regressed again .. I suspect that was probably https://git.opendaylight.org/gerrit/#/c/76625/ for INFRAUTILS-52 - which is now doing classpath duplicate analysis a little differently, but better, than before. Because it's right to point out that this isn't clean:

junit.framework.AssertionFailedError: Classpath duplicates detected: javax/inject/Inject.class
    jar:file:/home/vorburger/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar!/javax/inject/Inject.class
    jar:file:/home/vorburger/.m2/repository/org/glassfish/hk2/external/javax.inject/2.5.0-b32/javax.inject-2.5.0-b32.jar!/javax/inject/Inject.class

We could add more exclusions in the POM of integration-test-standalone, but let's try to fix this up at source...

Comment by Michael Vorburger [ 09/Nov/18 ]

https://git.opendaylight.org/gerrit/#/c/77654/ fixes this problem (locally tested).

https://git.opendaylight.org/gerrit/#/c/77655/ adds non-regression testing for this problem.

Comment by Michael Vorburger [ 09/Nov/18 ]

https://git.opendaylight.org/gerrit/#/c/77654/ fails in aaa-distribution-check-neon due to:

missing requirement [org.glassfish.jersey.containers.jersey-container-servlet-core/2.25.1] osgi.wiring.package; filter:="(&(osgi.wiring.package=javax.inject)(version>=1.0.0)(!(version>=2.0.0)))"

I think that's probably because the OSGi bundle org.glassfish.jersey.containers.jersey-container-servlet-core (2.25.1) has a non-optional Package-Import for javax.inject, but we made javax.inject:javax.inject <optional>true in odlparent, and somewhere excluded it? (But we do include org.glassfish.hk2.external:javax.inject, so that whole optional and exclusion is really a bit useless after all.)

This isn't really worth my time to dig more into and somehow fix more properly... let's just add javax.inject to ClasspathHellDuplicatesCheckRule's ignore white list; so proposed in https://git.opendaylight.org/gerrit/#/c/77658/ now.

I suspect the previous JHades instead of ClassGraph based implementation probably ignored it because it had the same size (note boolean excludeSameSizeDups = true); if we have a lot more problems like this, we would have to re-emulate that size checking behaviour in the ClasspathHellDuplicatesChecker...

Generated at Wed Feb 07 20:25:50 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.