title: NoClassDefFoundError: javax/inject/Provider and ClassNotFoundException: javax.inject.Provider
body: <p>I am getting those errors:</p>
  
  <pre><code>lis 26, 2016 8:51:16 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
  WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:erpe-server' did not find a matching property.
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Server version:        Apache Tomcat/8.0.36
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Server built:          Jun 9 2016 13:55:50 UTC
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Server number:         8.0.36.0
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: OS Name:               Linux
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: OS Version:            4.4.0-34-generic
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Architecture:          amd64
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Java Home:             /usr/lib/jvm/java-8-oracle/jre
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: JVM Version:           1.8.0_101-b13
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: JVM Vendor:            Oracle Corporation
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: CATALINA_BASE:         /home/korbeldaniel/Documents/workspace-sts-3.8.1.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: CATALINA_HOME:         /home/korbeldaniel/Documents/apache-tomcat-8.0.36
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:34576
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Dcatalina.base=/home/korbeldaniel/Documents/workspace-sts-3.8.1.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Dcatalina.home=/home/korbeldaniel/Documents/apache-tomcat-8.0.36
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Dwtp.deploy=/home/korbeldaniel/Documents/workspace-sts-3.8.1.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Djava.endorsed.dirs=/home/korbeldaniel/Documents/apache-tomcat-8.0.36/endorsed
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.VersionLoggerListener log
  INFO: Command line argument: -Dfile.encoding=UTF-8
  lis 26, 2016 8:51:16 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
  INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
  lis 26, 2016 8:51:16 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["http-nio-8080"]
  lis 26, 2016 8:51:16 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
  INFO: Using a shared selector for servlet write/read
  lis 26, 2016 8:51:16 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
  lis 26, 2016 8:51:16 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
  INFO: Using a shared selector for servlet write/read
  lis 26, 2016 8:51:16 PM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 680 ms
  lis 26, 2016 8:51:16 PM org.apache.catalina.core.StandardService startInternal
  INFO: Starting service Catalina
  lis 26, 2016 8:51:16 PM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/8.0.36
  lis 26, 2016 8:51:19 PM org.apache.jasper.servlet.TldScanner scanJars
  INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
  lis 26, 2016 8:51:19 PM org.apache.catalina.core.ApplicationContext log
  INFO: No Spring WebApplicationInitializer types detected on classpath
  SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
  SLF4J: Defaulting to no-operation (NOP) logger implementation
  SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
  lis 26, 2016 8:51:20 PM org.apache.catalina.core.ApplicationContext log
  SEVERE: StandardWrapper.Throwable
  java.lang.NoClassDefFoundError: javax/inject/Provider
      at com.google.inject.internal.MoreTypes.canonicalizeForKey(MoreTypes.java:81)
      at com.google.inject.Key.&lt;init&gt;(Key.java:119)
      at com.google.inject.Key.get(Key.java:212)
      at com.google.inject.spi.Elements$RecordingBinder.bind(Elements.java:262)
      at com.google.inject.internal.InjectorShell$RootModule.configure(InjectorShell.java:276)
      at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
      at com.google.inject.spi.Elements.getElements(Elements.java:101)
      at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
      at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
      at com.google.inject.Guice.createInjector(Guice.java:95)
      at com.google.inject.Guice.createInjector(Guice.java:72)
      at com.google.inject.Guice.createInjector(Guice.java:62)
      at org.jboss.errai.bus.server.service.ErraiServiceFactory.create(ErraiServiceFactory.java:30)
      at org.jboss.errai.bus.server.service.ErraiServiceSingleton.initSingleton(ErraiServiceSingleton.java:39)
      at org.jboss.errai.bus.server.servlet.ServletBootstrapUtil.initService(ServletBootstrapUtil.java:111)
      at org.jboss.errai.bus.server.servlet.ServletBootstrapUtil.getService(ServletBootstrapUtil.java:61)
      at org.jboss.errai.bus.server.servlet.AbstractErraiServlet.init(AbstractErraiServlet.java:86)
      at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.init(DefaultBlockingServlet.java:91)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5337)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.ClassNotFoundException: javax.inject.Provider
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1332)
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)
      ... 30 more
  
  lis 26, 2016 8:51:20 PM org.apache.catalina.core.StandardContext loadOnStartup
  SEVERE: Servlet [ErraiServlet] in web application [/erpe-server] threw load() exception
  java.lang.ClassNotFoundException: javax.inject.Provider
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1332)
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)
      at com.google.inject.internal.MoreTypes.canonicalizeForKey(MoreTypes.java:81)
      at com.google.inject.Key.&lt;init&gt;(Key.java:119)
      at com.google.inject.Key.get(Key.java:212)
      at com.google.inject.spi.Elements$RecordingBinder.bind(Elements.java:262)
      at com.google.inject.internal.InjectorShell$RootModule.configure(InjectorShell.java:276)
      at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
      at com.google.inject.spi.Elements.getElements(Elements.java:101)
      at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
      at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
      at com.google.inject.Guice.createInjector(Guice.java:95)
      at com.google.inject.Guice.createInjector(Guice.java:72)
      at com.google.inject.Guice.createInjector(Guice.java:62)
      at org.jboss.errai.bus.server.service.ErraiServiceFactory.create(ErraiServiceFactory.java:30)
      at org.jboss.errai.bus.server.service.ErraiServiceSingleton.initSingleton(ErraiServiceSingleton.java:39)
      at org.jboss.errai.bus.server.servlet.ServletBootstrapUtil.initService(ServletBootstrapUtil.java:111)
      at org.jboss.errai.bus.server.servlet.ServletBootstrapUtil.getService(ServletBootstrapUtil.java:61)
      at org.jboss.errai.bus.server.servlet.AbstractErraiServlet.init(AbstractErraiServlet.java:86)
      at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.init(DefaultBlockingServlet.java:91)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5337)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  
  lis 26, 2016 8:51:20 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-nio-8080"]
  lis 26, 2016 8:51:20 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["ajp-nio-8009"]
  lis 26, 2016 8:51:20 PM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 3374 ms
  </code></pre>
  
  <p>I can not figure this out. I have multimodule maven project, and this issue is releated to the server code that runs on tomcat container.</p>
  
  <p>Please help.</p>
  
  <p>This is my pom:</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/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;pl.korbeldaniel.erpe&lt;/groupId&gt;
          &lt;artifactId&gt;erpe&lt;/artifactId&gt;
          &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;artifactId&gt;erpe-server&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
  
      &lt;prerequisites&gt;
          &lt;maven&gt;${mavenVersion}&lt;/maven&gt;
      &lt;/prerequisites&gt;
  
      &lt;properties&gt;
          &lt;errai.version&gt;4.0.0.Beta4&lt;/errai.version&gt;
          &lt;spring.version&gt;4.2.1.RELEASE&lt;/spring.version&gt;
          &lt;spring-security.version&gt;4.0.3.RELEASE&lt;/spring-security.version&gt;
          &lt;spring-data.version&gt;1.9.1.RELEASE&lt;/spring-data.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
              &lt;artifactId&gt;erpe-shared&lt;/artifactId&gt;
              &lt;version&gt;${project.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.gwt&lt;/groupId&gt;
              &lt;artifactId&gt;gwt-servlet&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;!-- Spring starts --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-jpa&lt;/artifactId&gt;
              &lt;version&gt;${spring-data.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-core&lt;/artifactId&gt;
              &lt;version&gt;${spring-security.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
              &lt;version&gt;${spring-security.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-web&lt;/artifactId&gt;
              &lt;version&gt;${spring-security.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Spring ends --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.inject&lt;/groupId&gt;
              &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/org.jboss.errai/errai-bus --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.errai&lt;/groupId&gt;
              &lt;artifactId&gt;errai-bus&lt;/artifactId&gt;
              &lt;version&gt;${errai.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;pluginManagement&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;configuration&gt;
                          &lt;skip&gt;false&lt;/skip&gt;
                          &lt;scanIntervalSeconds&gt;1&lt;/scanIntervalSeconds&gt;
                          &lt;webApp&gt;
                              &lt;extraClasspath&gt;${basedir}/../erpe-shared/target/classes/&lt;/extraClasspath&gt;
                          &lt;/webApp&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
                      &lt;artifactId&gt;tomcat6-maven-plugin&lt;/artifactId&gt;
                      &lt;configuration&gt;
                          &lt;addWarDependenciesInClassloader&gt;false&lt;/addWarDependenciesInClassloader&gt;
                          &lt;path&gt;/&lt;/path&gt;
                          &lt;uriEncoding&gt;UTF-8&lt;/uriEncoding&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
                      &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
                      &lt;configuration&gt;
                          &lt;addWarDependenciesInClassloader&gt;false&lt;/addWarDependenciesInClassloader&gt;
                          &lt;path&gt;/&lt;/path&gt;
                          &lt;uriEncoding&gt;UTF-8&lt;/uriEncoding&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/pluginManagement&gt;
      &lt;/build&gt;
  
      &lt;profiles&gt;
          &lt;profile&gt;
              &lt;!-- XXX: We want to exclude erpe-client from 'env-dev' profile, Maven 
                  forces us to make a 'env-prod' profile --&gt;
              &lt;id&gt;env-prod&lt;/id&gt;
              &lt;activation&gt;
                  &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
              &lt;/activation&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
                      &lt;artifactId&gt;erpe-client&lt;/artifactId&gt;
                      &lt;version&gt;${project.version}&lt;/version&gt;
                      &lt;type&gt;war&lt;/type&gt;
                      &lt;scope&gt;runtime&lt;/scope&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
          &lt;/profile&gt;
          &lt;profile&gt;
              &lt;id&gt;env-dev&lt;/id&gt;
              &lt;activation&gt;
                  &lt;property&gt;
                      &lt;name&gt;env&lt;/name&gt;
                      &lt;value&gt;dev&lt;/value&gt;
                  &lt;/property&gt;
              &lt;/activation&gt;
              &lt;build&gt;
                  &lt;pluginManagement&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;configuration&gt;
                                  &lt;webApp&gt;
                                      &lt;baseResource
                                          implementation="org.eclipse.jetty.util.resource.ResourceCollection"&gt;
                                          &lt;resourcesAsCSV&gt;src/main/webapp,${basedir}/../target/gwt/launcherDir/&lt;/resourcesAsCSV&gt;
                                      &lt;/baseResource&gt;
                                  &lt;/webApp&gt;
                                  &lt;systemProperties&gt;
                                      &lt;systemProperty&gt;
                                          &lt;name&gt;gwt.codeserver.port&lt;/name&gt;
                                          &lt;value&gt;9876&lt;/value&gt;
                                      &lt;/systemProperty&gt;
                                  &lt;/systemProperties&gt;
                              &lt;/configuration&gt;
                          &lt;/plugin&gt;
                          &lt;plugin&gt;
                              &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
                              &lt;artifactId&gt;tomcat6-maven-plugin&lt;/artifactId&gt;
                              &lt;configuration&gt;
                                  &lt;contextFile&gt;${basedir}/src/main/tomcatconf/context.xml&lt;/contextFile&gt;
                                  &lt;systemProperties&gt;
                                      &lt;gwt.codeserver.port&gt;9876&lt;/gwt.codeserver.port&gt;
                                  &lt;/systemProperties&gt;
                              &lt;/configuration&gt;
                          &lt;/plugin&gt;
                          &lt;plugin&gt;
                              &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
                              &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
                              &lt;configuration&gt;
                                  &lt;contextFile&gt;${basedir}/src/main/tomcatconf/context.xml&lt;/contextFile&gt;
                                  &lt;systemProperties&gt;
                                      &lt;gwt.codeserver.port&gt;9876&lt;/gwt.codeserver.port&gt;
                                  &lt;/systemProperties&gt;
                              &lt;/configuration&gt;
                          &lt;/plugin&gt;
                      &lt;/plugins&gt;
                  &lt;/pluginManagement&gt;
              &lt;/build&gt;
          &lt;/profile&gt;
      &lt;/profiles&gt;
  &lt;/project&gt;
  </code></pre>