1 Reply Latest reply on Mar 19, 2014 10:06 AM by Felipe Alves

    Arquillian + JPA + Glassfish

    Leonardo Ribeiro Newbie

      Hi all,

       

      I have a test project with Arquillian jpa (actually the tutorial of the project site).

      Everything runs without error, but if I put as dependence (in pom.xml) a project that uses glassfish (picture attached) and run the test class as "Junit Test" I get the following error:

       

      PS: If you run the command "Run as -> Maven test" the error does not occur.

       

       

      java.lang.RuntimeException: Could not setup GlassFish Embedded Runtime

        at org.jboss.arquillian.container.glassfish.embedded_3_1.GlassFishContainer.setup(GlassFishContainer.java:151)

        at org.jboss.arquillian.container.glassfish.embedded_3_1.GlassFishContainer.setup(GlassFishContainer.java:67)

        at org.jboss.arquillian.container.impl.ContainerImpl.setup(ContainerImpl.java:181)

        at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$7.perform(ContainerLifecycleController.java:149)

        at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$7.perform(ContainerLifecycleController.java:145)

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

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

        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.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        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.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)

        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.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

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

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

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

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

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

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

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

        at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.setupContainers(ContainerLifecycleController.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.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        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:135)

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

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

        at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:85)

        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.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        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.createSuiteContext(TestContextHandler.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.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

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

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

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

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

        at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:97)

        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: org.glassfish.embeddable.GlassFishException: A MultiException has 2 exceptions.  They are:

      1. java.lang.IllegalArgumentException: The scope name given in the descriptor (org.glassfish.hk2.api.PerLookup) did not match the scope annotation on the class (javax.inject.Singleton) in class CommandExecutorImpl

      2. java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor(

        implementation=com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl

        contracts={com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl,org.glassfish.embeddable.CommandRunner}

        scope=org.glassfish.hk2.api.PerLookup

        qualifiers={}

        descriptorType=CLASS

        descriptorVisibility=NORMAL

        metadata=

        rank=0

        loader=org.glassfish.hk2.bootstrap.impl.Hk2LoaderPopulatorPostProcessor$1@1230afa

        proxiable=null

        analysisName=null

        id=666

        locatorId=0

        identityHashCode=27642797

        reified=false)

       

       

        at com.sun.enterprise.glassfish.bootstrap.StaticGlassFishRuntime.newGlassFish(StaticGlassFishRuntime.java:138)

        at org.jboss.arquillian.container.glassfish.embedded_3_1.GlassFishContainer.setup(GlassFishContainer.java:147)

        ... 62 more

      Caused by: A MultiException has 2 exceptions.  They are:

      1. java.lang.IllegalArgumentException: The scope name given in the descriptor (org.glassfish.hk2.api.PerLookup) did not match the scope annotation on the class (javax.inject.Singleton) in class CommandExecutorImpl

      2. java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor(

        implementation=com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl

        contracts={com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl,org.glassfish.embeddable.CommandRunner}

        scope=org.glassfish.hk2.api.PerLookup

        qualifiers={}

        descriptorType=CLASS

        descriptorVisibility=NORMAL

        metadata=

        rank=0

        loader=org.glassfish.hk2.bootstrap.impl.Hk2LoaderPopulatorPostProcessor$1@1230afa

        proxiable=null

        analysisName=null

        id=666

        locatorId=0

        identityHashCode=27642797

        reified=false)

       

       

        at org.jvnet.hk2.internal.Collector.throwIfErrors(Collector.java:84)

        at org.jvnet.hk2.internal.Utilities.handleErrors(Utilities.java:402)

        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetDescriptor(ServiceLocatorImpl.java:973)

        at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:576)

        at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:566)

        at com.sun.enterprise.glassfish.bootstrap.ConfiguratorImpl.configure(ConfiguratorImpl.java:70)

        at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.configure(GlassFishImpl.java:71)

        at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.<init>(GlassFishImpl.java:65)

        at com.sun.enterprise.glassfish.bootstrap.StaticGlassFishRuntime$1.<init>(StaticGlassFishRuntime.java:115)

        at com.sun.enterprise.glassfish.bootstrap.StaticGlassFishRuntime.newGlassFish(StaticGlassFishRuntime.java:115)

        ... 63 more

      Caused by: java.lang.IllegalArgumentException: The scope name given in the descriptor (org.glassfish.hk2.api.PerLookup) did not match the scope annotation on the class (javax.inject.Singleton) in class CommandExecutorImpl

        at org.jvnet.hk2.internal.SystemDescriptor.internalReify(SystemDescriptor.java:700)

        at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:596)

        at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:373)

        at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:1769)

        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetDescriptor(ServiceLocatorImpl.java:926)

        ... 70 more