I have a business interface being implemented by two EJBs.
UserManagementService
@Remote
public interface UserManagementService {
By default GlassFish Server specific default JNDI names are applied automatically for backward compatibility. So com.transbinary.imdb.service.UserManagementService
is the the default JNDI name for both the implementations of UserManagementService
interface. Which was why I was gettting javax.naming.NameAlreadyBoundException
exception.
But because the EJB 3.1 specification defines portable EJB JNDI names, there is less need for GlassFish Server specific JNDI names.
To disable GlassFish Server specific JNDI names for an EJB module, set the value of disable-nonportable-jndi-names
element to true
. The default is false
.
It solved the problem.
Resource: http://wikis.oracle.com/display/GlassFish/Developer+Handoff+to+QA+for+EJB-8+%28Option+to+disable+GlassFish-specific+JNDI%29
GlassFish restart. (It worked for me.)
In my case, i was using JBoss5.1GA and i had two EJBs implementing a common local Business Interface...
I Follow the idea suggested by @Christo Smal, and it work for me.... Another Observation: I was deploying an ear which contains the two EJBs at two differents EJB jars; e.g:
Ear File:
* Jar File1: Containing EJB1
* Jar File2: Containing EJB2
* lib/dummy.jar: Library containing the Business Local interface
I got this same exception.
In my case I changed my code from @Stateless(mappedName = "whatever")
to instead be @Stateless(name = "whatever")
and it solved my issue
Make use of rebind instead of bind and it should work