0 Replies Latest reply on Jan 20, 2015 6:33 AM by akrima

    Why the arquillian gives me that : Could not read active container configuration ?

    akrima Newbie

      Hello every body,

      I try to integrate the arquillian solution into my maven EJB project which contains juste the EJBs which I uses in other separate projects.

      I use Jboss EAP6.

      So i have make it as the following :

       

      • i made the arquillian.xml into ejbModule/src/test/resources/:

       

      <container qualifier="jboss" default="true">

          <configuration>

              <property name="jbossHome">D:\jbdevstudio\jboss-eap-6.2</property>

          </configuration>

      </container> 

       

      • in the pom of my project i added the following dependencies:

       

        <dependency>

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

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

             <version>1.0.0.Alpha5</version>

        </dependency>

        <dependency>

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

             <artifactId>arquillian-junit</artifactId>

             <version>1.0.0.Alpha5</version>

        </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>junit</groupId>

             <artifactId>junit</artifactId>

             <version>4.8.2</version>

        </dependency>

       

       

      <profiles>

             <profile>

                  <id>jbossas-embedded-6</id>

                  <activation>

                  <activeByDefault>true</activeByDefault>

                  </activation>

             </profile>

             <profile>

                  <id>arq-jbossas-managed</id>

                       <dependencies>

                            <dependency>

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

                                 <artifactId>jboss-as-arquillian-containermanaged</artifactId>

                                 <scope>test</scope>

                            </dependency>

                       </dependencies>

             </profile>

             <profile>

                  <id>arq-jbossas-remote</id>

                  <dependencies>

                       <dependency>

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

                            <artifactId>jboss-as-arquillian-containerremote</artifactId>

                            <scope>test</scope>

                       </dependency>

                  </dependencies>

             </profile>

        </profiles>

       

      The Test Class :

       

      import javax.inject.Inject;

       

       

      import org.jboss.arquillian.api.Deployment;

      import org.jboss.arquillian.junit.Arquillian;

      import org.jboss.shrinkwrap.api.ShrinkWrap;

      import org.jboss.shrinkwrap.api.asset.EmptyAsset;

      import org.jboss.shrinkwrap.api.spec.JavaArchive;

      import org.junit.Test;

      import org.junit.runner.RunWith;

       

       

      import org.oap.subscription.AbstractSubscription;

       

      @RunWith(Arquillian.class)

      public class SubscriptionFactoryTest {

         

          @Inject

          private SubscriptionFactory subscriptionFactory;

         

         

          @Deployment

          public static JavaArchive getDeployement() {

              System.out.println("### testSayHelloEJB");

              return ShrinkWrap.create(JavaArchive.class, "subscriptionFactory.jar")

                      .addClasses(AbstractSubscription.class,SubscriptionFactory.class);

          }

       

          @Test

          public void getSubscriptionByIdTest(){

              System.out.println("### testSayHelloEJB");

          }

      }

       

      The EJB Class:

       

      @Remote(ISubscriptionFactoryRemote.class)

      @Local(ISubscriptionFactoryLocal.class)

      @Stateless

      public class SubscriptionFactory extends AbstractSubscription implements ISubscriptionFactoryRemote {

       

           @Override

          public AbstractSubscription getSubscriptionById(final Integer id) {

              AbstractSubscription ret = null;

              if (id != null) {

                  // create query

                  final StringBuilder queryString = new StringBuilder("select c from AbstractSubscription c ");

                 

                  try {

                      queryString.append("where c.id = :id");

                      // create query

                      Query query = this.getEntityManager().createQuery(queryString.toString());

                      // set parameter

                      query = query.setParameter("id", id);

                      // recovers refCountry

                      ret = (AbstractSubscription) query.getSingleResult();

                  } catch (final Exception exc) {

                  }

              }

              return ret;

          }

       

       

      When i run the class test as Junit test , it gives me the errors :

       

      janv. 20, 2015 12:15:34 PM org.jboss.arquillian.impl.client.container.ContainerRegistryCreator getActivatedConfiguration

      Infos: Could not read active container configuration: null

       

      the Faillure Trace:

       

       

      java.lang.NoClassDefFoundError: Lorg/jboss/embedded/api/server/JBossASEmbeddedServer;

        at java.lang.Class.getDeclaredFields0(Native Method)

        at java.lang.Class.privateGetDeclaredFields(Class.java:2397)

        at java.lang.Class.getDeclaredFields(Class.java:1806)

        at org.jboss.arquillian.impl.core.Reflections.getFieldInjectionPoints(Reflections.java:74)

        at org.jboss.arquillian.impl.core.ExtensionImpl.of(ExtensionImpl.java:50)

        at org.jboss.arquillian.impl.core.ManagerImpl.inject(ManagerImpl.java:189)

        at org.jboss.arquillian.impl.core.InjectorImpl.inject(InjectorImpl.java:57)

        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$4.perform(ContainerLifecycleController.java:123)

        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$4.perform(ContainerLifecycleController.java:106)

        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:183)

        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.setupContainer(ContainerLifecycleController.java:105)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at org.jboss.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

        at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

        at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

        at org.jboss.arquillian.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:78)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at org.jboss.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

        at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:87)

        at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

        at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

        at org.jboss.arquillian.impl.core.EventImpl.fire(EventImpl.java:67)

        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$1.perform(ContainerLifecycleController.java:68)

        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$1.perform(ContainerLifecycleController.java:61)

        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.forEachContainer(ContainerLifecycleController.java:176)

        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.setupContainers(ContainerLifecycleController.java:60)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at org.jboss.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

        at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

        at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

        at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

        at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

        at org.jboss.arquillian.impl.core.EventImpl.fire(EventImpl.java:67)

        at org.jboss.arquillian.impl.client.ContainerEventController.execute(ContainerEventController.java:54)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at org.jboss.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

        at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

        at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

        at org.jboss.arquillian.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:54)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at org.jboss.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

        at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:87)

        at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

        at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

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

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

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

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

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

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

        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.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)

        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)

        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)

        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)

        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)

        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.ClassNotFoundException: org.jboss.embedded.api.server.JBossASEmbeddedServer

        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

        ... 79 more

       

       

      Any idea.

       

      Thx a lot.