users@glassfish.java.net

Multiple Bean Implementations of the same Remote Interface causes error

From: <forums_at_java.net>
Date: Wed, 13 Apr 2011 16:50:52 -0500 (CDT)

We're getting an exception when trying to have multiple beans implement the
same remote interface.  Following is a description of our set-up.  This is
using Glassfish v3.1

We have a jar that gets copied into the lib/applibs directory of our
glassfish domain which contains the Remote Interface for an EJB.

@Remote public interface RemoteInterfaceBean { public void
remoteBusinessMethod(); }
Then we have an EAR project with to EJB projects inside.  Each EJB project
has an implementation of the Remote Interface.  Like so:

SomeEAR contains: SomeEJBProject1 which contains:
@Stateless(name="BeanImplementation1") public class BeanImplementation1
implements RemoteInterfaceBean { @Overrides public void
remoteBusinessMethod() { //some code } } SomeEJBProject2 which contains:
@Stateless(name="BeanImplementation2") public class BeanImplementation2
implements RemoteInterfaceBean { @Overrides public void
remoteBusinessMethod() { //some code } }
When attempting to deploy the EAR with both EJB projects inside, we're
getting an exception like:

javax.naming.NameAlreadyBoundException: Use rebind to override

Further up in the log it's telling us that it can't bind to the
RemoteInterfaceBean. 

So we have a few questions:

1) Can we not have multiple bean implementations of the same remote
interface?

2) Why is glassfish using the remote interface bean class name to do the
JNDI binding?  Shouldn't it be using the bean implementation class?

Thanks in advance.


--
[Message sent by forum member 'samlclient_user']
View Post: http://forums.java.net/node/791654