1 Reply Latest reply on Jul 9, 2012 3:33 PM by badr elhouari

    JSFUnit2 example not working

    Paul Rivera Newbie

      Hi,

       

      I seem to have a very hard time finding an example that works for JSFUnit 2.0.0.Beta2.  I must say, I found the setup for this is EXTREMELY hard...

       

      Anyway, I've tried the sample projects from https://community.jboss.org/wiki/JSFUnit200Beta2GettingStartedExample.  (Downloaded the gettingstarted.jar).

       

      I've also downloaded Jboss AS 7.1.1.Final and ran the standalone.bat immediately.  I've unpacked the gettingstarted.jar and ran "mvn -Pjbossas-remote-7 test".  I got this error:

      -------------------------------------------------------------------------------

      Test set: org.jboss.jsfunit.example.hellojsf.HelloJSFTest

      -------------------------------------------------------------------------------

      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 14.034 sec <<< FAILURE!

      org.jboss.jsfunit.example.hellojsf.HelloJSFTest  Time elapsed: 0 sec  <<< ERROR!

      org.jboss.arquillian.container.spi.client.container.DeploymentException: Could not deploy to container

                at org.jboss.as.arquillian.container.ArchiveDeployer.deploy(ArchiveDeployer.java:58)

                at org.jboss.as.arquillian.container.CommonDeployableContainer.deploy(CommonDeployableContainer.java:96)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:148)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:115)

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

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:114)

                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.container.DeploymentExceptionHandler.verifyExpectedExceptionDuringDeploy(DeploymentExceptionHandler.java:50)

                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.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$1.perform(ContainerDeployController.java:86)

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

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

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachManagedDeployment(ContainerDeployController.java:226)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deployManaged(ContainerDeployController.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.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:97)

                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$100(Arquillian.java:45)

                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.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)

                at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)

                at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)

                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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)

                at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)

                at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)

                at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)

                at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)

      Caused by: java.util.concurrent.ExecutionException: Operation failed

                at org.jboss.threads.AsyncFutureTask.operationFailed(AsyncFutureTask.java:74)

                at org.jboss.threads.AsyncFutureTask.get(AsyncFutureTask.java:268)

                at org.jboss.as.controller.client.impl.AbstractModelControllerClient$DelegatingCancellableAsyncFuture.get(AbstractModelControllerClient.java:413)

                at org.jboss.as.controller.client.impl.AbstractModelControllerClient$DelegatingCancellableAsyncFuture.get(AbstractModelControllerClient.java:365)

                at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:69)

                at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:42)

                at org.jboss.as.arquillian.container.ArchiveDeployer.executeDeploymentPlan(ArchiveDeployer.java:75)

                at org.jboss.as.arquillian.container.ArchiveDeployer.deploy(ArchiveDeployer.java:56)

                ... 94 more

      Caused by: java.net.ConnectException: Could not connect to remote://127.0.0.1:9999 in 5000ms. Make sure the server is running and/or consider setting a longer timeout by setting -Dorg.jboss.as.client.connect.timeout=<timeout in ms>.

                at org.jboss.as.protocol.mgmt.ManagementClientChannelStrategy$Establishing.getChannel(ManagementClientChannelStrategy.java:128)

                at org.jboss.as.protocol.mgmt.ManagementRequest$1.run(ManagementRequest.java:101)

                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)

       

      From the console window where I ran standalone.bat, I see this:

       

      15:14:27,839 ERROR [org.jboss.remoting.remote.connection] (Remoting "crl-6bh77r1

      :MANAGEMENT" read-1) JBREM000200: Remote connection failed: java.io.IOException:

      An existing connection was forcibly closed by the remote host

      15:14:27,857 ERROR [org.jboss.remoting.remote.connection] (Remoting "crl-6bh77r1

      :MANAGEMENT" read-1) JBREM000200: Remote connection failed: java.io.IOException:

      An existing connection was forcibly closed by the remote host

       

       

      Has anyone been able to run the gettingstarted.jar project with maven successfully?  I've increased the timeout as the error message suggested but still got the same error, just that I had to wait longer.  The server.log of Jboss AS7 doesn't have anythinging other than the messages in the standalone.bat console I've pasted above.

        • 1. Re: JSFUnit2 example not working
          badr elhouari Novice

          Hi, you should update your dependencies with AS 7.1.1..

           

          try this:

           

          <properties>

                              <version.jsfunit>2.0.0.Beta2</version.jsfunit>

                              <version.arquillian>1.0.1.Final</version.arquillian>

                              <version.shrinkwrap_resolver>2.0.0-alpha-1</version.shrinkwrap_resolver>

                              <version.shrinkwrap_descriptors>1.1.0-alpha-5</version.shrinkwrap_descriptors>

                              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

           

                    </properties>

                    <dependencyManagement>

           

           

                              <dependencies>

                                        <dependency>

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

                                                  <artifactId>shrinkwrap-resolver-bom</artifactId>

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

                                                  <scope>test</scope>

                                                  <type>pom</type>

                                        </dependency>

                                        <dependency>

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

                                                  <artifactId>arquillian-bom</artifactId>

                                                  <type>pom</type>

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

                                                  <scope>import</scope>

                                        </dependency>

                                        <dependency>

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

                                                  <artifactId>shrinkwrap-descriptors-impl</artifactId>

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

                                                  <scope>test</scope>

                                        </dependency>

                              </dependencies>

                    </dependencyManagement>

                    <!-- Dependencies common to all containers -->

                    <dependencies>

                              <dependency>

                                        <groupId>junit</groupId>

                                        <artifactId>junit</artifactId>

                                        <version>4.8.2</version>

                                        <scope>test</scope>

                              </dependency>

           

           

                              <dependency>

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

                                        <artifactId>arquillian-junit-container</artifactId>

                                        <scope>test</scope>

                              </dependency>

           

           

                              <dependency>

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

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

                                        <scope>test</scope>

                              </dependency>

           

           

                              <dependency>

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

                                        <artifactId>arquillian-container-spi</artifactId>

                                        <scope>test</scope>

                              </dependency>

           

           

                              <dependency>

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

                                        <artifactId>shrinkwrap-resolver-api</artifactId>

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

                                        <scope>test</scope>

                              </dependency>

                              <dependency>

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

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

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

                                        <scope>test</scope>

                              </dependency>

                              <dependency>

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

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

                                        <version>2.0.0-alpha-1</version>

                                        <scope>test</scope>

                              </dependency>

           

           

                              <dependency>

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

                                        <artifactId>shrinkwrap-descriptors-impl</artifactId>

                                        <scope>test</scope>

                              </dependency>

           

           

                              <dependency>

                                        <groupId>org.jboss.spec.javax.faces</groupId>

                                        <artifactId>jboss-jsf-api_2.1_spec</artifactId>

                                        <version>2.0.0.Beta1</version>

                                        <scope>provided</scope>

                              </dependency>

           

           

                              <dependency>

                                        <groupId>org.jboss.spec.javax.servlet</groupId>

                                        <artifactId>jboss-servlet-api_3.0_spec</artifactId>

                                        <version>1.0.0.Final</version>

                                        <scope>provided</scope>

                              </dependency>

           

           

                              <dependency>

                                        <groupId>org.primefaces</groupId>

                                        <artifactId>primefaces</artifactId>

                                        <version>2.2</version>

                              </dependency>

           

           

                              <dependency>

                                        <groupId>org.jboss.jsfunit</groupId>

                                        <artifactId>jsfunit-arquillian</artifactId>

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

                                        <scope>test</scope>

                              </dependency>

           

           

                              <dependency>

                                        <groupId>org.jboss.jsfunit</groupId>

                                        <artifactId>jboss-jsfunit-core</artifactId>

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

                                        <scope>test</scope>

                              </dependency>

           

           

           

                    </dependencies>

                    <build>

                              <plugins>

           

           

                                        <plugin>

                                                  <groupId>org.apache.maven.plugins</groupId>

                                                  <artifactId>maven-compiler-plugin</artifactId>

                                                  <version>2.3.2</version>

                                                  <configuration>

                                                            <encoding>${project.build.sourceEncoding}</encoding>

                                                            <source>1.6</source>

                                                            <target>1.6</target>

                                                  </configuration>

                                        </plugin>

           

           

                                        <plugin>

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

                                                  <artifactId>resolver-maven-plugin</artifactId>

                                                  <version>2.0.0-alpha-1</version>

                                                  <executions>

                                                            <execution>

                                                                      <goals>

                                                                                <goal>propagate-execution-context</goal>

                                                                      </goals>

                                                            </execution>

                                                  </executions>

                                        </plugin>

                              </plugins>

                    </build>

           

           

                    <profiles>

           

           

                              <profile>

                                        <id>jbossas-remote-7</id>

                                        <dependencies>

                                                  <dependency>

                                                            <groupId>org.jboss.as</groupId>

                                                            <artifactId>jboss-as-arquillian-container-remote</artifactId>

                                                            <version>7.1.1.Final</version>

                                                            <scope>test</scope>

                                                  </dependency>

                                        </dependencies>

                              </profile>

           

           

                              <profile>

                                  <id>glassfish-embedded-3.1</id>

                                  <activation>

                                          <activeByDefault>true</activeByDefault>

                                  </activation>

                                  <dependencies>

                                          <dependency>

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

                                                  <artifactId>arquillian-glassfish-common</artifactId>

                                                  <version>1.0.0.CR3</version>

                                                  <scope>test</scope>

                                          </dependency>

                                          <dependency>

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

                                                  <artifactId>arquillian-glassfish-embedded-3.1</artifactId>

                                                  <version>1.0.0.CR3</version>

                                          </dependency>

                                          <dependency>

                                                  <groupId>org.glassfish.main.extras</groupId>

                                                  <artifactId>glassfish-embedded-web</artifactId>

                                                  <version>3.1.2</version>

                                          </dependency>

           

           

                                  </dependencies>

                          </profile>

                    </profiles>

          It's a working example on AS 7.1.1 in remote mode and Glassfish 3.1.2 in embedded mode (also default profile)

           

          The example is also using the last Shrinkwrap resolver API if you need to add libraries (like primefaces ;-)

           

          hope it helps ;-)