girtel / Net2Plan

Net2Plan is a free and open-source Java tool devoted to the planning, optimization and evaluation of communication networks. It has been originally thought as a tool to assist the teaching of communication networks courses. Eventually it has converted into a powerful network optimization and planning tool for the academia and industry, together with a growing repository of network planning resources.
BSD 2-Clause "Simplified" License
85 stars 38 forks source link

“NoSuchMethodErrors” due to multiple versions of org.codehaus.woodstox:stax2-api:jar #252

Closed Bing-ok closed 2 years ago

Bing-ok commented 4 years ago

Issue description

Hi, there are multiple versions of org.codehaus.woodstox:stax2-api in Net2Plan\Net2Plan-Core. As shown in the following dependency tree, according to Maven's “nearest wins” strategy, only org.codehaus.woodstox:stax2-api:4.0.0 can be loaded, and org.codehaus.woodstox:stax2-api:3.1.4 will be shadowed.

However, one method defined in shadowed version org.codehaus.woodstox:stax2-api:3.1.4 is referenced by client project via com.fasterxml.woodstox:woodstox-core:5.0.1, but missing in the actually loaded version org.codehaus.woodstox:stax2-api:4.0.0.

For instance, the following missing method(defined in org.codehaus.woodstox:stax2-api:3.1.4) is actually referenced by Net2Plan\Net2Plan-Core, which will introduce a runtime error(i.e., "NoSuchMethodErrors") into Net2Plan\Net2Plan-Core. Missing method: org.codehaus.stax2.ri.EmptyIterator: org.codehaus.stax2.ri.EmptyIterator getInstance() is invoked by Net2Plan\Net2Plan-Core via the following path:


paths------
<com.net2plan.utils.Triple: boolean equals(java.lang.Object)> Net2Plan\Net2Plan-Core\target\classes
<org.codehaus.stax2.ri.evt.StartElementEventImpl: boolean equals(java.lang.Object)> Repositories\org\codehaus\woodstox\stax2-api\4.0.0\stax2-api-4.0.0.jar
<com.ctc.wstx.evt.SimpleStartElement: java.util.Iterator getAttributes()> Repositories\com\fasterxml\woodstox\woodstox-core\5.0.1\woodstox-core-5.0.1.jar
<com.ctc.wstx.util.DataUtil: java.util.Iterator emptyIterator()> Repositories\com\fasterxml\woodstox\woodstox-core\5.0.1\woodstox-core-5.0.1.jar
<org.codehaus.stax2.ri.EmptyIterator: org.codehaus.stax2.ri.EmptyIterator getInstance()>

Suggested fixing solutions

  1. Upgrade dependency com.fasterxml.woodstox:woodstox-core from 5.0.1 to 5.0.2. Because the newer version com.fasterxml.woodstox:woodstox-core:5.0.2 does not invoke the above missing method, such upgrading can solve the problem.
  2. Change dependency org.codehaus.woodstox:stax2-api from 4.0.0 to 3.1.4. As such the above missing method will not be referenced by Net2Plan\Net2Plan-Core .

Please let me know which solution do you prefer? I can submit a PR to fix it.

Thank you very much for your attention. Best regards,

Dependency tree----


[INFO] com.net2plan:net2plan-core:jar:0.6.6.0
[INFO] +- org.jfree:jfreechart:jar:1.5.0:compile
[INFO] +- commons-cli:commons-cli:jar:1.3:compile
[INFO] +- commons-io:commons-io:jar:2.5:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] +- org.apache.commons:commons-csv:jar:1.4:compile
[INFO] +- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.apache.commons:commons-math3:jar:3.5:compile
[INFO] +- com.google.guava:guava:jar:21.0:compile
[INFO] +- com.healthmarketscience.jackcess:jackcess:jar:2.1.3:compile
[INFO] |  +- (commons-lang:commons-lang:jar:2.6:compile - omitted for duplicate)
[INFO] |  \- (commons-logging:commons-logging:jar:1.1.3:compile - omitted for conflict with 1.2)
[INFO] +- org.jgrapht:jgrapht-core:jar:1.3.1:compile
[INFO] |  \- org.jheaps:jheaps:jar:0.10:compile
[INFO] +- net.java.dev.jna:jna:jar:4.1.0:compile
[INFO] +- org.jsoup:jsoup:jar:1.8.3:compile
[INFO] +- net.sf.jung:jung-3d:jar:2.0:compile
[INFO] |  +- java3d:vecmath:jar:1.3.1:compile
[INFO] |  +- java3d:j3d-core:jar:1.3.1:compile
[INFO] |  |  \- (java3d:vecmath:jar:1.3.1:compile - omitted for duplicate)
[INFO] |  +- net.sourceforge.collections:collections-generic:jar:4.01:compile
[INFO] |  +- (net.sf.jung:jung-api:jar:2.0:compile - omitted for conflict with 2.0.1)
[INFO] |  +- (net.sf.jung:jung-algorithms:jar:2.0:compile - omitted for conflict with 2.0.1)
[INFO] |  \- (net.sf.jung:jung-visualization:jar:2.0:compile - omitted for conflict with 2.0.1)
[INFO] +- net.sf.jung:jung-algorithms:jar:2.0.1:compile
[INFO] |  +- (net.sf.jung:jung-api:jar:2.0.1:compile - omitted for conflict with 2.0)
[INFO] |  +- (net.sourceforge.collections:collections-generic:jar:4.01:compile - omitted for duplicate)
[INFO] |  \- colt:colt:jar:1.2.0:compile
[INFO] |     \- concurrent:concurrent:jar:1.3.4:compile
[INFO] +- net.sf.jung:jung-api:jar:2.0.1:compile
[INFO] |  \- (net.sourceforge.collections:collections-generic:jar:4.01:compile - omitted for duplicate)
[INFO] +- net.sf.jung:jung-graph-impl:jar:2.0.1:compile
[INFO] |  +- (net.sf.jung:jung-api:jar:2.0.1:compile - omitted for duplicate)
[INFO] |  \- (net.sourceforge.collections:collections-generic:jar:4.01:compile - omitted for duplicate)
[INFO] +- net.sf.jung:jung-io:jar:2.1:compile
[INFO] |  +- (net.sf.jung:jung-api:jar:2.1:compile - omitted for conflict with 2.0.1)
[INFO] |  \- (net.sf.jung:jung-algorithms:jar:2.1:compile - omitted for conflict with 2.0.1)
[INFO] +- net.sf.jung:jung-visualization:jar:2.0.1:compile
[INFO] |  +- (net.sf.jung:jung-api:jar:2.0.1:compile - omitted for duplicate)
[INFO] |  \- (net.sf.jung:jung-algorithms:jar:2.0.1:compile - omitted for duplicate)
[INFO] +- com.miglayout:miglayout-core:jar:5.0:compile
[INFO] +- com.miglayout:miglayout-swing:jar:5.0:compile
[INFO] |  \- (com.miglayout:miglayout-core:jar:5.0:compile - omitted for duplicate)
[INFO] +- com.github.rwl:parallelcolt:jar:parallelcolt-0.11.4:compile
[INFO] |  +- net.sourceforge.jplasma:jplasma:jar:1.2.0:compile
[INFO] |  |  +- net.sourceforge.jplasma:core-lapack:jar:0.1:compile
[INFO] |  |  \- net.sourceforge.f2j:arpack_combined_all:jar:0.1:compile
[INFO] |  +- com.github.wendykierp:JTransforms:jar:3.1:compile
[INFO] |  |  +- (org.apache.commons:commons-math3:jar:3.5:compile - omitted for duplicate)
[INFO] |  |  \- pl.edu.icm:JLargeArrays:jar:1.5:compile
[INFO] |  |     \- (org.apache.commons:commons-math3:jar:3.5:compile - omitted for duplicate)
[INFO] |  +- net.sourceforge.csparsej:csparsej:jar:1.1.1:compile
[INFO] |  +- net.sourceforge.parallelcolt:optimization:jar:1.0:compile
[INFO] |  +- com.googlecode.netlib-java:netlib-java:jar:0.9.3:compile
[INFO] |  |  \- (net.sourceforge.f2j:arpack_combined_all:jar:0.1:compile - omitted for duplicate)
[INFO] |  \- com.github.rwl:JKLU:jar:1.0.0:compile
[INFO] |     +- com.github.rwl:BTFJ:jar:1.0.1:compile
[INFO] |     +- com.github.rwl:AMDJ:jar:1.0.1:compile
[INFO] |     \- com.github.rwl:COLAMDJ:jar:1.0.1:compile
[INFO] +- org.codehaus.woodstox:stax2-api:jar:4.0.0:compile
[INFO] +- com.fasterxml.woodstox:woodstox-core:jar:5.0.1:compile
[INFO] |  \- (org.codehaus.woodstox:stax2-api:jar:3.1.4:compile - omitted for conflict with 4.0.0)
[INFO] +- org.jxmapviewer:jxmapviewer2:jar:2.2:compile
[INFO] |  \- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.2)
[INFO] +- org.reflections:reflections:jar:0.9.11:compile
[INFO] |  +- (com.google.guava:guava:jar:20.0:compile - omitted for conflict with 21.0)
[INFO] |  \- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] +- com.github.girtel:JOM:jar:0.4.0:compile
[INFO] |  +- (net.java.dev.jna:jna:jar:4.1.0:compile - omitted for duplicate)
[INFO] |  +- net.sourceforge.parallelcolt:parallelcolt:jar:0.10.1:compile
[INFO] |  |  +- (net.sourceforge.jplasma:jplasma:jar:1.2.0:compile - omitted for duplicate)
[INFO] |  |  +- net.sourceforge.jtransforms:jtransforms:jar:2.4.0:compile
[INFO] |  |  |  \- (junit:junit:jar:4.8.2:compile - omitted for conflict with 4.12)
[INFO] |  |  +- (net.sourceforge.csparsej:csparsej:jar:1.1.1:compile - omitted for duplicate)
[INFO] |  |  +- (net.sourceforge.parallelcolt:optimization:jar:1.0:compile - omitted for duplicate)
[INFO] |  |  +- (com.googlecode.netlib-java:netlib-java:jar:0.9.3:compile - omitted for duplicate)
[INFO] |  |  \- (com.github.rwl:JKLU:jar:1.0.0:compile - omitted for duplicate)
[INFO] |  \- (commons-lang:commons-lang:jar:2.6:compile - omitted for duplicate)
[INFO] +- org.apache.poi:poi:jar:3.15:compile
[INFO] |  +- commons-codec:commons-codec:jar:1.10:compile
[INFO] |  \- org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] +- org.apache.poi:poi-ooxml:jar:3.15:compile
[INFO] |  +- (org.apache.poi:poi:jar:3.15:compile - omitted for duplicate)
[INFO] |  +- org.apache.poi:poi-ooxml-schemas:jar:3.15:compile
[INFO] |  |  \- org.apache.xmlbeans:xmlbeans:jar:2.6.0:compile
[INFO] |  |     \- stax:stax-api:jar:1.0.1:compile
[INFO] |  \- com.github.virtuald:curvesapi:jar:1.04:compile
[INFO] +- junit:junit:jar:4.12:test (scope not updated to compile)
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.mockito:mockito-core:jar:2.7.22:test
[INFO] |  +- net.bytebuddy:byte-buddy:jar:1.6.11:test
[INFO] |  +- net.bytebuddy:byte-buddy-agent:jar:1.6.11:test
[INFO] |  \- org.objenesis:objenesis:jar:2.5:test
[INFO] +- pl.pragmatists:JUnitParams:jar:1.1.0:test
[INFO] |  \- (junit:junit:jar:4.12:test - omitted for duplicate)
[INFO] +- org.assertj:assertj-core:jar:3.7.0:test
[INFO] +- org.assertj:assertj-swing-junit:jar:3.5.0:test
[INFO] |  +- (junit:junit:jar:4.12:test - omitted for duplicate)
[INFO] |  +- org.assertj:assertj-swing:jar:3.5.0:test
[INFO] |  |  +- (org.assertj:assertj-core:jar:3.5.2:test - omitted for conflict with 3.7.0)
[INFO] |  |  \- org.easytesting:fest-util:jar:1.2.5:test
[INFO] |  \- org.easytesting:fest-reflect:jar:1.4.1:test
[INFO] \- com.sun:tools:jar:1.8:system
Bing-ok commented 4 years ago

Could you help me review this issue? 👍 Thanks! @ppavon

ppavon commented 2 years ago

Done! (will be solved in future version upgrading to 5.0.2