1 2 Previous Next 19 Replies Latest reply on Oct 11, 2013 5:35 AM by can kesen

    Cannot inject EJB using Arquillian

    can kesen Newbie

      Hey, I have a simple test example where i want to inject an ejb using Arquillian. However, the object will not be injected...

       

       

      my classes

       

       

      @Local

      public interface BussinessApiTest {

         

          public String getText();

       

      }

       

      @Stateless

      public class BussinessImplTest implements BussinessApiTest {

       

          /* (non-Javadoc)

           * @see com.agfa.orbis.ws.hl7validation.business.api.BussinessApiTest#getText()

           */

          @Assessable

          @Override

          public String getText() {

              return "<test>my text</test>";

          }

       

      }

       

       

      Test


      @RunWith(Arquillian.class)

      public class PipeFileDAOTest {

        @Deployment

          public static JavaArchive createDeployment(){

              return ShrinkWrap.create(JavaArchive.class, "orbis-hl7validation-business-impl.jar")

                      .addClass(BussinessApiTest.class)

                      .addClass(BussinessImplTest.class)

                      .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

                     

          }

       

          @EJB

          BussinessApiTest test;

       

       

          @Test

          public void test(){

              System.out.println(test.getText());

          }

       

       

      And pom


       

        <dependencyManagement>

          <dependencies>

            <dependency>

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

              <artifactId>arquillian-bom</artifactId>

              <version>1.1.1.Final</version>

              <scope>import</scope>

              <type>pom</type>

            </dependency>

          </dependencies>

        </dependencyManagement>

       

      <!-- Arquillian dependencies -->
      <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <scope>test</scope>
      </dependency>

       

      <dependency>
        <groupId>org.jboss.arquillian.container</groupId>
        <artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
        <scope>test</scope>
      </dependency>

       

       

      <dependency>
        <groupId>org.jboss.weld</groupId>
        <artifactId>weld-core</artifactId>
        <scope>test</scope>
      </dependency>

       

      <dependency>
        <groupId>org.jboss.arquillian.container</groupId>
        <artifactId>arquillian-container-spi</artifactId>
      </dependency>

       

       

       

      Any ideas?

        • 1. Re: Cannot inject EJB using Arquillian
          Bartosz Majsak Master

          Hi Can,

           

          as in Weld EE Embedded EJBs are treated as managed beans maybe you can try to @Inject instead of @EJB in your test? In general I would rather go with some EJB-capable container rather than mocked EE environment. So if @Inject fails too that might be the Weld EE Embedded container adapter problem. Can you share the logs if any?

           

          Cheers,

          Bartosz

          • 2. Re: Cannot inject EJB using Arquillian
            can kesen Newbie

            Hi Bartosz,

             

            I have tried it with @Inject but it also does not work. I dont get any errors, but my object is null, it will not be initialized... Which  container would you suggest (EJB-capable) ? I am really new to Arquillian enviroment, i need to test more complex ejbs..this was just an example, so i would appriciate if you could tell me what to use.

             

            Thanks in advance!

             

            Cheers, Can

            • 3. Re: Cannot inject EJB using Arquillian
              Bartosz Majsak Master

              If you can share this simple example through GitHub I will have a look.

               

              With regards to testing more complex ejbs I would suggest trying containers such as JBoss AS 7 or TomEE. In managed mode they are damn easy to use (and bootstrap is really fast). If you need some pointers how to set them up just ping me,

               

              Cheers,

              Bartosz

              • 4. Re: Cannot inject EJB using Arquillian
                can kesen Newbie

                Hey Bartosz,

                 

                The project runs on Jboss AS 7.2  and all beans are local and stateless or singleton. I tried using the managed container for Arquillian tests

                 

                <dependency>

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

                      <artifactId>arquillian-jbossas-managed-5.1</artifactId>

                      <version>1.0.0.CR3</version>

                    </dependency>

                 

                I get the following Exception:

                 

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

                Running com.agfa.orbis.ws.hl7validation.business.impl.DAO.PipeFileDAOTest

                Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.577 sec <<< FA

                ILURE!

                com.agfa.orbis.ws.hl7validation.business.impl.DAO.PipeFileDAOTest  Time elapsed:

                0.576 sec  <<< ERROR!

                java.lang.RuntimeException: Could not create new instance of class org.jboss.arq

                uillian.test.impl.EventTestRunnerAdaptor

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

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

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

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

                        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2483)

                        at java.lang.Class.getConstructor0(Class.java:2793)

                        at java.lang.Class.getDeclaredConstructor(Class.java:2043)

                        at org.jboss.arquillian.core.impl.loadable.SecurityActions$1.run(Securit

                yActions.java:182)

                        at org.jboss.arquillian.core.impl.loadable.SecurityActions$1.run(Securit

                yActions.java:179)

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

                        at org.jboss.arquillian.core.impl.loadable.SecurityActions.getConstructo

                r(SecurityActions.java:178)

                        at org.jboss.arquillian.core.impl.loadable.SecurityActions.newInstance(S

                ecurityActions.java:152)

                        at org.jboss.arquillian.core.impl.loadable.ServiceRegistryLoader.createS

                erviceInstance(ServiceRegistryLoader.java:103)

                        at org.jboss.arquillian.core.impl.loadable.ServiceRegistryLoader.all(Ser

                viceRegistryLoader.java:55)

                        at org.jboss.arquillian.core.impl.loadable.ServiceRegistryLoader.onlyOne

                (ServiceRegistryLoader.java:67)

                        at org.jboss.arquillian.container.impl.client.container.ContainerRegistr

                yCreator.createRegistry(ContainerRegistryCreator.java:97)

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

                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

                java:57)

                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

                sorImpl.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(Event

                ContextImpl.java:99)

                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextI

                mpl.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.ManagerImpl.bindAndFire(ManagerImpl.ja

                va:236)

                        at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:74)

                 

                        at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loa

                dConfiguration(ConfigurationRegistrar.java:60)

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

                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

                java:57)

                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

                sorImpl.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(Event

                ContextImpl.java:99)

                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextI

                mpl.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.ManagerImpl.start(ManagerImpl.java:261

                )

                        at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTes

                tRunnerAdaptor.java:56)

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

                 

                        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct

                orAccessorImpl.java:57)

                        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC

                onstructorAccessorImpl.java:45)

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

                        at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityAct

                ions.java:156)

                        at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityAct

                ions.java:111)

                        at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityAct

                ions.java:97)

                        at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunn

                erAdaptorBuilder.java:52)

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

                        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provide

                r.java:264)

                        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4

                Provider.java:153)

                        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider

                .java:124)

                 

                 

                and updated the class names

                 

                @Stateless

                @Local(BussinessApiTest.class)

                public class BussinessApiTestBean implements BussinessApiTest  {

                 

                    /* (non-Javadoc)

                     * @see com.agfa.orbis.ws.hl7validation.business.api.BussinessApiTest#getText()

                     */

                    @Assessable

                    @Override

                    public String getText() {

                        return "<test>my text</test>";

                    }

                 

                }

                 

                 

                /**

                * @author AXRFV

                *

                */

                @Local

                public interface BussinessApiTest {

                   

                    public String getText();

                 

                }

                 

                and the test

                 

                @Deployment
                public static JavaArchive createDeployment(){
                    return ShrinkWrap.create(JavaArchive.class)
                            .addClass(BussinessApiTest.class)
                            .addClass(BussinessApiTestBean.class)
                            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
                          
                }

                 

                   

                  

                @EJB
                BussinessApiTest test;
                //private final static String fileName="ORR_Siemens.hl7";

                 

                   

                @Test
                public void test(){
                    System.out.println(test.getText());
                }

                 

                 

                the arquillian dependencies in pom

                 

                <dependencyManagement>

                    <dependencies>

                      <dependency>

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

                        <artifactId>arquillian-bom</artifactId>

                        <version>1.1.1.Final</version>

                        <scope>import</scope>

                        <type>pom</type>

                      </dependency>

                    </dependencies>

                  </dependencyManagement>

                 

                <!-- Arquillian dependencies -->

                    <dependency>

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

                      <artifactId>arquillian-junit-container</artifactId>

                      <scope>test</scope>

                    </dependency>

                 

                   <dependency>

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

                      <artifactId>arquillian-jbossas-managed-5.1</artifactId>

                      <version>1.0.0.CR3</version>

                    </dependency>

                • 5. Re: Cannot inject EJB using Arquillian
                  Bartosz Majsak Master

                  Hmm... is there any particular reason why you picked arquillian-jbossas-managed-5.1 ? 5.1 is for JBoss 5.1 I believe.

                  Please have a look at my setup here [might require some deps updated if you wanna use 7.2 for testing too, but it illustrates the general idea for AS 7.x managed container adapter setup]

                  Here's corresponding arquillian.xml

                   

                  Maybe this will make it easier.

                   

                  Cheers,

                  Bartosz

                  • 6. Re: Cannot inject EJB using Arquillian
                    can kesen Newbie

                    Ive tried 7.0.2 and 7.2 and i get the same error.. which dependencies and configuration do i need to make to run a stateless local ejb with an interface at least?

                    • 7. Re: Cannot inject EJB using Arquillian
                      Bartosz Majsak Master

                      Can you share this simple project somehow so I can run it and reproduce?

                      • 8. Re: Cannot inject EJB using Arquillian
                        can kesen Newbie

                        Hi Bartosz,

                         

                        Well the problem is: i do not have any simple project..i just created this 2 simple ejbs to test the Arquillian.

                         

                        I get now the following error. I think it cannot find the standalone.xml

                         

                        which folder exactly must be given as Jboss home?

                         

                        i have currently  <property name="jbossHome">C:/Agfa/jboss-as</property>

                         

                        and the standalone.xml is in /standalone/configuration/orbis-as-standalone.xml

                         

                        we have a self configured one..

                         

                        Running com.agfa.orbis.ws.hl7validation.business.impl.DAO.PipeFileDAOTest

                        Okt 10, 2013 1:10:30 PM org.jboss.as.arquillian.container.managed.ManagedDeploya

                        bleContainer startInternal

                        INFO: Starting container with: ["C:\Program Files (x86)\Java\jdk1.7.0_25\bin\jav

                        a", -Xmx512m, -XX:MaxPermSize=128m, -ea, -Djboss.home.dir=C:/Agfa/jboss-as, -Dor

                        g.jboss.boot.log.file=C:\Agfa\jboss-as\standalone\log\boot.log, -Dlogging.config

                        uration=file:/C:/Agfa/jboss-as/standalone/configuration/logging.properties, -Djb

                        oss.bundles.dir=C:/Agfa/jboss-as\bundles, -jar, C:\Agfa\jboss-as\jboss-modules.j

                        ar, -mp, C:/Agfa/jboss-as\modules, -jaxpmodule, javax.xml.jaxp-provider, org.jbo

                        ss.as.standalone, -server-config, standalone.xml]

                        13:10:31,654 INFO  [org.jboss.modules] (main) JBoss Modules version 1.2.0.CR1

                        13:10:32,149 ERROR [stderr] (main) java.lang.IllegalStateException: JBAS014805:

                        Could not get main file: standalone.xml. Specified files must be relative to the

                        configuration dir: C:\Agfa\jboss-as\standalone\configuration

                        13:10:32,149 ERROR [stderr] (main)      at org.jboss.as.controller.persistence.C

                        onfigurationFile.determineMainFile(ConfigurationFile.java:168)

                        13:10:32,150 ERROR [stderr] (main)      at org.jboss.as.controller.persistence.C

                        onfigurationFile.<init>(ConfigurationFile.java:95)

                        13:10:32,150 ERROR [stderr] (main)      at org.jboss.as.server.ServerEnvironment

                        .<init>(ServerEnvironment.java:390)

                        13:10:32,150 ERROR [stderr] (main)      at org.jboss.as.server.Main.determineEnv

                        ironment(Main.java:258)

                        13:10:32,150 ERROR [stderr] (main)      at org.jboss.as.server.Main.main(Main.ja

                        va:88)

                        13:10:32,151 ERROR [stderr] (main)      at sun.reflect.NativeMethodAccessorImpl.

                        invoke0(Native Method)

                        13:10:32,151 ERROR [stderr] (main)      at sun.reflect.NativeMethodAccessorImpl.

                        invoke(NativeMethodAccessorImpl.java:57)

                        13:10:32,151 ERROR [stderr] (main)      at sun.reflect.DelegatingMethodAccessorI

                        mpl.invoke(DelegatingMethodAccessorImpl.java:43)

                        13:10:32,152 ERROR [stderr] (main)      at java.lang.reflect.Method.invoke(Metho

                        d.java:606)

                        13:10:32,152 ERROR [stderr] (main)      at org.jboss.modules.Module.run(Module.j

                        ava:262)

                        13:10:32,152 ERROR [stderr] (main)      at org.jboss.modules.Main.main(Main.java

                        :329)

                        Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 7.366 sec <<< FA

                        ILURE!

                        com.agfa.orbis.ws.hl7validation.business.impl.DAO.PipeFileDAOTest  Time elapsed:

                        7.365 sec  <<< ERROR!

                        org.jboss.arquillian.container.spi.client.container.LifecycleException: Could no

                        t start container

                                at org.jboss.as.arquillian.container.managed.ManagedDeployableContainer.

                        startInternal(ManagedDeployableContainer.java:176)

                                at org.jboss.as.arquillian.container.CommonDeployableContainer.start(Com

                        monDeployableContainer.java:110)

                                at org.jboss.arquillian.container.impl.ContainerImpl.start(ContainerImpl

                        .java:199)

                                at org.jboss.arquillian.container.impl.client.container.ContainerLifecyc

                        leController$8.perform(ContainerLifecycleController.java:163)

                                at org.jboss.arquillian.container.impl.client.container.ContainerLifecyc

                        leController$8.perform(ContainerLifecycleController.java:157)

                                at org.jboss.arquillian.container.impl.client.container.ContainerLifecyc

                        leController.forContainer(ContainerLifecycleController.java:255)

                                at org.jboss.arquillian.container.impl.client.container.ContainerLifecyc

                        leController.startContainer(ContainerLifecycleController.java:156)

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

                                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

                        java:57)

                                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

                        sorImpl.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(Event

                        ContextImpl.java:99)

                                at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextI

                        mpl.java:81)

                                at org.jboss.arquillian.container.impl.client.ContainerDeploymentContext

                        Handler.createContainerContext(ContainerDeploymentContextHandler.java:57)

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

                                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

                        java:57)

                                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

                        sorImpl.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(EventContextI

                        mpl.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.ContainerLifecyc

                        leController$2.perform(ContainerLifecycleController.java:77)

                                at org.jboss.arquillian.container.impl.client.container.ContainerLifecyc

                        leController$2.perform(ContainerLifecycleController.java:70)

                                at org.jboss.arquillian.container.impl.client.container.ContainerLifecyc

                        leController.forEachSuiteContainer(ContainerLifecycleController.java:221)

                                at org.jboss.arquillian.container.impl.client.container.ContainerLifecyc

                        leController.startSuiteContainers(ContainerLifecycleController.java:69)

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

                                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

                        java:57)

                                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

                        sorImpl.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(Event

                        ContextImpl.java:99)

                                at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextI

                        mpl.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.ContainerEventControl

                        ler.execute(ContainerEventController.java:86)

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

                                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

                        java:57)

                                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

                        sorImpl.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(Event

                        ContextImpl.java:99)

                                at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextI

                        mpl.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(DelegatingMethodAcces

                        sorImpl.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(EventContextI

                        mpl.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(Eve

                        ntTestRunnerAdaptor.java:68)

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

                                at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provide

                        r.java:264)

                                at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4

                        Provider.java:153)

                                at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider

                        .java:124)

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

                                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

                        java:57)

                                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

                        sorImpl.java:43)

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

                                at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2

                        (ReflectionUtils.java:208)

                                at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke

                        (ProviderFactory.java:159)

                                at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(Provi

                        derFactory.java:87)

                                at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(Fork

                        edBooter.java:153)

                                at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:

                        95)

                        • 9. Re: Cannot inject EJB using Arquillian
                          Bartosz Majsak Master

                          Can you share the output of

                          1. mvn dependency:tree
                          2. server log

                           

                          can be attached as files

                          • 10. Re: Cannot inject EJB using Arquillian
                            can kesen Newbie

                            and after giving the servcerConfig as

                             

                            <property name="serverConfig">C:/Agfa/jboss-as/standalone/configuration/orbis-as-standalone.xml</property> 

                              <property name="jbossHome">C:/Agfa/jboss-as</property>

                             

                            i get the error

                             

                            13:35:20,062 INFO  [org.jboss.modules] (main) JBoss Modules version 1.2.0.CR1

                            13:35:20,216 ERROR [stderr] (main) java.lang.IllegalStateException: JBAS014805: Could not get main file: C:/Agfa/jboss-as/standalone/configuration/orbis-as-standalone.xml. Specified files must be relative to the configuration dir: C:\Agfa\jboss-as\standalone\configuration

                             

                            13:35:20,216 ERROR [stderr] (main)     at org.jboss.as.controller.persistence.ConfigurationFile.determineMainFile(ConfigurationFile.java:168)

                             

                            13:35:20,216 ERROR [stderr] (main)     at org.jboss.as.controller.persistence.ConfigurationFile.<init>(ConfigurationFile.java:95)

                             

                            13:35:20,217 ERROR [stderr] (main)     at org.jboss.as.server.ServerEnvironment.<init>(ServerEnvironment.java:390)

                             

                            13:35:20,217 ERROR [stderr] (main)     at org.jboss.as.server.Main.determineEnvironment(Main.java:258)

                             

                            13:35:20,217 ERROR [stderr] (main)     at org.jboss.as.server.Main.main(Main.java:88)

                             

                            13:35:20,218 ERROR [stderr] (main)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                             

                            13:35:20,218 ERROR [stderr] (main)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                             

                            13:35:20,218 ERROR [stderr] (main)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                             

                            13:35:20,218 ERROR [stderr] (main)     at java.lang.reflect.Method.invoke(Method.java:606)

                             

                            13:35:20,219 ERROR [stderr] (main)     at org.jboss.modules.Module.run(Module.java:262)

                             

                            13:35:20,219 ERROR [stderr] (main)     at org.jboss.modules.Main.main(Main.java:329)

                            • 11. Re: Cannot inject EJB using Arquillian
                              Bartosz Majsak Master

                              Hmm... problem with / and \ ?

                              • 12. Re: Cannot inject EJB using Arquillian
                                can kesen Newbie

                                Hey Bartosz!

                                 

                                i just used this config

                                 

                                <property name="serverConfig">orbis-as-standalone.xml</property> 

                                  <property name="jbossHome">C:/Agfa/jboss-as</property>

                                 

                                and it works now. Starts the server and deploys what i give in Arquillian test. Ihope it works also with other EJBs.

                                 

                                Thank you for your help!

                                • 13. Re: Cannot inject EJB using Arquillian
                                  Bartosz Majsak Master

                                  Right, I read the error msg wrong Need more coffee.

                                  tumblr_inline_mi4kg4bSDR1qz4rgp.gif

                                  Let me know if anything else is needed. I'm here to help.

                                  • 14. Re: Cannot inject EJB using Arquillian
                                    can kesen Newbie

                                    Hey Bartosz!

                                     

                                    Me again heh. I have another problem.. i get the following error when trying to resolve my pom.xml since there are 3rd party dependencies in my classes. How can i overcome this?

                                    Thanks in advance!

                                     

                                    @Deployment

                                        public static WebArchive createDeployment(){

                                     

                                     

                                            //       

                                            WebArchive archive=ShrinkWrap.create(WebArchive.class, "business-impl.war")

                                            .addClass(JEE6ConnectionHelper.class)

                                            .addClass(ConnectionFactory.class)

                                            .addClass(ConfigurationService.class)

                                            .addClass(IPipeFileDAO.class)

                                            .addClass(PipeFileDAO.class)       

                                            .addClass(HL7Utils.class)

                                            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")

                                            .addAsResource("hl7validation.properties");

                                     

                                            File[] deps= Maven.resolver().loadPomFromClassLoaderResource("pom.xml").importRuntimeAndTestDependencies()

                                                    .resolve().withTransitivity().asFile();

                                     

                                            for (int i = 0; i < deps.length; i++) {

                                                archive.addAsLibraries(deps[i]);

                                            }

                                           

                                            return archive;

                                        }

                                     

                                     

                                     

                                    java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.WebArchive com.agfa.orbis.ws.hl7validation.business.impl.DAO.FileDAOTest.createDeployment()

                                        at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:177)

                                        at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generateDeployment(AnnotationDeploymentScenarioGenerator.java:99)

                                        at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generate(AnnotationDeploymentScenarioGenerator.java:62)

                                        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:79)

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

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

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

                                        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.createClassContext(TestContextHandler.java:75)

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

                                        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.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:601)

                                        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.beforeClass(EventTestRunnerAdaptor.java:80)

                                        at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:182)

                                        at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)

                                        at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)

                                        at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)

                                        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)

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

                                        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.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:601)

                                        at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:173)

                                        ... 50 more

                                    Caused by: java.lang.IllegalArgumentException: pom.xml doesn't exist or can't be accessed on from sun.misc.Launcher$AppClassLoader@8e918a

                                        at org.jboss.shrinkwrap.resolver.impl.maven.util.Validate.notNull(Validate.java:46)

                                        at org.jboss.shrinkwrap.resolver.impl.maven.util.FileUtil.fileFromClassLoaderResource(FileUtil.java:43)

                                        at org.jboss.shrinkwrap.resolver.impl.maven.task.LoadPomTask.loadPomFromClassLoaderResource(LoadPomTask.java:74)

                                        at org.jboss.shrinkwrap.resolver.impl.maven.task.LoadPomTask.loadPomFromClassLoaderResource(LoadPomTask.java:66)

                                        at org.jboss.shrinkwrap.resolver.impl.maven.task.LoadPomTask.loadPomFromClassLoaderResource(LoadPomTask.java:61)

                                        at org.jboss.shrinkwrap.resolver.impl.maven.PomlessResolveStageBaseImpl.loadPomFromClassLoaderResource(PomlessResolveStageBaseImpl.java:106)

                                        at org.jboss.shrinkwrap.resolver.impl.maven.MavenResolverSystemBaseImpl.loadPomFromClassLoaderResource(MavenResolverSystemBaseImpl.java:204)

                                        at com.agfa.orbis.ws.hl7validation.business.impl.DAO.FileDAOTest.createDeployment(FileDAOTest.java:63)

                                        ... 55 more

                                    1 2 Previous Next