2 Replies Latest reply on Jan 30, 2011 4:37 PM by Simon Rettenmeier

    Could not connect to container exception when executing a simple test (remote JBoss)

    Simon Rettenmeier Newbie

      Hello together,

       

      I'm trying to run a simple test example with arquillian. Therefore I'm using a standard JBoss AS 6.0 with a default configuration. But when I execute the test I'm getting the following exception:

       

       

      -------------------------------------------------------------------------------
      Test set: de.rettenmeier.javaee.BookServiceTest
      -------------------------------------------------------------------------------
      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.026 sec <<< FAILURE!
      initializationError(de.rettenmeier.javaee.BookServiceTest)  Time elapsed: 0.003 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.<init>(JUnit4TestSet.java:45)
                at org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite.createTestSet(JUnit4DirectoryTestSuite.java:56)
                at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:96)
                at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:209)
                at org.apache.maven.surefire.Surefire.run(Surefire.java:156)
                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:345)
                at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
      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)
                ... 24 more
      Caused by: java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException
                at java.security.AccessController.doPrivileged(Native Method)
                at org.jboss.aspects.security.SecurityActions.createSecurityContext(SecurityActions.java:660)
                at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:59)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                at org.jboss.aop.generatedproxies.AOPProxy$0.getDeploymentManager(AOPProxy$0.java)
                at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.initDeploymentManager(JBossASRemoteContainer.java:222)
                at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.start(JBossASRemoteContainer.java:85)
                ... 27 more
      Caused by: java.lang.reflect.InvocationTargetException
                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.jboss.security.SecurityContextFactory.createSecurityContext(SecurityContextFactory.java:117)
                at org.jboss.security.SecurityContextFactory.createSecurityContext(SecurityContextFactory.java:76)
                at org.jboss.aspects.security.SecurityActions$1.run(SecurityActions.java:665)
                ... 34 more
      Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/security/jacc/PolicyContextException
                at java.lang.ClassLoader.defineClass1(Native Method)
                at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
                at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
                at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
                at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
                at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
                at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
                at java.security.AccessController.doPrivileged(Native Method)
                at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
                at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
                at org.jboss.security.plugins.JBossSecurityContext.<init>(JBossSecurityContext.java:58)
                ... 41 more
      
      

       

      My maven pom.xml:

       

       

      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.6</java.version>
      
        <javaee.version>6.0</javaee.version>
        <arquillian.version>1.0.0.Alpha4</arquillian.version>
        <jboss.version>6.0.0.Final</jboss.version>
        </properties>
      
        <dependencies>
        <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.1</version>
        <scope>test</scope>
        </dependency>
      
        <dependency>
                                    <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-junit</artifactId>
                                    <version>${arquillian.version}</version>
        <scope>test</scope>
        </dependency>
      
        <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
                                    <version>${javaee.version}</version>
                                    <scope>provided</scope>
        </dependency>
        </dependencies>
      
        <profiles>
        <profile>
                                    <id>jbossas-remote-6</id>
        <activation>
        <activeByDefault>true</activeByDefault>
        </activation>
        <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>${jboss.version}</version>
                                                        <type>pom</type>
        </dependency>
        </dependencies>
        </profile>
        </profiles>
      
      

       

       

      Also I added jndi.properties to the classpath:

       

       

      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 can't see what's wrong with this configuration, so hopefully anyone can help me.

       

       

      Thanks in advance.