[jboss-user] [EJB 3.0] - deploying two diff versions of same EJB in two diff EARs

Wolfgang Knauf do-not-reply at jboss.com
Thu May 27 11:27:57 EDT 2010

Wolfgang Knauf [http://community.jboss.org/people/WolfgangKnauf] replied to the discussion

"deploying two diff versions of same EJB in two diff EARs"

To view the discussion, visit: http://community.jboss.org/message/545152#545152


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"    "http://www.jboss.org/j2ee/dtd/jboss_5_0.dtd"><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"    "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd"><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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100527/a31fcf15/attachment.html 

More information about the jboss-user mailing list