2 Replies Latest reply on Jul 22, 2008 2:47 AM by jaikiran pai

    Accessing stateless EJB3 bean from a WAR

    Michael Litherland Newbie


      I've searched and read and tried a hundred things, but I'm pulling my hair out on this one. I have a desire to deploy similar, but subtly different EJB projects on a JBoss 4.2.2 application server, then allow my WARs to call those EJB methods using the remote interface. This way for a new customer I deploy a new EJB and the tweaks to the WAR are relatively minor to allow access to the additional EJB project. This seems like it should be straightforward, but I can't overcome a few problems. Here's part of my stateless bean:

      public class MyBean implements MyBean {
       @PersistenceContext(unitName = "S1-ejbPU")
       private EntityManager em;
       public List<SomeOtherBean> getBeans() {

      My understanding is I need to create an ejb-ref in my web.xml, jboss-web.xml and finally call that from my code (which is a JSF managed bean in this case. First the jboss-web.xml:

       <!-- also tried this:

      The web.xml:

      <web-app ....

      Lastly in the code itself:

       private MyBeanRemote mbr;

      I've tried many variations, but it's not clear to me, even after reading documentation, what all of the various pieces actually do within this processes, nor what I should be calling what. I'd love to see a simplified howto for setting up something like what I desire or suggestions for "better ways" to attempt this.