[jboss-user] [EJB 3.0] - Binding the same session bean to JNDI more than once

ColinEberhardt do-not-reply at jboss.com
Wed Apr 23 12:18:58 EDT 2008


Hi All,

I want to deploy two distinct instances of my code in the same container.

Therefore, I have a session bean (actually quite a few of them) that I want to bind to different JNDI names. Here is how I do it:

My EJB3 code is packaged within a JAR file, which is itself packaged within an EAR (via. maven). I can configure the build to produce two different EARs:

code1.ear
code2.ear

My session beans use the @RemoteBinding to specify the JNDI bindings.

What happens is this:

If I specify a JNDI binding for a session bean, then package within an ear, code1.ear, then deploy, I can see that it the binding is correct (via the JNDI View MBean).

I then chance the JNDI binding by editing the @RemoteBinding, then re-package as code2.ear and deploy to the server.

However, when I inspect JNDI View, the new binding has not occured.

Interestingly, if I omit the @RemoteBinding annotation altogether, the container provides default bindings and I can see the two distinct bindings:

code1/myBean
code2/myBean

Why, if I manually try to specify two distinct JNDI bindings for the same session bean (packaged within two different EARs), does the binding for the second EAR, when deployed, get ignored? 

I have tried using the corresponding XML equivalent to @RemoteBinding, again, without success.

Regards.
Colin E.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4146256#4146256

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4146256



More information about the jboss-user mailing list