1 Reply Latest reply on May 27, 2010 11:31 AM by Wolfgang Knauf

    deploying two diff versions of same EJB in two diff EARs

    Arbi Sookazian Master

      We have EJB1 (version 1) in EAR1 and EJB1 (version 2) in EAR2 deployed in %JBOSS_HOME%/server/default/deploy directory.


      How can we configure to ensure that each app (EAR) accesses the correct version of EJB1 in this same instance of JBoss 4.2.x?  Is it possible to do this considering the global JNDI namespace?

        • 1. Re: deploying two diff versions of same EJB in two diff EARs
          Wolfgang Knauf Master



          I think this should be possible. In the following snippets, I assume that you use EJB3.


          Step 1:in your EJB jar, you can define the global JNDI names of your beans.

          Either use annotations ("org.jboss.ejb3.annotation.RemoteBinding") on the bean class, or use a "jboss.xml" file:




          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE jboss PUBLIC
              "-//JBoss//DTD JBOSS 5.0//EN"



          Step 2: in your client project, use a "jboss-web.xml" (for web client) or "jboss-client.xml" (for app client) and the ENC to map a ejb reference to this global name. Here is a snippet for a "jboss-web.xml":




          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE jboss-web PUBLIC
              "-//JBoss//DTD Web Application 5.0//EN"



          Of course, you have to declare those Environment Naming Context (ENC) entries also in "web.xml" or "application-client.xml"


          Hope this helps




          Sorry for the broken XML, this forum sucks sometimes...