如何解决Jetty警告 - 多个位置上的相同java类?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (618)

我正在使用Jetty 9.4.12 servlet容器运行Shibboleth IDP,不知怎的Jetty警告我:

07:55:31.629 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.Json scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/Json.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/Json.class
07:55:31.634 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonArray scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonArray.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonArray.class
07:55:31.634 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonArrayBuilder scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonArrayBuilder.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonArrayBuilder.class
07:55:31.634 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonBuilderFactory scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonBuilderFactory.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonBuilderFactory.class
07:55:31.634 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonException scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonException.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonException.class
07:55:31.635 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonNumber scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonNumber.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonNumber.class
07:55:31.635 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonObject scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonObject.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonObject.class
07:55:31.635 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonObjectBuilder scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonObjectBuilder.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonObjectBuilder.class
07:55:31.635 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonReader scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonReader.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonReader.class
07:55:31.637 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonReaderFactory scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonReaderFactory.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonReaderFactory.class
07:55:31.637 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonString scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonString.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonString.class
07:55:31.637 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonStructure scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonStructure.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonStructure.class
07:55:31.637 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonValue$1 scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonValue$1.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonValue$1.class
07:55:31.638 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonValue$2 scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonValue$2.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonValue$2.class
07:55:31.638 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonValue$3 scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonValue$3.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonValue$3.class
07:55:31.639 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonValue$ValueType scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonValue$ValueType.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonValue$ValueType.class
07:55:31.640 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonValue scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonValue.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonValue.class
07:55:31.640 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonWriter scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonWriter.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonWriter.class
07:55:31.640 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.JsonWriterFactory scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/JsonWriterFactory.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/JsonWriterFactory.class
07:55:31.641 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.spi.JsonProvider scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/spi/JsonProvider.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/spi/JsonProvider.class
07:55:31.641 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.stream.JsonGenerationException scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/stream/JsonGenerationException.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/stream/JsonGenerationException.class
07:55:31.641 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.stream.JsonGenerator scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/stream/JsonGenerator.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/stream/JsonGenerator.class
07:55:31.641 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.stream.JsonGeneratorFactory scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/stream/JsonGeneratorFactory.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/stream/JsonGeneratorFactory.class
07:55:31.642 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.stream.JsonLocation scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/stream/JsonLocation.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/stream/JsonLocation.class
07:55:31.642 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.stream.JsonParser$Event scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/stream/JsonParser$Event.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/stream/JsonParser$Event.class
07:55:31.642 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.stream.JsonParser scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/stream/JsonParser.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/stream/JsonParser.class
07:55:31.642 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.stream.JsonParserFactory scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/stream/JsonParserFactory.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/stream/JsonParserFactory.class
07:55:31.643 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] - javax.json.stream.JsonParsingException scanned from multiple locations: jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-1.0.4.jar!/javax/json/stream/JsonParsingException.class, jar:file:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json-api-1.0.jar!/javax/json/stream/JsonParsingException.class

似乎这些类在javax.json-1.0.4.jar和javax.json-api-1.0.jar中使用。知道Jetty为什么要警告这些吗?

提问于
用户回答回答于
  • 07:55:31.635 - WARN [org.eclipse.jetty.annotations.AnnotationParser:569] -
    • 从多个位置扫描的javax.json.JsonNumber:
    • 罐子:文件:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json -1.0.4.jar!/javax/json/JsonNumber.class,
    • 罐子:文件:///opt/ps/jetty/jetty-base/tmp/jetty-0.0.0.0-8080-idp.war-_idp-any-8184658660181054677.dir/webinf/WEB-INF/lib/javax.json -API-1.0.jar!/javax/json/JsonNumber.class

这是在字节码扫描期间为webapp启动的注释产生的警告。

同一类的多个版本的存在是错误和不良行为的来源。

在你的情况下,您有两个版本的相同类,版本1.01.0.4JAR文件名。

由于ClassLoader没有JAR文件加载顺序期望和要求,因此在不同时间执行相同的WAR可能会导致不同的行为。Jetty无法确定重复课程的严重程度,由您自行决定。Jetty只能针对webapps中的常见行为问题生成此警告。要解决此问题,需要更正生成的WAR文件,使其仅包含每个类的1个副本。

扫码关注云+社区

领取腾讯云代金券