3 Replies Latest reply on Jun 20, 2013 2:17 PM by flaviomattos86

    Does Arquillian support double EJB injection?

    flaviomattos86

      Hi folks!

       

      Considering the following scenario:

       

      I have two ejb projects. The first ejb project does access the database. The second ejb project is responsible for the business rules and injects the first with @EJB annotation. I´d like to know if Arquillian supports that;

       

      Thanks

        • 1. Re: Does Arquillian support double EJB injection?
          bmajsak

          That should work without any problems, as you basically deploy it to the container which handles EJBs. Just remember package your test deployment properly (similar to what you do for the real archive)

          • 2. Re: Does Arquillian support double EJB injection?
            flaviomattos86

            Hi Bartosz, thank you for your reply.

             

            I have tried to do what I asked in the beginning but I am facing a weird problem:

            I am using embedded glassfish (arquillian-glassfish-embedded-3.1, version 1.0.0.CR3 and glassfish-embedded-all, version 3.1.2) to inject my ejbs, but I get a NamingException.

            Arquillian tries to lookup my ejbs with the name java:comp/env/br.com.flavio.arquillian.test.TestArquillian/testEAO but in the eclipse console I could see that glassfish has different names for my ejb:

                

            java:global/test/TestEAOImpl!com.flavio.test.eao.TestEAORemote, java:global/test/TestEAOImpl!com.flavio.test.eao.TestEAOLocal

            com.flavio.test.eao.TestEAORemote, com.flavio.test.eao.TestEAORemote#com.flavio.test.eao.TestEAORemote

             

            I can not understand that, because I am not using mappedName property in any annotation, I mean I am just using @Local, @Remote, @Stateless and @EJB without any attribute in these annotations

             

            What am I doing wrong? Am I missing some configuration?

             

             

            Thanks

            • 3. Re: Does Arquillian support double EJB injection?
              flaviomattos86

              Actually I have the answer for my question..

              The problem was that I was trying to inject the local interface with @EJB annotation. Now I inject the remote interface and everything works!

               

              @EJB

              TestEJBRemote testEJBRemote;

               

              Thanks