14

I've found a similar question here , but it points to a plugin that I'm not using (maven-failsafe-plugin), and the configuration that solution is referring to is not applicable for me.

The problem is that since I've updated my jetty plugin from

<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.9.v20160517</version>

to <version>9.4.11.v20180605</version> , it started to spam hundreds of warnings like

[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
[WARNING] org.apache.axis2.description.java2wsdl.bytecode.MethodTable 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/MethodTable.class, jar:file:///C:/Users/a0763323/.m2/repository/it/aon/WSInfocar/1.2/WSInfocar-1.2.jar!/org/apache/axis2/description/java2wsdl/bytecode/MethodTable.class
[WARNING] org.apache.axis2.description.java2wsdl.bytecode.ParamNameExtractor scanned from multiple locations: jar:file:///C:/Users/a0763323/.m2/repository/org/apache/axis2/axis2-kernel/1.4.1/axis2-kernel-1.4.1

I've searched everywhere but I can't understand neither what that means or how to resolve this.

I'm using IntelliJ and maven compiler plugin

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>

Thanks

Leviand
  • 2,745
  • 4
  • 29
  • 43
  • 1
    This could happen if you have dependencies listed that are also available in jetty. To fix this ensure those dependencies have [provided scope](https://stackoverflow.com/questions/26975818/what-is-scope-under-dependency-in-pom-xml-for). – Paul Rooney Jul 12 '20 at 11:19

4 Answers4

5

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.

Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136
  • 1
    Thanks for the reply. I think this could be close to the problem, but in my pom I don't have any explicit import of `org.apache.axis2`. Could have been imported from another library? – Leviand Sep 19 '18 at 10:19
  • And about the bundling: since axis is required for make `WSInfocar` running, why it's wrong to bundle it inside? – Leviand Sep 19 '18 at 10:22
  • The servlet spec scanning of bytecode has to scan all jars that are present for specific things (eg: implementations that are important for startup and annotations to name a few). The use of "import" is an irrelevant indicator if something is used at runtime, so much is dynamically created and executed nowadays. – Joakim Erdfelt Sep 19 '18 at 10:35
  • `WSInfocar` is not build with Maven, POM was created from `install:install-file` . Could be this the problem? – Leviand Sep 19 '18 at 10:44
1

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.

1

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.

  • 6
    This hides a fatally bad environment, one that will behave randomly, working sometimes, and crashing other times. It is a legit warning that you MUST fix to have a sane environment. Also, turning off ALL of the logging means you'll never know of other warnings. – Joakim Erdfelt Jul 04 '20 at 16:02
  • 1
    How do you set this when using the jetty:run goal of the Maven plugin? – Emmanuel Bourg Sep 17 '20 at 09:47
  • https://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin#Setting_System_Properties – Walfrat Apr 11 '22 at 09:26
1

2022 Update: the Pengwei method currently (Jetty 9) works by using this property:

java -Dorg.slf4j.simpleLogger.log.org.eclipse.jetty.annotations.AnnotationParser=ERROR ...

This can usually be injected into JVM via:

export JAVA_TOOL_OPTIONS="-Dorg.slf4j.simpleLogger.log.org.eclipse.jetty.annotations.AnnotationParser=ERROR"
run-java.sh # eg, catalina.sh

And also in Maven command line:

mvn -Dorg.slf4j...=ERROR

It is also possible to tweak Maven logging properties for all of your projects. However, that's not recommended, since, as already mentioned, these warnings might be relevant and a source of problems. In fact, as you see, I'm proposing to set at least the ERROR level, not to disable the scanner logger completely.

Edit: I understand that someone finds this answer not good or not useful. Thank you for your vote, but please, let me have your comments too, so that I can learn from your better knowledge of the issue and improve this humble piece of SO content.

zakmck
  • 2,715
  • 1
  • 37
  • 53