Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5842

java.lang.NoClassDefFoundError: org/slf4j/helpers/MessageFormatter with jetty plugin

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 3.3.1, 3.3.3
    • Fix Version/s: None
    • Component/s: Class Loading
    • Labels:
      None

      Description

      When Maven is used with a different SLF4J implementation than slf4j-simple (in my case logback to have colored logs), running jetty-maven-plugin fails.

      Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00)
      Maven home: /usr/local/Cellar/maven/3.3.3/libexec
      Java version: 1.8.0_40, vendor: Oracle Corporation
      Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre
      Default locale: fr_FR, platform encoding: UTF-8
      OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac"
      
      [WARNING] FAILED org.mortbay.jetty.plugin.JettyServer@66c4005: java.lang.NoClassDefFoundError: org/slf4j/helpers/MessageFormatter
      java.lang.ClassNotFoundException: org.slf4j.helpers.MessageFormatter
      	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) ~[plexus-classworlds-2.5.2.jar:na]
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271) ~[plexus-classworlds-2.5.2.jar:na]
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247) ~[plexus-classworlds-2.5.2.jar:na]
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239) ~[plexus-classworlds-2.5.2.jar:na]
      	... 21 common frames omitted
      Wrapped by: java.lang.NoClassDefFoundError: org/slf4j/helpers/MessageFormatter
      	at org.eclipse.jetty.util.log.JettyAwareLogger.log(JettyAwareLogger.java:619) ~[jetty-util-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.eclipse.jetty.util.log.JettyAwareLogger.info(JettyAwareLogger.java:314) ~[jetty-util-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.eclipse.jetty.util.log.Slf4jLog.info(Slf4jLog.java:74) ~[jetty-util-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.eclipse.jetty.server.Server.doStart(Server.java:271) ~[jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65) ~[jetty-maven-plugin-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) ~[jetty-util-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:520) [jetty-maven-plugin-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:365) [jetty-maven-plugin-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:521) [jetty-maven-plugin-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) [maven-core-3.3.1.jar:3.3.1]
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) [maven-core-3.3.1.jar:3.3.1]
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) [maven-core-3.3.1.jar:3.3.1]
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) [maven-core-3.3.1.jar:3.3.1]
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) [maven-core-3.3.1.jar:3.3.1]
      	at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject(SmartBuilderImpl.java:275) [takari-smart-builder-0.4.0.jar:0.4.0]
      	at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run(SmartBuilderImpl.java:101) [takari-smart-builder-0.4.0.jar:0.4.0]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_40]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_40]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_40]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_40]
      	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
      java.lang.NoClassDefFoundError: org/slf4j/helpers/MessageFormatter
      	at org.eclipse.jetty.util.log.JettyAwareLogger.log(JettyAwareLogger.java:619) ~[jetty-util-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.eclipse.jetty.util.log.JettyAwareLogger.info(JettyAwareLogger.java:314) ~[jetty-util-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.eclipse.jetty.util.log.Slf4jLog.info(Slf4jLog.java:74) ~[jetty-util-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.eclipse.jetty.server.Server.doStart(Server.java:271) ~[jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65) ~[jetty-maven-plugin-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) ~[jetty-util-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:520) [jetty-maven-plugin-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:365) [jetty-maven-plugin-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:521) [jetty-maven-plugin-7.6.16.v20140903.jar:7.6.16.v20140903]
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) [maven-core-3.3.1.jar:3.3.1]
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) [maven-core-3.3.1.jar:3.3.1]
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) [maven-core-3.3.1.jar:3.3.1]
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) [maven-core-3.3.1.jar:3.3.1]
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) [maven-core-3.3.1.jar:3.3.1]
      	at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject(SmartBuilderImpl.java:275) [takari-smart-builder-0.4.0.jar:0.4.0]
      	at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run(SmartBuilderImpl.java:101) [takari-smart-builder-0.4.0.jar:0.4.0]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_40]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_40]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_40]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_40]
      	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
      Caused by: java.lang.ClassNotFoundException: org.slf4j.helpers.MessageFormatter
      	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) ~[plexus-classworlds-2.5.2.jar:na]
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271) ~[plexus-classworlds-2.5.2.jar:na]
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247) ~[plexus-classworlds-2.5.2.jar:na]
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239) ~[plexus-classworlds-2.5.2.jar:na]
      	... 21 common frames omitted
      [INFO] Jetty server exiting.
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 1.001 s (Wall Clock)
      [INFO] Finished at: 2015-06-15T13:05:18+02:00
      [INFO] Final Memory: 17M/206M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.mortbay.jetty:jetty-maven-plugin:7.6.16.v20140903:run (default-cli) on project example-webapp: Execution default-cli of goal org.mortbay.jetty:jetty-maven-plugin:7.6.16.v20140903:run failed: A required class was missing while executing org.mortbay.jetty:jetty-maven-plugin:7.6.16.v20140903:run: org/slf4j/helpers/MessageFormatter
      [ERROR] -----------------------------------------------------
      [ERROR] realm =    plugin>org.mortbay.jetty:jetty-maven-plugin:7.6.16.v20140903
      [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
      [ERROR] urls[0] = file:/Users/jcgay/.m2/repository/org/mortbay/jetty/jetty-maven-plugin/7.6.16.v20140903/jetty-maven-plugin-7.6.16.v20140903.jar
      [ERROR] urls[1] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-util/7.6.16.v20140903/jetty-util-7.6.16.v20140903.jar
      [ERROR] urls[2] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-webapp/7.6.16.v20140903/jetty-webapp-7.6.16.v20140903.jar
      [ERROR] urls[3] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-xml/7.6.16.v20140903/jetty-xml-7.6.16.v20140903.jar
      [ERROR] urls[4] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-servlet/7.6.16.v20140903/jetty-servlet-7.6.16.v20140903.jar
      [ERROR] urls[5] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-security/7.6.16.v20140903/jetty-security-7.6.16.v20140903.jar
      [ERROR] urls[6] = file:/Users/jcgay/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.1.1/sisu-inject-bean-2.1.1.jar
      [ERROR] urls[7] = file:/Users/jcgay/.m2/repository/org/sonatype/sisu/sisu-guice/2.9.4/sisu-guice-2.9.4-no_aop.jar
      [ERROR] urls[8] = file:/Users/jcgay/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.jar
      [ERROR] urls[9] = file:/Users/jcgay/.m2/repository/org/sonatype/aether/aether-util/1.11/aether-util-1.11.jar
      [ERROR] urls[10] = file:/Users/jcgay/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
      [ERROR] urls[11] = file:/Users/jcgay/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
      [ERROR] urls[12] = file:/Users/jcgay/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
      [ERROR] urls[13] = file:/Users/jcgay/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
      [ERROR] urls[14] = file:/Users/jcgay/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-tools-api/2.9/maven-plugin-tools-api-2.9.jar
      [ERROR] urls[15] = file:/Users/jcgay/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.jar
      [ERROR] urls[16] = file:/Users/jcgay/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar
      [ERROR] urls[17] = file:/Users/jcgay/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
      [ERROR] urls[18] = file:/Users/jcgay/.m2/repository/net/sf/jtidy/jtidy/r938/jtidy-r938.jar
      [ERROR] urls[19] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-plus/7.6.16.v20140903/jetty-plus-7.6.16.v20140903.jar
      [ERROR] urls[20] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/orbit/javax.transaction/1.1.1.v201105210645/javax.transaction-1.1.1.v201105210645.jar
      [ERROR] urls[21] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-jndi/7.6.16.v20140903/jetty-jndi-7.6.16.v20140903.jar
      [ERROR] urls[22] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-server/7.6.16.v20140903/jetty-server-7.6.16.v20140903.jar
      [ERROR] urls[23] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/orbit/javax.servlet/2.5.0.v201103041518/javax.servlet-2.5.0.v201103041518.jar
      [ERROR] urls[24] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-continuation/7.6.16.v20140903/jetty-continuation-7.6.16.v20140903.jar
      [ERROR] urls[25] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/orbit/javax.mail.glassfish/1.4.1.v201005082020/javax.mail.glassfish-1.4.1.v201005082020.jar
      [ERROR] urls[26] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/orbit/javax.activation/1.1.0.v201105071233/javax.activation-1.1.0.v201105071233.jar
      [ERROR] urls[27] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-jmx/7.6.16.v20140903/jetty-jmx-7.6.16.v20140903.jar
      [ERROR] urls[28] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-annotations/7.6.16.v20140903/jetty-annotations-7.6.16.v20140903.jar
      [ERROR] urls[29] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/orbit/javax.annotation/1.1.0.v201108011116/javax.annotation-1.1.0.v201108011116.jar
      [ERROR] urls[30] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/orbit/org.objectweb.asm/3.1.0.v200803061910/org.objectweb.asm-3.1.0.v200803061910.jar
      [ERROR] urls[31] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-websocket/7.6.16.v20140903/jetty-websocket-7.6.16.v20140903.jar
      [ERROR] urls[32] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-io/7.6.16.v20140903/jetty-io-7.6.16.v20140903.jar
      [ERROR] urls[33] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-http/7.6.16.v20140903/jetty-http-7.6.16.v20140903.jar
      [ERROR] urls[34] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/jetty-jsp/7.6.16.v20140903/jetty-jsp-7.6.16.v20140903.jar
      [ERROR] urls[35] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/orbit/javax.servlet.jsp/2.1.0.v201105211820/javax.servlet.jsp-2.1.0.v201105211820.jar
      [ERROR] urls[36] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/orbit/org.apache.jasper.glassfish/2.1.0.v201110031002/org.apache.jasper.glassfish-2.1.0.v201110031002.jar
      [ERROR] urls[37] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/orbit/javax.servlet.jsp.jstl/1.2.0.v201105211821/javax.servlet.jsp.jstl-1.2.0.v201105211821.jar
      [ERROR] urls[38] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/orbit/org.apache.taglibs.standard.glassfish/1.2.0.v201112081803/org.apache.taglibs.standard.glassfish-1.2.0.v201112081803.jar
      [ERROR] urls[39] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/orbit/javax.el/2.1.0.v201105211819/javax.el-2.1.0.v201105211819.jar
      [ERROR] urls[40] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/orbit/com.sun.el/1.0.0.v201105211818/com.sun.el-1.0.0.v201105211818.jar
      [ERROR] urls[41] = file:/Users/jcgay/.m2/repository/org/eclipse/jetty/orbit/org.eclipse.jdt.core/3.7.1/org.eclipse.jdt.core-3.7.1.jar
      [ERROR] Number of foreign imports: 1
      [ERROR] import: Entry[import  from realm ClassRealm[project>fr.jcgay.server-notifier:example-webapp:0.2-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]
      [ERROR]
      [ERROR] -----------------------------------------------------: org.slf4j.helpers.MessageFormatter
      

      I reproduced the error with Maven 3.3.1, 3.3.3 and latest jetty plugin versions:

                  <plugin>
                      <groupId>org.mortbay.jetty</groupId>
                      <artifactId>jetty-maven-plugin</artifactId>
                      <version>7.6.16.v20140903</version>
                  </plugin>
                  
                  <plugin>
                      <groupId>org.mortbay.jetty</groupId>
                      <artifactId>jetty-maven-plugin</artifactId>
                      <version>8.1.16.v20140903</version>
                  </plugin>
                  
                  <plugin>
                      <groupId>org.eclipse.jetty</groupId>
                      <artifactId>jetty-maven-plugin</artifactId>
                      <version>9.3.0.RC1</version>
                  </plugin>
      

      It works perfectly fine with Maven 3.2.5.

      I assume that the problem is not limited to the jetty plugin but to any plugin using slf4j-api classes from packages different than org.slf4j.* and org.slf4j.spi (exposed in extension.xml).
      I have tried running jetty with a patched maven-core.jar (adding <exportedPackage>org.slf4j.helpers.*</exportedPackage> into META-INF/maven/extension.xml) and it runs fine.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                aheritier Arnaud Heritier
                Reporter:
                jcgay Jean-Christophe Gay
              • Votes:
                1 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: