4 Replies Latest reply on Mar 31, 2011 2:59 AM by jaikiran

    ejb injection

    rop

      Hi,

       

      I have a simple ear-app, with an no-interface-view EJB annotated with

          @Stateless(name="xxx")

      and a web-app that injects it with

          @EJB(name="xxx")

       

      This works fine when I deploy it in a single ear-file, with a war-file and an ejb-jar packed inside it.

       

      But if I just try to deploy the ejb-jar and war-file as two separate files, the web-app complaints:

       

      Deployment "..." is in error due to the following reason(s): java.lang.RuntimeException: Could not resolve @EJB reference: [EJB Reference: beanInterface ...

      ....etc...

       

      What do I need to do to make this work -- i.e. inject an EJB from a separate jar-file into a web-app in a different war-file?

       

      They are both on the same JBoss 6 instance.

       

      /BR

        • 1. ejb injection
          jaikiran
          • 2. ejb injection
            rop

            Thanks, Jaikiran, for the jira-link!

             

            Yes, I replaced

                 @EJB(name="xxx")

            with

                 @EJB(mappedName="xxx/local")

            and that worked

             

            /BR

            1 of 1 people found this helpful
            • 3. ejb injection
              rop

              I just noticed though, when deploying the web-app, I get a warning in the server-log :

               

              23:23:56,531 WARN  [org.jboss.deployment.MappedReferenceMetaDataResolverDeployer]

              Unresolved references exist in JBossWebMetaData:

                [#web-app:AnnotatedEJBReferenceMetaData

                 {name=........., mapped/jndi-name=xxx/local,resolved-jndi-name=null,beanInterface=......},

               

              But the application still works.

               

              Any ideas about that warning?

              • 4. ejb injection
                jaikiran

                I think you can ignore that warning. It's probably logging that warning because the EJB which belongs to a different app isn't yet deployed when the processing is happening. I guess it's safe to ignore it.