4 Replies Latest reply on Sep 30, 2013 10:06 AM by echiphn

    JSFUnit with Jboss7 "Could not inject method parameters"

    jamieland

      I have attemped to run the JSFUnit 2.0.0.Beta2, using the basic example JSFUnit 2.0.0.Beta2 Getting Started Example with Jboss AS 7.1.0.Beta1, and I keep getting the following errors.

       

       

       

       

      1:02:42,774 ERROR [org.jboss.as.controller] (pool-1-thread-1) JBAS014612: Operation ("add") failed - address: ([("deployment" => "arquillian-service")]): java.lang.IllegalStateException: J
      AS014666: Duplicate resource [("deployment" => "arquillian-service")]
             at org.jboss.as.controller.OperationContextImpl.addResource(OperationContextImpl.java:503) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.controller.OperationContextImpl.createResource(OperationContextImpl.java:471) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.server.deployment.DeploymentAddHandler.execute(DeploymentAddHandler.java:170)
             at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:322) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:216) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:152) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.controller.CompositeOperationHandler.execute(CompositeOperationHandler.java:84) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:322) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:216) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:152) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.controller.ModelControllerImpl$DefaultPrepareStepHandler.execute(ModelControllerImpl.java:426) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:322) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:216) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:152) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:115) [jboss-as-controller-7.1.0.Beta1.jar:]
             at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.doProcessRequest(ModelControllerClientOperationHandler.java:158) [jboss-as-controller-7
      1.0.Beta1.jar:]
             at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.access$100(ModelControllerClientOperationHandler.java:89) [jboss-as-controller-7.1.0.Be
      a1.jar:]
             at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.call(ModelControllerClientOperationHandler.java:118) [jboss-as-controller-7.1.0.Beta1
      jar:]
             at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.call(ModelControllerClientOperationHandler.java:116) [jboss-as-controller-7.1.0.Beta1
      jar:]
             at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [:1.6.0_26]
             at java.util.concurrent.FutureTask.run(FutureTask.java:138) [:1.6.0_26]
             at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
             at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
      
      1:02:44,541 INFO  [org.jboss.as.server.deployment.repository.impl] (pool-1-thread-1) JBAS014900: Content added at location C:\epcdev\jboss-as-7.1.0.Beta1\standalone\data\content\f7\20bb8d3
      7b32c69121fe7b88bfb63127bb104f\content
      1:02:44,560 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) Starting deployment of "test.war"
      1:02:45,239 INFO  [org.jboss.as.arquillian] (MSC service thread 1-2) Arquillian deployment detected: ArquillianConfig[service=jboss.arquillian.config."test.war",unit=test.war,tests=[org.jb
      ss.jsfunit.example.hellojsf.HelloJSFTest]]
      1:02:45,569 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-8) Initializing Mojarra 2.1.3 (SNAPSHOT 20110825) for context '/test'
      1:02:48,386 INFO  [org.hibernate.validator.util.Version] (MSC service thread 1-8) Hibernate Validator 4.2.0.Final
      1:02:48,973 INFO  [org.jboss.web] (MSC service thread 1-8) registering web context: /test
      1:02:49,252 INFO  [org.jboss.as.server.controller] (pool-1-thread-1) Deployed "test.war"
      1:02:50,259 INFO  [org.jboss.arquillian.testenricher.cdi.container.BeanManagerProducer] (Remoting "andrejamison:MANAGEMENT" task-4) BeanManager not found.
      1:02:50,498 ERROR [org.jboss.arquillian.protocol.jmx.JMXTestRunner] (Remoting "andrejamison:MANAGEMENT" task-4) Failed: org.jboss.jsfunit.example.hellojsf.HelloJSFTest.testInitialPage: jav
      .lang.RuntimeException: Could not inject method parameters
             at org.jboss.jsfunit.arquillian.container.JSFUnitTestEnricher.resolve(JSFUnitTestEnricher.java:89) [arquillian-service:]
             at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.enrichArguments(LocalTestExecuter.java:94) [arquillian-service:]
             at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60) [arquillian-service:]
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
             at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
             at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
             at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-service:]
             at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-service:]
             at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134) [arquillian-service:]
             at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114) [arquillian-service:]
             at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) [arquillian-service:]
             at org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38) [arquillian-service:]
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
             at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
             at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
             at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-service:]
             at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-service:]
             at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:82) [arquillian-service:]
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
             at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
             at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
             at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
             at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:68) [arquillian-service:]
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
             at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
             at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
             at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
             at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:54) [arquillian-service:]
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
             at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
             at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-service:]
             at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
             at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134) [arquillian-service:]
             at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111) [arquillian-service:]
             at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:239) [arquillian-service:]
             at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:202) [arquillian-service:]
             at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:290) [arquillian-service:]
             at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:45) [arquillian-service:]
             at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:216) [arquillian-service:]
             at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79) [arquillian-service:]
             at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71) [arquillian-service:]
             at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) [arquillian-service:]
             at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) [arquillian-service:]
             at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) [arquillian-service:]
             at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) [arquillian-service:]
             at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) [arquillian-service:]
             at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) [arquillian-service:]
             at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:161) [arquillian-service:]
             at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:290) [arquillian-service:]
             at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:45) [arquillian-service:]
             at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:175) [arquillian-service:]
             at org.junit.runners.ParentRunner.run(ParentRunner.java:236) [arquillian-service:]
             at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:123) [arquillian-service:]
             at org.junit.runner.JUnitCore.run(JUnitCore.java:157) [arquillian-service:]
             at org.junit.runner.JUnitCore.run(JUnitCore.java:136) [arquillian-service:]
             at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:65) [arquillian-service:]
             at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethodInternal(JMXTestRunner.java:128) [arquillian-service:]
             at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethod(JMXTestRunner.java:107) [arquillian-service:]
             at org.jboss.as.arquillian.service.ArquillianService$ExtendedJMXTestRunner.runTestMethod(ArquillianService.java:226) [arquillian-service:]
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
             at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
             at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:93) [:1.6.0_26]
             at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:27) [:1.6.0_26]
             at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208) [:1.6.0_26]
             at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:120) [:1.6.0_26]
             at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:262) [:1.6.0_26]
             at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836) [:1.6.0_26]
             at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761) [:1.6.0_26]
             at org.jboss.as.jmx.tcl.TcclMBeanServer.invoke(TcclMBeanServer.java:218)
             at org.jboss.as.jmx.model.ModelControllerMBeanServer.invoke(ModelControllerMBeanServer.java:204)
             at org.jboss.as.jmx.InvokeMBeanRaw.executeRuntimeStep(InvokeMBeanRaw.java:96)
             at org.jboss.as.controller.AbstractRuntimeOnlyHandler$1.execute(AbstractRuntimeOnlyHandler.java:90)
             at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:322)
             at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:216)
             at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:152)
             at org.jboss.as.controller.AbstractRuntimeOnlyHandler.execute(AbstractRuntimeOnlyHandler.java:94)
             at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:322)
             at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:216)
             at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:152)
             at org.jboss.as.controller.ModelControllerImpl$DefaultPrepareStepHandler.execute(ModelControllerImpl.java:426)
             at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:322)
             at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:216)
             at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:152)
             at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:115)
             at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.doProcessRequest(ModelControllerClientOperationHandler.java:158)
             at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.processRequest(ModelControllerClientOperationHandler.java:111)
             at org.jboss.as.protocol.mgmt.ManagementChannel$RequestReceiver.processRequest(ManagementChannel.java:283)
             at org.jboss.as.protocol.mgmt.ManagementChannel$RequestReceiver.access$500(ManagementChannel.java:257)
             at org.jboss.as.protocol.mgmt.ManagementChannel.doHandle(ManagementChannel.java:158)
             at org.jboss.as.protocol.ProtocolChannel.handleMessage(ProtocolChannel.java:159)
             at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:409)
             at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
             at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
      aused by: java.lang.NullPointerException
             at org.jboss.jsfunit.arquillian.container.JSFUnitSessionFactory.findJSFSession(JSFUnitSessionFactory.java:85) [arquillian-service:]
             at org.jboss.jsfunit.arquillian.container.JSFUnitSessionFactory.getJSFServerSession(JSFUnitSessionFactory.java:70) [arquillian-service:]
             at org.jboss.jsfunit.arquillian.container.JSFUnitTestEnricher.resolve(JSFUnitTestEnricher.java:84) [arquillian-service:]
             ... 105 more
      
      1:02:51,234 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) Stopped deployment test.war in 107ms
      1:02:51,302 INFO  [org.jboss.as.server.controller] (pool-1-thread-1) Undeployed "test.war"
      
      

       

       

      I am a bit stuck getting this working any ideas?

        • 1. Re: JSFUnit with Jboss7 "Could not inject method parameters"
          jamieland

          Well I was able to get ride of the

           

          1:02:42,774 ERROR [org.jboss.as.controller] (pool-1-thread-1) JBAS014612: Operation ("add") failed - address: ([("deployment" => "arquillian-service")]): java.lang.IllegalStateException: J
          AS014666: Duplicate resource [("deployment" => "arquillian-service")]

           

          By cleaning up my standalone.xml config file. I had a newer version of arquillian in there from a different project

          • 2. Re: JSFUnit with Jboss7 "Could not inject method parameters"
            garcimouche

            And with JSFUnit, you still want the defaultProtocol set to Servlet 3.0 + a dependency on org.jboss.arquillian.protocol:arquillian-protocol-servlet

             

            <defaultProtocol type="Servlet 3.0" />

             

            or @OverProtocol("Servlet 3.0") along with the @Deployment method

            • 3. Re: JSFUnit with Jboss7 "Could not inject method parameters"
              gaoyonglu

              I add @OverProtocol("Servlet 3.0")

              @Deployment

              @OverProtocol("Servlet 3.0")

                  public static WebArchive createDeployment() {

                      return ShrinkWrap

                              .create(WebArchive.class, "basic.war")

                              .addClasses(PageController.class, PageModel.class, DataPage.class, PersistenceVO.class,

                                      BaseServiceBean.class, TblOcsBin.class, TblOcsInsBasPoc.class, Producer.class,

                                      WebResources.class, MyManagedBean.class)

                              .addAsWebResource("basic/index.xhtml", "/insmanage/index.xhtml")

                              .addAsWebInfResource("common/faces-config.xml", "faces-config.xml")

                              .addAsWebInfResource("META-INF/persistence.xml", "classes/META-INF/persistence.xml")

                              .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")

                              .setWebXML("common/web.xml");     

                  }

               

              pom has :

              <dependency>

                                            <groupId>org.jboss.arquillian.protocol</groupId>

                                            <artifactId>arquillian-protocol-servlet</artifactId>

                                            <scope>test</scope>

                                  </dependency>

               

              but error:

              java.lang.NoClassDefFoundError: org/jboss/shrinkwrap/descriptor/spi/NodeProviderImplBase

                        at java.lang.ClassLoader.defineClass1(Native Method)

                        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)

                        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

                        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)

                        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)

              • 4. Re: JSFUnit with Jboss7 "Could not inject method parameters"

                for the above problem (java.lang.NoClassDefFoundError: org/jboss/shrinkwrap/descriptor/spi/NodeProviderImplBase), take a look at this post : Problem running JSFUnit 2.0.0.Beta2 Getting Started example on JBoss AS7.1.1Final. It solved my similar problem