2017-10-22 98 views
5

Jest to układ katalogów mam w moim projekcie maven:Błąd skanowania wpisu META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class z pomostem i log4j 2.9.1?

. 
├── pom.xml 
└── src 
    └── main 
     ├── java 
     │   └── biz 
     │    └── tugay 
     │     └── web 
     │      └── servlet 
     │       └── MainServlet.java 
     ├── resources 
     │   └── log4j.properties 
     └── webapp 
      └── WEB-INF 
       └── web.xml 

pom.xml części relavent następująco:

</dependencies> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>javax.servlet-api</artifactId> 
     <version>3.1.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.logging.log4j</groupId> 
     <artifactId>log4j-core</artifactId> 
     <version>${log4j.version}</version> 
     <scope>runtime</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.logging.log4j</groupId> 
     <artifactId>log4j-jcl</artifactId> 
     <version>${log4j.version}</version> 
     <scope>runtime</scope> 
    </dependency> 
</dependencies> 

<build> 
    <finalName>bare-webapp</finalName> 
    <plugins> 
     <plugin> 
      <groupId>org.eclipse.jetty</groupId> 
      <artifactId>jetty-maven-plugin</artifactId> 
      <version>9.2.1.v20140609</version> 
     </plugin> 
    </plugins> 
</build> 

<properties> 
    <maven.compiler.source>1.7</maven.compiler.source> 
    <maven.compiler.target>1.7</maven.compiler.target> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <log4j.version>2.8.2</log4j.version> 
</properties> 

I tu jest moja web.xml

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
          http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 
     version="3.1"> 
</web-app> 

i na tym właśnie wygląda log4j.properties:

# suppress inspection "UnusedProperty" for whole file 

# logger level configurations 
log4j.rootLogger=ALL, console 

# configuration for console outputs 
log4j.appender.console=org.apache.log4j.ConsoleAppender 
log4j.appender.console.layout=org.apache.log4j.PatternLayout 
log4j.appender.console.layout.conversionPattern=[%t] %-5p %c - %m%n 

więc obecnie wszystko działa poprawnie (zacznę Jetty z: mvn jetty: start) i kiedy odwiedzam "/" Widzę w konsoli:

20:38:09.433 [qtp1503674351-26] ERROR biz.tugay.web.servlet.MainServlet - Serving request! 

To wszystko jest w porządku ..

<log4j.version>2.9.1</log4j.version> 

po molo: start uzyskać:

[WARNING] Failed startup of context [email protected]{/,file:/Users/koraytugay/bare-webapp/src/main/webapp/,STARTING}{file:/Users/koraytugay/bare-webapp/src/main/webapp/} 
MultiException[java.lang.RuntimeException: Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/ProcessIdUtil.class from jar file:/Users/koraytugay/.m2/repository/org/apache/logging/log4j/log4j-api/2.9.1/log4j-api-2.9.1.jar, java.lang.RuntimeException: Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class from jar file:/Users/koraytugay/.m2/repository/org/apache/logging/log4j/log4j-api/2.9.1/log4j-api-2.9.1.jar] 
    at org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:530) 
    at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:441) 
    at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:471) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1329) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:744) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:497) 
    at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:281) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132) 
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) 
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60) 
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:154) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132) 
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) 
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132) 
    at org.eclipse.jetty.server.Server.start(Server.java:357) 
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) 
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60) 
    at org.eclipse.jetty.server.Server.doStart(Server.java:324) 
    at org.eclipse.jetty.maven.plugin.JettyServer.doStart(JettyServer.java:68) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) 
    at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:564) 
    at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:360) 
    at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute(JettyRunMojo.java:168) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47) 
java.lang.RuntimeException: Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/ProcessIdUtil.class from jar file:/Users/koraytugay/.m2/repository/org/apache/logging/log4j/log4j-api/2.9.1/log4j-api-2.9.1.jar 
    at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:913) 
    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831) 
    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:159) 
    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:542) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: java.lang.IllegalArgumentException 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:973) 
    at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:956) 
    at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:909) 
    ... 6 more 
java.lang.RuntimeException: Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class from jar file:/Users/koraytugay/.m2/repository/org/apache/logging/log4j/log4j-api/2.9.1/log4j-api-2.9.1.jar 
    at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:913) 
    at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831) 
    at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:159) 
    at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:542) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: java.lang.IllegalArgumentException 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:973) 
    at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:956) 
    at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:909) 
    ... 6 more 
[WARNING] !RequestLog 
[INFO] Started [email protected]{HTTP/1.1}{0.0.0.0:8080} 
[INFO] Started @2609ms 
[INFO] Started Jetty Server 

Jak mogę uczynić pracę jetty z log4j 2.9.1? Czy jest jakiś problem w mojej konfiguracji, czy jest to błąd w pomoście lub log4j?

Odpowiedz