4 Replies Latest reply on Apr 15, 2013 11:29 AM by fpezzati

    Modules dependencies problems

    fpezzati Newbie

      Hello,

       

      I got a couple of .jar, say EasyEjbNode1.jar and EasyEjbNode2.jar. EasyEjbNode1.jar wants to invoke a session bean from EasyEjbNode2.jar, which has been, previously, succesfully deployed. Here is the code of the session bean, in EasyEjbNode1, who want to invoke the session bean from EasyEjbNode2:

       

      package edu.pezzati.node1;

       

      import java.util.Properties;

       

      import javax.ejb.EJB;

      import javax.ejb.Stateless;

      import javax.naming.Context;

      import javax.naming.InitialContext;

      import javax.naming.NamingException;

       

      import edu.pezzati.node2.RemoteNode2;

       

      @Stateless

      public class SessionNode1 implements RemoteNode1 {

         

          @EJB(name="java:global/SessionNode2!edu.pezzati.node2.RemoteNode2")

          RemoteNode2 rn2;

       

          @Override

          public String getNodeName() {

              return "node1 ";

          }

       

          @Override

          public String getRemoteNodeName() {

                  return "node1 "+rn2.getNodeName();

          }

      }

       

      and here is the content of EasyEjbNode1.jar/META-INF/MANIFEST.MF:

       

      Manifest-Version: 1.0

      Dependencies: deployment.EasyEjbNode2.jar

       

      Sadly, something goes wrong:

       

      10:40:04,725 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."EasyEjbNode1.jar".INSTALL: org.jbos

      .msc.service.StartException in service jboss.deployment.unit."EasyEjbNode1.jar".INSTALL: Failed to process phase INSTALL of deployment "EasyEjbNode1.jar"

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]

              at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS014544: No EJB found with interface of type 'edu.pezzati.node2.RemoteNode2' for bind

      ng java:global/EasyEjbNode2/SessionNode2!edu.pezzati.node2.RemoteNode2

              at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:88)

              at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:249)

              at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:194)

              at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)

              at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:162)

              at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:155)

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

              ... 5 more

       

       

      I attached the entire stack trace I receive when I deploy the two jars. In the attached .zip file there are sources and jars about EasyEjbNode1 and EasyEjbNode2. I can't guess what is going wrong. TIA.

       

      Francesco

        • 1. Re: Modules dependencies problems
          Stephen Coy Master

          If the intention is to deploy EasyEjbNode1.jar and EasyEjbNode2.jar in different servers then EasyEjbNode1.jar requires a copy of RemoteNode2.class to be included in the jar.

           

          If these classes are intended to be deployed together in the same server, then you should place both classes in the same jar and use @Local instead of @Remote.

          In this case the name attribute in your @EJB reference will then become redundant as well.

          • 2. Re: Modules dependencies problems
            fpezzati Newbie

            Hello,

             

            I'm pretty new with JBoss 7. I'm trying to figure out how my ejbs could use third part ejb. In my scenario, EasyEjbNode2.jar is a third part jar which contains some services I need to use from my ejbs.

             

            Francesco

            • 3. Re: Modules dependencies problems
              fpezzati Newbie

              Hello Stephen,

               

              is there a way to inject ejbs from an already deployed jar into my ejbs, situated in a different jar? Dependencies are succesfully satisfied by jboss-deployment-structure.xml file, in fact I can instantiate the bean (.. = new SessionNode2(); ..), but, I can't inject it 'cause of a JNDI lookup error on deploy. Is, only, my JNDI lookup string wrong? What did I miss? Or maybe I misunderstood something more important? Thanks.

              • 4. Re: Modules dependencies problems
                fpezzati Newbie

                I managed by myself. The problem was just a stupid mistake. Replace

                 

                @EJB(name="java:global/SessionNode2!edu.pezzati.node2.RemoteNode2")

                 

                with

                 

                @EJB(lookup="java:global/SessionNode2!edu.pezzati.node2.RemoteNode2")

                 

                this works for me. I can succesfully invoke SessionNode2's services from SessionNode1, which is placed in a different jar.