2 Replies Latest reply: Feb 28, 2012 8:39 AM by Dominik Grupp RSS

    Failed to set JNDI Naming Context

    Dominik Grupp Newbie

      Hi,

      the kitchensink project from the jboss quickstart projects provides an example of Arquillian tests. However, I cannot make them run:

       

      According to https://docs.jboss.org/author/display/ARQ/JBoss+AS+7.0+-+Managed as of AS 7.0.0. Final an arquillian.xml is needed with the following content.

       

      <?xml version="1.0" encoding="UTF-8"?>
      <arquillian xmlns="http://jboss.org/schema/arquillian"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://jboss.org/schema/arquillian
              http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
         <!-- Example configuration for a remote JBoss AS 7 instance -->
         <container qualifier="jboss" default="true">
             <protocol type="jmx-as7">
                <property name="executionType">REMOTE</property>
             </protocol>
            <configuration>
               <property name="jbossHome">d:/programs/jboss/jboss-as-7.1.0.Final/bin</property>
            </configuration>
         </container>
      </arquillian>

       

      Additionally, 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

       

      When the following is being executed:

       

      mvn test -Parq-jbossas-managed  or   mvn test -Parq-jbossas-remote

       

      then the following error message is being displayed

       

      -------------------------------------------------------
      T E S T S
      -------------------------------------------------------
      Running org.jboss.as.quickstarts.kitchensink.test.MemberRegistrationTest
      log4j:WARN No appenders could be found for logger (org.jboss.logging).
      log4j:WARN Please initialize the log4j system properly.
      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.656 sec <<< FAILURE!

      Results :

      Tests in error:
        org.jboss.as.quickstarts.kitchensink.test.MemberRegistrationTest: Could not set JNDI Naming Context

      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

       

      In standalone.xml jndi is configured to port 1099:

       

      <socket-binding name="jndi" port="1099"/>

       

      Via Eclipse > Run as > JUnit Test

       

      java.lang.RuntimeException: Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor see cause.
      at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:170)
      at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)
      at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:93)
      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.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.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:166)
      ... 8 more
      Caused by: org.jboss.arquillian.container.impl.ContainerCreationException: Could not create Container jboss
      at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:85)
      at org.jboss.arquillian.container.impl.client.container.ContainerRegistryCreator.createRegistry(ContainerRegistryCreator.java:75)
      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.ManagerImpl.bindAndFire(ManagerImpl.java:235)
      at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:74)
      at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.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.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.ManagerImpl.start(ManagerImpl.java:260)
      at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:56)
      ... 13 more
      Caused by: java.lang.IllegalArgumentException: DeployableContainer must be specified
      at org.jboss.arquillian.core.spi.Validate.notNull(Validate.java:44)
      at org.jboss.arquillian.container.impl.ContainerImpl.<init>(ContainerImpl.java:71)
      at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:76)
      ... 37 more

      The pom.xml is left untouched except change of version of artifactId "jboss-as-arquillian-container-remote" to 7.1.0.Final

       

      Where is the problem?

       

      Additional question:

       

      According to https://docs.jboss.org/author/display/ARQ/Container+management JNDI seems to be only necessary for a remote container but according to
      https://docs.jboss.org/author/display/ARQ/Setting+up+and+running+the+test+in+Maven JNDI seems to be generally necessary for Arquillian. Will I need as well for the managed container a jndi.properties?

      Regards,

       

      Michael