-
1. Re: deploying two diff versions of same EJB in two diff EARs
wolfgangknauf May 27, 2010 11:31 AM (in response to asookazian)Hi,
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:
{code:xml}
<?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>{code}
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":
{code: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>{code}
Of course, you have to declare those Environment Naming Context (ENC) entries also in "web.xml" or "application-client.xml"
Hope this helps
Wolfgang
Sorry for the broken XML, this forum sucks sometimes...