deploying two diff versions of same EJB in two diff EARs

reply from Wolfgang Knauf in EJB 3.0 - View the full discussion



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"    ""><jboss>    <enterprise-beans>        <session>            <ejb-name>MyBean</ejb-name>            <jndi-name>MyRemoteName</jndi-name>            <local-jndi-name>MyLocalName</local-jndi-name>        </session>    </enterprise-beans></jboss>



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"    ""><jboss-web>    ...    <ejb-ref>        <ejb-ref-name>ejb/MyRemoteEjbRef</ejb-ref-name>        <jndi-name>MyRemoteName</jndi-name>    </ejb-ref>    <ejb-local-ref>        <ejb-ref-name>ejb/MyLocalRef</ejb-ref-name>        <local-jndi-name>MyLocalName</local-jndi-name>    </ejb-local-ref></jboss-web>


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


Hope this helps



Reply to this message by going to Community

Start a new discussion in EJB 3.0 at Community