Maven Jetty spams warning "scanned from multiple locations"

I find this problem solution all day, and if you want ignore the WARN log in jetty, you can try this:

--exec
-Dorg.eclipse.jetty.annotations.AnnotationParser.LEVEL=OFF

append these code in start.ini jetty file, and restart jetty.


Lets break it down ...

[WARNING] org.apache.axis2.description.java2wsdl.bytecode.ClassReader scanned from multiple locations:

  • jar:file:///C:/Users/a0763323/.m2/repository/org/apache/axis2/axis2-kernel/1.4.1/axis2-kernel-1.4.1.jar!/org/apache/axis2/description/java2wsdl/bytecode/ClassReader.class,
  • jar:file:///C:/Users/a0763323/.m2/repository/it/aon/WSInfocar/1.2/WSInfocar-1.2.jar!/org/apache/axis2/description/java2wsdl/bytecode/ClassReader.class

You have the class org.apache.axis2.description.java2wsdl.bytecode.ClassReader coming from 2 different JARs (and seemingly on two different versions!)

Judging from your filesystem paths you likely have the following maven dependencies ...

<dependency>
  <groupId>org.apache.axis2</groupId>
  <artifactId>axis2-kernel</artifactId>
  <version>1.4.1</version>
</dependency>

<dependency>
  <groupId>it.aon.WSInfocar</groupId>
  <artifactId>WSInfocar</artifactId>
  <version>1.2</version>
</dependency>

It's unwise in the extreme to have two different versions of the same class on your classpath / classloader (it's very easy to have 1 version be used and then passed to a different class on the other version that will not understand it or be able to use it)

You'll need to resolve, manually, which one you should be using. You might want to ask the developers of the WSInfocar why they are bundling axis in their own artifact as well.


I found this question and reply most helpful. I had a conflict with the JDT Core and the Java Eclipse compiler. I went to Properties and clicked on Java Compiler changing one thing at a time and testing. Changing from using JRE 1.8 to JRE 11 run time resolved it for me somewhere in all the things I tested.

I have checked: Enable Project Specific Setting Use Default Compliance Settings (1.8)

This puts up a notice: When selecting 1.8 compliance be sure to have a compatible JRE installed and activated (currently 11). Configure the installed JRE or execution environment or change the build path.

Again, change one thing at a time then test. I specifically went with a 1.8 JRE because I read Java 11 does not ship a JRE. I am still not clear on that subject.

Tags:

Java

Maven

Jetty