title: Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class with jetty and log4j 2.9.1?
body: <p>This is the directory layout I have in my maven project:</p>
  
  <pre><code>.
  ├── pom.xml
  └── src
      └── main
          ├── java
          │   └── biz
          │       └── tugay
          │           └── web
          │               └── servlet
          │                   └── MainServlet.java
          ├── resources
          │   └── log4j.properties
          └── webapp
              └── WEB-INF
                  └── web.xml
  </code></pre>
  
  <p>pom.xml relavent parts as follows:</p>
  
  <pre><code>&lt;/dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
          &lt;version&gt;3.1.0&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
          &lt;version&gt;${log4j.version}&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-jcl&lt;/artifactId&gt;
          &lt;version&gt;${log4j.version}&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;finalName&gt;bare-webapp&lt;/finalName&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
              &lt;artifactId&gt;jetty-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;9.2.1.v20140609&lt;/version&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;properties&gt;
      &lt;maven.compiler.source&gt;1.7&lt;/maven.compiler.source&gt;
      &lt;maven.compiler.target&gt;1.7&lt;/maven.compiler.target&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;log4j.version&gt;2.8.2&lt;/log4j.version&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>And here is my web.xml</p>
  
  <pre><code>&lt;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"&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>and finally this is what log4j.properties look like:</p>
  
  <pre><code># 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
  </code></pre>
  
  <p>So currently everything runs fine (I start jetty with: mvn jetty:start) and when I visit "/" I see in console:</p>
  
  <pre><code>20:38:09.433 [qtp1503674351-26] ERROR biz.tugay.web.servlet.MainServlet - Serving request!
  </code></pre>
  
  <p>This is all fine..</p>
  
  <pre><code>&lt;log4j.version&gt;2.9.1&lt;/log4j.version&gt;
  </code></pre>
  
  <p>after <strong>jetty:start</strong> I get:</p>
  
  <pre><code>[WARNING] Failed startup of context o.e.j.m.p.JettyWebAppContext@fb0d6fe{/,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.&lt;init&gt;(Unknown Source)
      at org.objectweb.asm.ClassReader.&lt;init&gt;(Unknown Source)
      at org.objectweb.asm.ClassReader.&lt;init&gt;(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.&lt;init&gt;(Unknown Source)
      at org.objectweb.asm.ClassReader.&lt;init&gt;(Unknown Source)
      at org.objectweb.asm.ClassReader.&lt;init&gt;(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 ServerConnector@42c81ca{HTTP/1.1}{0.0.0.0:8080}
  [INFO] Started @2609ms
  [INFO] Started Jetty Server
  </code></pre>
  
  <p>How can I make jetty work with log4j 2.9.1? Is there a problem in my configuration or is this a bug in jetty or log4j?</p>