1 Reply Latest reply on Mar 11, 2014 12:37 PM by Bharadwaj Narasimha

    ejb lookup from an outside war

    Bharadwaj Narasimha Newbie

      I have a EJB JAR which deploys okay. I can see the following JNDI bindings on stdout -


      [0m [0m17:27:00,205 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named HelloServiceBean in deployment unit deployment "helloservice.jar" are as follows:






      I see the same binding on my management console for JNDI, which are -





      Am trying to lookup this EJB from a WAR. The EJB-Jar and WAR are NOT part of single EAR. I want both to be deployed separately. Now, I have tried looking up both the above JNDI names but the lookup does not succeed. The code -


             @EJB(lookup = "java:global/helloservice/HelloServiceBean!javaeetutorial.helloservice.ejb.HelloService")

          private HelloService helloservice;


          @EJB(lookup = "java:app/helloservice/HelloServiceBean!javaeetutorial.helloservice.ejb.HelloService")

          private HelloService anotherhelloservice;


      While trying to fix the problem, I found that on my management-console, for the EJB-JAR the subsytem dependencies are listed as ejb3, undertow and webservices. But for my WAR, the subsystem dependencies are listed as jpa, undertow and webservices. So I thought I needed to add EJB3 as a subsystem dependency to my WAR - to do so I put a near blank ejb-jar.xml in my WEB-INF of the WAR. My WAR does not have any beans - I just want to lookup. Do I need ejb3 subsystem listed as dependency for a WAR which does only lookups? How can I do that? Where is my understanding/implementation broken? Am using Wildfly8-Final.


      My near blank ejb-jar.xml -


      <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"




      Thank you.