10 Replies Latest reply on Oct 17, 2011 3:18 AM by Aslak Knutsen

    CDI injection fails on tomcat 7 container module

    Ben Utzer Newbie

      Hi again,

       

      it seems I have a problem with CDI and the tomcat 7 arquillian container. The test methods of the TemperatureConverterTest of the documentation throw NPEs. CDI works outside arquillian. Anything I missed?

       

      Regards,

       

      Ben

        • 2. Re: CDI injection fails on tomcat 7 container module
          Ben Utzer Newbie

          Ok, one step further by using this:

          {code:xml}

          <shrinkwrap.version>1.0.0-cr-1</shrinkwrap.version>

          <shrinkwrap_resolver.version>1.0.0-beta-5</shrinkwrap_resolver.version>

          ...

          <dependency>

                      <groupId>org.jboss.shrinkwrap.resolver</groupId>

                      <artifactId>shrinkwrap-resolver-impl-maven</artifactId>

                      <version>${shrinkwrap_resolver.version}</version>

                      <scope>test</scope>

                  </dependency>

                  <dependency>

                      <groupId>org.jboss.shrinkwrap</groupId>

                      <artifactId>shrinkwrap-api</artifactId>

                      <version>${shrinkwrap.version}</version>

                  </dependency>

          {code}

           

           

           

          Next exception message is: org.jboss.weld.servlet:weld-servlet-jar:1.1.3-SNAPSHOT is not available in local repository.

          • 3. Re: CDI injection fails on tomcat 7 container module
            Ben Utzer Newbie

            I'm a step further with configuring my nonstandard maven settings.xml location in my @Deployment method.

             

            Next stacktrace:

             

             

            {code}

            12.10.2011 20:32:41 org.jboss.arquillian.container.tomcat.managed_7.TomcatManagedContainer start

            INFO: Starting Tomcat with: [java, -Dcom.sun.management.jmxremote.port=8089, -Dcom.sun.management.jmxremote.ssl=false, -Dcom.sun.management.jmxremote.authenticate=false, -Xmx512m, -XX:MaxPermSize=128m, -classpath, H:\Servers\apache-tomcat-7.0.22/bin/bootstrap.jar;H:\Servers\apache-tomcat-7.0.22/bin/tomcat-juli.jar, -Djava.endorsed.dirs=H:\Servers\apache-tomcat-7.0.22/endorsed, -Dcatalina.base=H:\Servers\apache-tomcat-7.0.22, -Dcatalina.home=H:\Servers\apache-tomcat-7.0.22, -Djava.io.tmpdir=H:\Servers\apache-tomcat-7.0.22/temp, org.apache.catalina.startup.Bootstrap, -config, H:\Servers\apache-tomcat-7.0.22/conf/server.xml, start]

            12.10.2011 20:32:42 org.apache.catalina.core.AprLifecycleListener init

            INFO: Loaded APR based Apache Tomcat Native library 1.1.22.

            12.10.2011 20:32:42 org.apache.catalina.core.AprLifecycleListener init

            INFO: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], random [true].

            12.10.2011 20:32:42 org.apache.coyote.AbstractProtocol init

            INFO: Initializing ProtocolHandler ["http-apr-8080"]

            12.10.2011 20:32:42 org.apache.coyote.AbstractProtocol init

            INFO: Initializing ProtocolHandler ["ajp-apr-8009"]

            12.10.2011 20:32:42 org.apache.catalina.startup.Catalina load

            INFO: Initialization processed in 437 ms

            12.10.2011 20:32:42 org.apache.catalina.core.StandardService startInternal

            INFO: Starting service Catalina

            12.10.2011 20:32:42 org.apache.catalina.core.StandardEngine startInternal

            INFO: Starting Servlet Engine: Apache Tomcat/7.0.22

            12.10.2011 20:32:42 org.apache.catalina.startup.HostConfig deployDirectory

            INFO: Deploying web application directory docs

            12.10.2011 20:32:42 org.apache.catalina.startup.HostConfig deployDirectory

            INFO: Deploying web application directory examples

            12.10.2011 20:32:42 org.apache.catalina.core.ApplicationContext log

            INFO: ContextListener: contextInitialized()

            12.10.2011 20:32:42 org.apache.catalina.core.ApplicationContext log

            INFO: SessionListener: contextInitialized()

            12.10.2011 20:32:42 org.apache.catalina.core.ApplicationContext log

            INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@1722456')

            12.10.2011 20:32:42 org.apache.catalina.startup.HostConfig deployDirectory

            INFO: Deploying web application directory host-manager

            12.10.2011 20:32:42 org.apache.catalina.startup.HostConfig deployDirectory

            INFO: Deploying web application directory manager

            12.10.2011 20:32:42 org.apache.catalina.startup.HostConfig deployDirectory

            INFO: Deploying web application directory ROOT

            12.10.2011 20:32:42 org.apache.coyote.AbstractProtocol start

            INFO: Starting ProtocolHandler ["http-apr-8080"]

            12.10.2011 20:32:42 org.apache.coyote.AbstractProtocol start

            INFO: Starting ProtocolHandler ["ajp-apr-8009"]

            12.10.2011 20:32:42 org.apache.catalina.startup.Catalina start

            INFO: Server startup in 317 ms

            12.10.2011 20:32:42 org.apache.catalina.core.ApplicationContext log

            INFO: Manager: init: Associated with Deployer 'Catalina:type=Deployer,host=localhost'

            12.10.2011 20:32:42 org.apache.catalina.core.ApplicationContext log

            INFO: Manager: init: Global resources are available

            12.10.2011 20:32:42 org.apache.catalina.core.ApplicationContext log

            INFO: Manager: list: Listing contexts for virtual host 'localhost'

            12.10.2011 20:32:44 org.apache.catalina.core.ApplicationContext log

            INFO: Manager: deploy: Deploying web application '/test'

            12.10.2011 20:32:44 org.apache.catalina.core.ApplicationContext log

            INFO: Manager: Uploading WAR file to H:\Servers\apache-tomcat-7.0.22\webapps\test.war

            12.10.2011 20:32:44 org.apache.catalina.startup.HostConfig deployWAR

            INFO: Deploying web application archive test.war

            12.10.2011 20:32:45 org.jboss.weld.bootstrap.WeldBootstrap <clinit>

            INFO: WELD-000900 1.1.3 (20111012-0355)

            12.10.2011 20:32:45 org.jboss.weld.bootstrap.WeldBootstrap startContainer

            INFO: WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.

            12.10.2011 20:32:45 org.jboss.weld.environment.tomcat7.Tomcat7Container initialize

            INFO: Tomcat 7 detected, CDI injection will be available in Servlets and Filters. Injection into Listeners is not supported

            12.10.2011 20:32:45 org.apache.catalina.core.ApplicationContext log

            INFO: Marking servlet Faces Servlet as unavailable

            12.10.2011 20:32:45 org.apache.catalina.core.StandardContext loadOnStartup

            SCHWERWIEGEND: Servlet /test threw load() exception

            java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet

                at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)

                at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)

                at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:525)

                at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:507)

                at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:126)

                at org.jboss.weld.environment.tomcat7.ForwardingInstanceManager.newInstance(ForwardingInstanceManager.java:26)

                at org.jboss.weld.environment.tomcat7.WeldForwardingInstanceManager.newInstance(WeldForwardingInstanceManager.java:62)

                at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)

                at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1043)

                at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)

                at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284)

                at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279)

                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

                at java.util.concurrent.FutureTask.run(FutureTask.java:138)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                at java.lang.Thread.run(Thread.java:662)

            12.10.2011 20:32:45 org.jboss.arquillian.container.tomcat.managed_7.TomcatManagedContainer retrieveContextServletInfo

            INFO: Connecting to JMX: service:jmx:rmi:///jndi/rmi://localhost:8089/jmxrmi

            12.10.2011 20:32:45 org.jboss.arquillian.testenricher.cdi.container.BeanManagerProducer lookup

            INFO: BeanManager not found.

            12.10.2011 20:32:45 org.jboss.arquillian.testenricher.cdi.container.BeanManagerProducer lookup

            INFO: BeanManager not found.

            12.10.2011 20:32:45 org.jboss.arquillian.testenricher.cdi.container.BeanManagerProducer lookup

            INFO: BeanManager not found.

            12.10.2011 20:32:45 org.apache.catalina.core.ApplicationContext log

            INFO: Manager: undeploy: Undeploying web application at '/test'

            12.10.2011 20:32:46 org.apache.catalina.startup.HostConfig checkResources

            INFO: Undeploying context [/test]

            {code}

            • 4. Re: CDI injection fails on tomcat 7 container module
              Ben Utzer Newbie

              The problem was that i didn't include the maven dependencies. When I use "includeDependenciesFromPom("pom.xml")" to include all dependencies I am rewarded with a new stacktrace:

               

               

              {code}

              java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.WebArchive de.biergit.TemperatureConverterTest.createTestArchive()

                  at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:160)

                  at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generateDeployment(AnnotationDeploymentScenarioGenerator.java:94)

                  at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generate(AnnotationDeploymentScenarioGenerator.java:57)

                  at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:79)

                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                  at java.lang.reflect.Method.invoke(Method.java:597)

                  at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                  at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                  at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                  at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134)

                  at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)

                  at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

                  at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:96)

                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                  at java.lang.reflect.Method.invoke(Method.java:597)

                  at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                  at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                  at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                  at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:68)

                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                  at java.lang.reflect.Method.invoke(Method.java:597)

                  at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                  at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                  at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:54)

                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                  at java.lang.reflect.Method.invoke(Method.java:597)

                  at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                  at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                  at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134)

                  at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)

                  at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:80)

                  at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:158)

                  at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:290)

                  at org.jboss.arquillian.junit.Arquillian.access$0(Arquillian.java:283)

                  at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:175)

                  at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

                  at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:123)

                  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

                  at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

              Caused by: java.lang.reflect.InvocationTargetException

                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                  at java.lang.reflect.Method.invoke(Method.java:597)

                  at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:156)

                  ... 50 more

              Caused by: org.jboss.shrinkwrap.resolver.api.ResolutionException: Unable to resolve an artifact

                  at org.jboss.shrinkwrap.resolver.impl.maven.MavenBuilderImpl.resolveAsFiles(MavenBuilderImpl.java:375)

                  at org.jboss.shrinkwrap.resolver.impl.maven.MavenBuilderImpl.resolveAs(MavenBuilderImpl.java:442)

                  at org.jboss.shrinkwrap.resolver.impl.maven.MavenBuilderImpl.resolveAs(MavenBuilderImpl.java:406)

                  at de.biergit.TemperatureConverterTest.createTestArchive(TemperatureConverterTest.java:34)

                  ... 55 more

              Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: The following artifacts could not be resolved: org.jboss.shrinkwrap:shrinkwrap-impl-base:jar:1.0.0-beta-5, org.jboss.shrinkwrap:shrinkwrap-spi:jar:1.0.0-beta-5: The repository system is offline but the artifact org.jboss.shrinkwrap:shrinkwrap-impl-base:jar:1.0.0-beta-5 is not available in the local repository.

                  at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:499)

                  at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveArtifacts(DefaultRepositorySystem.java:253)

                  at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:283)

                  at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:315)

                  at org.jboss.shrinkwrap.resolver.impl.maven.MavenRepositorySystem.resolveDependencies(MavenRepositorySystem.java:194)

                  at org.jboss.shrinkwrap.resolver.impl.maven.MavenBuilderImpl.resolveAsFiles(MavenBuilderImpl.java:367)

                  ... 58 more

              Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: The repository system is offline but the artifact org.jboss.shrinkwrap:shrinkwrap-impl-base:jar:1.0.0-beta-5 is not available in the local repository.

                  at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:304)

                  ... 63 more

               

              {code}
              • 5. Re: CDI injection fails on tomcat 7 container module
                Vineet Reynolds Apprentice

                CDI wouldn't work on Tomcat 7 for Arquillian testcases, as Weld uses the Tomcat's InstanceManager to inject dependencies into classes. Since InstanceManager is used by Tomcat only in the creation of Servlets, Filters and Listeners, Weld is restricted in injecting dependencies in Tomcat.

                1 of 1 people found this helpful
                • 6. Re: CDI injection fails on tomcat 7 container module
                  Ben Utzer Newbie

                  Impossible! This would have been mentioned in the docs somewhere. CDI works without Arquillian in Tomcat 7.

                  Here's another stacktrace when I explicitly state the dependencies i want in my test.war:

                   

                   

                  {code}

                  java.lang.RuntimeException: The server command (/text/undeploy?path=%2Ftest) failed with content (FAIL - Unable to delete [C:\Software_Entwicklung\apache-tomcat-7.0.22\webapps\test]. The continued presence of this file may cause problems.).

                      at org.jboss.arquillian.container.tomcat.managed_7.TomcatManager.processResponse(TomcatManager.java:208)

                      at org.jboss.arquillian.container.tomcat.managed_7.TomcatManager.execute(TomcatManager.java:179)

                      at org.jboss.arquillian.container.tomcat.managed_7.TomcatManager.undeploy(TomcatManager.java:102)

                      at org.jboss.arquillian.container.tomcat.managed_7.TomcatManagedContainer.undeploy(TomcatManagedContainer.java:232)

                      at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$4.call(ContainerDeployController.java:192)

                      at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$4.call(ContainerDeployController.java:1)

                      at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:258)

                      at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.undeploy(ContainerDeployController.java:171)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                      at java.lang.reflect.Method.invoke(Method.java:597)

                      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                      at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:78)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                      at java.lang.reflect.Method.invoke(Method.java:597)

                      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                      at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                      at java.lang.reflect.Method.invoke(Method.java:597)

                      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134)

                      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)

                      at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

                      at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$2.perform(ContainerDeployController.java:107)

                      at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$2.perform(ContainerDeployController.java:1)

                      at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDeployController.java:250)

                      at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployedDeployment(ContainerDeployController.java:236)

                      at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.undeployManaged(ContainerDeployController.java:99)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                      at java.lang.reflect.Method.invoke(Method.java:597)

                      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134)

                      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)

                      at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

                      at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:102)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                      at java.lang.reflect.Method.invoke(Method.java:597)

                      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                      at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:68)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                      at java.lang.reflect.Method.invoke(Method.java:597)

                      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                      at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:54)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                      at java.lang.reflect.Method.invoke(Method.java:597)

                      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134)

                      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)

                      at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.afterClass(EventTestRunnerAdaptor.java:87)

                      at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:180)

                      at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:290)

                      at org.jboss.arquillian.junit.Arquillian.access$0(Arquillian.java:283)

                      at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:175)

                      at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

                      at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:123)

                      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

                      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

                      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

                      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

                      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

                      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

                   

                  {code}
                  • 7. Re: CDI injection fails on tomcat 7 container module
                    Vineet Reynolds Apprentice

                    Ben Utzer wrote:

                     

                    Impossible! This would have been mentioned in the docs somewhere. CDI works without Arquillian in Tomcat 7.

                    Here's another stacktrace when I explicitly state the dependencies i want in my test.war:

                     

                     

                    
                    java.lang.RuntimeException: The server command (/text/undeploy?path=%2Ftest) failed with content (FAIL - Unable to delete [C:\Software_Entwicklung\apache-tomcat-7.0.22\webapps\test]. The continued presence of this file may cause problems.).
                        at org.jboss.arquillian.container.tomcat.managed_7.TomcatManager.processResponse(TomcatManager.java:208)
                        at org.jboss.arquillian.container.tomcat.managed_7.TomcatManager.execute(TomcatManager.java:179)
                        at org.jboss.arquillian.container.tomcat.managed_7.TomcatManager.undeploy(TomcatManager.java:102)
                        at org.jboss.arquillian.container.tomcat.managed_7.TomcatManagedContainer.undeploy(TomcatManagedContainer.java:232)
                        at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$4.call(ContainerDeployController.java:192)
                        at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$4.call(ContainerDeployController.java:1)
                        at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:258)
                        at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.undeploy(ContainerDeployController.java:171)
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:597)
                        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
                        at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
                        at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:78)
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:597)
                        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
                        at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:597)
                        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
                        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134)
                        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
                        at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
                        at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$2.perform(ContainerDeployController.java:107)
                        at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$2.perform(ContainerDeployController.java:1)
                        at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDeployController.java:250)
                        at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployedDeployment(ContainerDeployController.java:236)
                        at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.undeployManaged(ContainerDeployController.java:99)
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:597)
                        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
                        at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
                        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134)
                        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
                        at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
                        at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:102)
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:597)
                        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
                        at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
                        at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:68)
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:597)
                        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
                        at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:54)
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:597)
                        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
                        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134)
                        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
                        at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.afterClass(EventTestRunnerAdaptor.java:87)
                        at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:180)
                        at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:290)
                        at org.jboss.arquillian.junit.Arquillian.access$0(Arquillian.java:283)
                        at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:175)
                        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
                        at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:123)
                        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
                        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
                        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
                        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
                        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
                        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
                    
                    

                    I was referring to the first comment where in it was noted that the TemperatureConverterTest was throwing NullPointerExceptions. This is because injection of the TemperatureConverter instance via CDI is not occuring in an Arquillian test running in Tomcat. I'll need to verify if this is a bug or a restriction in the way Arquillian uses Weld to inject test dependencies.

                    • 8. Re: CDI injection fails on tomcat 7 container module
                      Ben Utzer Newbie

                      Well, it is a bug even if it is a restriction because the Arquillian mission statement says:

                      {quote}

                      Your test executes inside the container and enjoys all the same services as an application component. That means you get dependency and resource injection into the test[...]

                      {quote}

                      and later it mentions Tomcat as supported container.

                      If this is not the case then it is clearly misleading. I would have not wasted my time on this.

                      • 9. Re: CDI injection fails on tomcat 7 container module
                        Vineet Reynolds Apprentice

                        CDI injection works in Tomcat with a development build of Arquillian-Core. This is due to the fix available for ARQ-608 in Arquillian-Core. The Nexus repository does not have this build yet, so you'll need to checkout the sources of Arquillian Core and build it ("mvn clean install" will do), or wait for the repository to be updated.

                         

                        Edit - Should you see a MalformedByteSequenceException thrown during execution of SyspropReplacementInArqXmlTestCase, you can use the workaround described in SHRINKDESC-97 to ensure that the testcase succeeds. Or if you are using Eclipse, you can checkout the sources and enable workspace resolution of artifacts.