title: GWT Maven Classpath issue (BoneCP depends on slf4j-api)
body: <p>Created a gwt maven project using the archetype <code>gwt-maven-plugin 2.5.0</code>.</p>
  
  <p>GWT server side depends on <code>BoneCP</code> (A <code>ServletContextListener</code> is supposed to instantiate a connection pool). BoneCP depends on <code>slf4j-api</code>. 
  Starting DevMode throws <code>NoClassDefFoundError</code>, although slf4j-api is added as maven dependency, just as BoneCP is:</p>
  
  <pre><code>Starting Jetty on port 8888
     [WARN] failed com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload@12271e{/,/home/user/workspace/project/target\moduleName-0.0.1-SNAPSHOT}
  java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
      at com.jolbox.bonecp.BoneCPConfig.&lt;clinit&gt;(BoneCPConfig.java:62)
      at my.group.artifact.server.db.ConnectionPool.&lt;init&gt;(ConnectionPool.java:41)
      at my.group.artifact.server.db.ConnectionPool.getInstance(ConnectionPool.java:23)
      at my.group.artifact.server.MyServletContextListener.contextInitialized(MyServletContextListener.java:26)
  </code></pre>
  
  <p>Checked that <code>org.slf4j.LoggerFactory</code> actually exists in the jar added by maven. Other dependencies added via maven (e.g. BoneCP) are found.</p>
  
  <p>Pom.xml and web.xml are below. </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project
    xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  
    &lt;!-- POM file generated with GWT webAppCreator --&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;my.group/groupId&gt;
    &lt;artifactId&gt;artifact&lt;/artifactId&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;name&gt;ModuleName&lt;/name&gt;
  
    &lt;properties&gt;
      &lt;!-- Convenience property to set the GWT version --&gt;
      &lt;gwtVersion&gt;2.5.0&lt;/gwtVersion&gt;
      &lt;!-- GWT needs at least java 1.5 --&gt;
      &lt;maven.compiler.source&gt;1.6&lt;/maven.compiler.source&gt;
      &lt;maven.compiler.target&gt;1.6&lt;/maven.compiler.target&gt;
  
      &lt;webappDirectory&gt;${project.build.directory}/${project.build.finalName}&lt;/webappDirectory&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
    &lt;/properties&gt;
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;com.google.gwt&lt;/groupId&gt;
        &lt;artifactId&gt;gwt-servlet&lt;/artifactId&gt;
        &lt;version&gt;${gwtVersion}&lt;/version&gt;
        &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;com.google.gwt&lt;/groupId&gt;
        &lt;artifactId&gt;gwt-user&lt;/artifactId&gt;
        &lt;version&gt;${gwtVersion}&lt;/version&gt;
        &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;4.7&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;javax.validation&lt;/groupId&gt;
        &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
        &lt;version&gt;1.0.0.GA&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;javax.validation&lt;/groupId&gt;
        &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
        &lt;version&gt;1.0.0.GA&lt;/version&gt;
        &lt;classifier&gt;sources&lt;/classifier&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- mine --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.inject&lt;/groupId&gt;
          &lt;artifactId&gt;guice&lt;/artifactId&gt;
          &lt;version&gt;3.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.gwt.inject&lt;/groupId&gt;
          &lt;artifactId&gt;gin&lt;/artifactId&gt;
          &lt;version&gt;2.1.2&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.jolbox&lt;/groupId&gt;
          &lt;artifactId&gt;bonecp&lt;/artifactId&gt;
          &lt;version&gt;0.8.0.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;mysql&lt;/groupId&gt;
          &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;version&gt;5.1.27&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;version&gt;1.7.5&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.17&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.guava&lt;/groupId&gt;
          &lt;artifactId&gt;guava&lt;/artifactId&gt;
          &lt;version&gt;15.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.guava&lt;/groupId&gt;
          &lt;artifactId&gt;guava-gwt&lt;/artifactId&gt;
          &lt;version&gt;15.0&lt;/version&gt;
      &lt;/dependency&gt;
  
  
    &lt;/dependencies&gt;
  
    &lt;build&gt;
      &lt;!-- Generate compiled stuff in the folder used for developing mode --&gt;
      &lt;outputDirectory&gt;${webappDirectory}/WEB-INF/classes&lt;/outputDirectory&gt;
  
      &lt;plugins&gt;
  
        &lt;!-- GWT Maven Plugin --&gt;
        &lt;plugin&gt;
          &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
          &lt;artifactId&gt;gwt-maven-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.5.0&lt;/version&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;goals&gt;
                &lt;goal&gt;compile&lt;/goal&gt;
                &lt;!--&lt;goal&gt;test&lt;/goal&gt;--&gt;
                &lt;!--&lt;goal&gt;i18n&lt;/goal&gt;--&gt;
                &lt;goal&gt;generateAsync&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
          &lt;!-- Plugin configuration. There are many available options, see 
            gwt-maven-plugin documentation at codehaus.org --&gt;
          &lt;configuration&gt;
            &lt;runTarget&gt;ModuleName.html&lt;/runTarget&gt;
            &lt;hostedWebapp&gt;${webappDirectory}&lt;/hostedWebapp&gt;
            &lt;!--&lt;i18nMessagesBundle&gt;my.group.artifact.client.Messages&lt;/i18nMessagesBundle&gt;--&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
  
        &lt;!-- Copy static web files before executing gwt:run --&gt;
        &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.1.1&lt;/version&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;phase&gt;compile&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;exploded&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
          &lt;configuration&gt;
            &lt;webappDirectory&gt;${webappDirectory}&lt;/webappDirectory&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.3.2&lt;/version&gt;
          &lt;configuration&gt;
            &lt;source&gt;1.6&lt;/source&gt;
            &lt;target&gt;1.6&lt;/target&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Relevant web.xml part</p>
  
  <pre><code>  &lt;listener&gt;
      &lt;listener-class&gt;
          my.group.artifact.server.MyServletContextListener
      &lt;/listener-class&gt;
    &lt;/listener&gt;
  </code></pre>
  
  <p>Entire stacktrace</p>
  
  <pre><code>[WARN] Server class 'com.mysql.jdbc.Driver' could not be found in the web app, but was found on the system classpath
     [WARN] Adding classpath entry 'file:/C:/Documents%20and%20Settings/thomas/.m2/repository/mysql/mysql-connector-java/5.1.27/mysql-connector-java-5.1.27.jar' to the web app classpath for this session
     For additional info see: file:/C:/Documents%20and%20Settings/thomas/Desktop/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/doc/helpInfo/webAppClassPath.html
  [WARN] Server class 'com.jolbox.bonecp.BoneCPConfig' could not be found in the web app, but was found on the system classpath
     [WARN] Adding classpath entry 'file:/C:/Documents%20and%20Settings/thomas/.m2/repository/com/jolbox/bonecp/0.8.0.RELEASE/bonecp-0.8.0.RELEASE.jar' to the web app classpath for this session
     For additional info see: file:/C:/Documents%20and%20Settings/thomas/Desktop/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/doc/helpInfo/webAppClassPath.html
  Starting Jetty on port 8888
     [WARN] failed com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload@12271e{/,/home/user/workspace\project\target\moduleName-0.0.1-SNAPSHOT}
  java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
      at com.jolbox.bonecp.BoneCPConfig.&lt;clinit&gt;(BoneCPConfig.java:62)
      at my.group.artifact.server.db.ConnectionPool.&lt;init&gt;(ConnectionPool.java:41)
      at my.group.artifact.server.db.ConnectionPool.getInstance(ConnectionPool.java:23)
      at my.group.artifact.server.MyServletContextListener.contextInitialized(MyServletContextListener.java:26)
      at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
      at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
      at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
      at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
      at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
      at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.jetty.Server.doStart(Server.java:222)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
      at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
      at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
      at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1093)
      at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:836)
      at com.google.gwt.dev.DevMode.main(DevMode.java:311)
  Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:372)
      at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)
      at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
      ... 22 more
     [WARN] failed RequestLogHandler@19e9785
  java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
      at com.jolbox.bonecp.BoneCPConfig.&lt;clinit&gt;(BoneCPConfig.java:62)
      at my.group.artifact.server.db.ConnectionPool.&lt;init&gt;(ConnectionPool.java:41)
      at my.group.artifact.server.db.ConnectionPool.getInstance(ConnectionPool.java:23)
      at my.group.artifact.server.MyServletContextListener.contextInitialized(MyServletContextListener.java:26)
      at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
      at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
      at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
      at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
      at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
      at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.jetty.Server.doStart(Server.java:222)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
      at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
      at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
      at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1093)
      at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:836)
      at com.google.gwt.dev.DevMode.main(DevMode.java:311)
  Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:372)
      at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)
      at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
      ... 22 more
     [WARN] Error starting handlers
  java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
      at com.jolbox.bonecp.BoneCPConfig.&lt;clinit&gt;(BoneCPConfig.java:62)
      at my.group.artifact.server.db.ConnectionPool.&lt;init&gt;(ConnectionPool.java:41)
      at my.group.artifact.server.db.ConnectionPool.getInstance(ConnectionPool.java:23)
      at my.group.artifact.server.MyServletContextListener.contextInitialized(MyServletContextListener.java:26)
      at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
      at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
      at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
      at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
      at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
      at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.jetty.Server.doStart(Server.java:222)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
      at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
      at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
      at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1093)
      at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:836)
      at com.google.gwt.dev.DevMode.main(DevMode.java:311)
  Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:372)
      at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)
      at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
      ... 22 more
  </code></pre>