3 Replies Latest reply on Jan 21, 2014 6:15 AM by nschweig

    Local ejb lookup from another ear on same JBoss 7.1.1.

    nschweig

      Hi,

       

      I am a little bit confused about EJB invocation.

      I have got two separate EAR-files on my JBoss 7.1.1. One EAR contains ejbs that I want to use from the other EAR (from the web project in it).

       

      Is the best way to grant the access to have a local interface for my ejb in EAR1?

      If yes - how can I make the lookup? How is the jboss-ejb-client.properties defined?

       

      Thanks a lot.

      Nicole

        • 1. Re: Local ejb lookup from another ear on same JBoss 7.1.1.
          sergiu_pienar

          Your EJB should hold something like:

          @LocalBinding(jndiBinding = "java:global/<deploymentName>/BeanName!<fullyQualifiedBeanName>Local")

           

          More on this topic, here: Remote EJB invocations via JNDI - EJB client API or remote-naming project - JBoss AS 7.1 - Project Documentation Editor

          • 2. Re: Local ejb lookup from another ear on same JBoss 7.1.1.
            wdfink

            An Example is better than 1000 words

            You might have a look to the ejb-multi-server quickstart the app-web will invoke ejb's deployed on different servers, the app-main do it local from a JSF application.

            If you use a remote-interface you are able to decide whether you deploy it local or remote, you might need additional configuration to prevent from local serialization if wanted.

            A local-interface can only do in-vm invocations so you need to have the 'foreign' app deployed to the same server.

             

            hope that helps

            • 3. Re: Local ejb lookup from another ear on same JBoss 7.1.1.
              nschweig

              Hello

              and thanks for your answers.

              I took a look in ejb-multi-server quickstart. I only tested the ejb lookup from the web project to the ejb project and it works. I placed both (the app-main-ejb and app-main-web project into one EAR) And this is the difference to my project!

               

              I have 2 different EAR´s in one server and so the lookup does not work.

               

              Here is the error that occurs:

               

                New missing/unsatisfied dependencies:      service jboss.naming.context.java.module.RoleManager.RoleManagerWeb.env.ejb:IDMService.IDMServiceEJB."LdapService!de.thm.mnd.idmservice.ldapIntegration.ejb.LdapServiceRemote" (missing) dependents: [service jboss.naming.context.java.module.RoleManager.RoleManagerWeb.env."de.thm.mnd.roleManagement.jsf.PersonSearchBean".ldapService]

               

              At the end there is another message:

              newly corrected services:

                    service jboss.naming.context.java.module.RoleManager.RoleManagerWeb.env.ejb:IDMService.IDMServiceEJB."LdapService!de.thm.mnd.idmservice.ldapIntegration.ejb.LdapServiceRemote" (new available)

               

              I tried the lookup similar to the notation you did the lookup for bean MainEjbClient34AppBean.

               

              Here´s the structure of my project:


              IDMService (EAR)

              - IDMServiceEJB (EJBModule)

                   - de.thm.mnd.idmservice.ldapIntegration.ejb

                            -LdapService (Bean)

                            -LdapServiceRemote (Interface)


              Second EAR:

              Rolemanager (EAR)

              - RoleManagerEJB

              - RoleManagerWeb

                   - de.thm.mnd.roleManagement.jsf

                        - PersonSearchBean (JSF Managed Bean)


              The PersonSearchBean in the RoleManagerWeb wants to do the lookup in this way


              @Resource(mappedName="ejb:IDMService/IDMServiceEJB/LdapService!de.thm.mnd.idmservice.ldapIntegration.ejb.LdapServiceRemote")

                  LdapServiceRemote ldapService;

              )


              The RoleManagerWeb project contains the jboss-client.jar. The IDMServiceEJB contains the jboss-ejb-client.xml in the src-folder.


              Do you have any ideas?

              Thanks a lot!!

              Bye Nicole