2 Replies Latest reply on Feb 2, 2011 3:10 AM by geuze

    Address already in use exception when executing examples (remote JBoss 6)

    geuze Newbie

      Dear Arquillian users,

       

      Yesterday I tried to setup my Arquillian environment. However when I tried to run the examples (command: mvn test -Pjbossas-remote-6) I got the following stacktrace. I used the following guide http://docs.jboss.org/arquillian/reference/latest/en-US/html/examples.html to setup my environment.

       

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

      Test set: com.acme.cdi.InjectionTestCase

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

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

      initializationError(com.acme.cdi.InjectionTestCase)  Time elapsed: 0 sec  <<< ERROR!

      org.jboss.arquillian.impl.event.FiredEventException: org.jboss.arquillian.spi.LifecycleException: Could not connect to container

                              at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)

                              at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)

                              at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:68)

                              at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:89)

                              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

                              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

                              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

                              at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)

                              at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)

                              at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

                              at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)

                              at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

                              at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)

                              at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:51)

                              at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115)

                              at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102)

                              at org.apache.maven.surefire.Surefire.run(Surefire.java:180)

                              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.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)

                              at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)

      Caused by: org.jboss.arquillian.spi.LifecycleException: Could not connect to container

                              at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.start(JBossASRemoteContainer.java:90)

                              at org.jboss.arquillian.impl.handler.ContainerStarter.callback(ContainerStarter.java:52)

                              at org.jboss.arquillian.impl.handler.ContainerStarter.callback(ContainerStarter.java:41)

                              at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)

                              ... 23 more

      Caused by: java.net.BindException: Address already in use: bind

                              at sun.nio.ch.Net.bind(Native Method)

                              at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:126)

                              at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)

                              at sun.net.httpserver.ServerImpl.bind(ServerImpl.java:94)

                              at sun.net.httpserver.HttpServerImpl.bind(HttpServerImpl.java:36)

                              at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.start(JBossASRemoteContainer.java:79)

                              ... 26 more

       

      My questions are:

      • Does someone know why I get this error?
      • Does someone know which port Arquillian tries to use? Or is this the JNDI port which I configured in the jndi.properties?

       

      Note: I tried to run the examples with my JBoss 6 server started, but I also tried without my JBoss 6 server started. In between I restarted my computer completely.

       

      I also tried to set up Arquillian as part of my own maven project. I followed the http://docs.jboss.org/arquillian/reference/latest/en-US/html/gettingstarted.html  guide for this. However I get exactly the same error.

       

      Here some information about my environment.

      Arquillian version 1.0.0.Alpha4

      Maven version 3.02

      JBoss version 6 FR

       

      I use this profile:

      <profiles>

                                                     <profile>

                                                                             <id>jbossas-remote-6</id>

                                                                             <dependencies>

                                                                                                    <dependency>

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

                                                                                                                            <artifactId>arquillian-jbossas-remote-6</artifactId>

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

                                                                                                    </dependency>

                                                                                                    <dependency>

                                                                                                                            <groupId>org.jboss.ejb3</groupId>

                                                                                                                            <artifactId>jboss-ejb3-api</artifactId>

                                                                                                                            <version>3.1.0</version>

                                                                                                    </dependency>

                                                                                                    <dependency>

                                                                                                                            <groupId>org.jboss.jbossas</groupId>

                                                                                                                            <artifactId>jboss-as-client</artifactId>

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

                                                                                                                            <type>pom</type>

                                                                                                    </dependency>

                                                                             </dependencies>

                                                                             <build>

                                                                                                    <testResources>

                                                                                                                            <testResource>

                                                                                                                                                   <directory>src/test/jboss-resources</directory>

                                                                                                                            </testResource>

                                                                                                    </testResources>

                                                                                                    <plugins>

                                                                                                                            <plugin>

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

                                                                                                                                                   <artifactId>maven-surefire-plugin</artifactId>

                                                                                                                                                   <configuration>

                                                                                                                                                                           <excludes>

                                                                                                                                                    <exclude>com/acme/cdi/conversation/*</exclude>

                                                                                                                                                                           </excludes>

                                                                                                                                                   </configuration>

                                                                                                                            </plugin>

                                                                                                    </plugins>

                                                                             </build>

                                                     </profile>

                              </profiles>

       

      I use this jndi.properties file:

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory

      java.naming.factory.url.pkgs=org.jboss.naming\:org.jnp.interfaces

      java.naming.provider.url=jnp://localhost:1099

       

      I use this arquillian.xml:

      <?xml version="1.0" encoding="UTF-8"?>

      <arquillian xmlns="http://jboss.com/arquillian"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xmlns:jbossas="urn:arq:org.jboss.arquillian.container.jbossas.remote_6">

       

         <jbossas:container>

            <jbossas:profileName>default</jbossas:profileName>

            <jbossas:remoteServerAddress>localhost</jbossas:remoteServerAddress>

            <jbossas:remoteServerHttpPort>8080</jbossas:remoteServerHttpPort>

            <jbossas:localDeploymentBindAddress>localhost</jbossas:localDeploymentBindAddress>

            <jbossas:localDeploymentBindPort>9999</jbossas:localDeploymentBindPort>

         </jbossas:container>

       

      </arquillian>

        • 1. Address already in use exception when executing examples (remote JBoss 6)
          Aslak Knutsen Master

          Based on where the exception is happening, it seems to fail to start up the local http server to stream the deployments to the server.

           

          Meaning you have something running on "localDeploymentBindPort"(9999). Change that to a non conflicting port and you should be ok.

           

          -aslak-

          • 2. Address already in use exception when executing examples (remote JBoss 6)
            geuze Newbie

            Dear aslak,

             

            Thanks for your answer. I changed my port and some other thinks and it worked. In order to help other people I will give you an overview of my project.

             

            My dependencies in the pom.xml:

                                    <dependency>

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

                                                           <artifactId>arquillian-junit</artifactId>

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

                                                           <scope>test</scope>

                                    </dependency>

             

            My profile in the pom.xml:

            <profile>

                                                           <id>jbossas-remote-6</id>

                                                           <dependencies>

                                                                                   <dependency>

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

                                                                                                          <artifactId>arquillian-jbossas-remote-6</artifactId>

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

                                                                                   </dependency>

                                                                                   <dependency>

                                                                                                          <groupId>org.jboss.jbossas</groupId>

                                                                                                          <artifactId>jboss-as-client</artifactId>

                                                                                                          <version>6.0.0.Final</version>

                                                                                                          <type>pom</type>

                                                                                   </dependency>

                                                                                   <dependency>

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

                                                                                                          <artifactId>jboss-javaee-6.0</artifactId>

                                                                                                          <version>1.0.0.Beta4</version>

                                                                                                          <type>pom</type>

                                                                                                          <scope>provided</scope>

                                                                                   </dependency>

                                                           </dependencies>

                                    </profile>

             

            My arquillian settings in test\resources\arquillian.xml

             

            <?xml version="1.0" encoding="UTF-8"?>

            <arquillian xmlns="http://jboss.com/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                                    xmlns:jbossas="urn:arq:org.jboss.arquillian.container.jbossas.remote_6">

             

                                    <engine>

                                                           <deploymentExportPath>./target</deploymentExportPath>

                                    </engine>

             

                                    <jbossas:container>

                                                           <jbossas:profileName>default</jbossas:profileName>

                                                           <jbossas:remoteServerAddress>localhost</jbossas:remoteServerAddress>

                                                           <jbossas:remoteServerHttpPort>8080</jbossas:remoteServerHttpPort>

                                                           <jbossas:localDeploymentBindAddress>localhost

                                                           </jbossas:localDeploymentBindAddress>

                                                           <jbossas:localDeploymentBindPort>9000

                                                           </jbossas:localDeploymentBindPort>

                                    </jbossas:container>

             

            </arquillian>

             

            My jndi settings in test\resources\jndi.properties

             

            java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory

            java.naming.factory.url.pkgs=org.jboss.naming\:org.jnp.interfaces

            java.naming.provider.url=jnp://localhost:1099