3 Replies Latest reply on Jul 31, 2009 10:30 PM by Dave Chen

    session bean jndi name conflict

    Dave Chen Master

      Two ear files have the same session bean class name, for example,

      @Stateless
      @LocalBinding(jndiBinding="StudentManager")
      @Local(StudentManager.class)
      public class StudentManagerBean implements StudentManager {
      ...
      }


      When deploying the two ears, get the jndi name conflicts.

      java.lang.RuntimeException: org.jboss.ejb3.common.registrar.spi.DuplicateBindException: Could not register org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionLocalProxyFactory@100c676 under an already registered key, "ProxyFactory/StudentManagerBean/StudentManager"

      If I change the binding annotation in one ear as the following:

      @Stateless
      @LocalBinding(jndiBinding="StudentManager1")
      @Local(StudentManager.class)
      public class StudentManagerBean implements StudentManager {
      ...
      }

      I got the same error message.

      How to solve the naming conflict if we keep the same class name?

      Thanks.
      Dave

        • 1. Re: session bean jndi name conflict
          jaikiran pai Master

          This has been fixed as part of https://jira.jboss.org/jira/browse/EJBTHREE-1778. It should be available in the latest released JBoss AS 5.1.0 version. Which version of JBoss AS do you use?

          • 3. Re: session bean jndi name conflict
            Dave Chen Master

            I downloaded JBOSS 5.1.0.GA, and deployed the two ears, got the following exception:

            java.lang.RuntimeException: Could not bind Reference Class Name: Proxy for: mypackage.StudentManager
            Type: ProxyFactoryKey
            Content: ProxyFactory/app1/StudentManagerBean/StudentManager
            Type: EJB Container Name
            Content: jboss.j2ee:ear=app1.ear,jar=business.jar,name=StudentManagerBean,service=EJB3
            Type: Proxy Factory is Local
            Content: true
            Type: Local Business Interface
            Content: mypackage.StudentManager

            into JNDI at "StudentManager"
            at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bind(JndiSessionRegistrarBase.java:915)
            at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bind(JndiSessionRegistrarBase.java:895)
            at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bind(JndiSessionRegistrarBase.java:884)
            at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bindEjb(JndiSessionRegistrarBase.java:151)
            at org.jboss.ejb3.session.SessionContainer.lockedStart(SessionContainer.java:210)
            at org.jboss.ejb3.session.SessionSpecContainer.lockedStart(SessionSpecContainer.java:577)
            at org.jboss.ejb3.stateless.StatelessContainer.lockedStart(StatelessContainer.java:192)
            at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:884)
            at org.jboss.ejb3.stateless.StatelessContainer.lockedStart(StatelessContainer.java:192)
            at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:884)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
            at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
            at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
            at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
            at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
            at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
            at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
            at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
            at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
            at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
            at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
            at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
            at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
            at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
            at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
            at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
            at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
            at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
            at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
            at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
            at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
            at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
            at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
            at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
            at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
            at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
            at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
            at org.jboss.Main.boot(Main.java:221)
            at org.jboss.Main$1.run(Main.java:556)
            at java.lang.Thread.run(Thread.java:619)
            Caused by: javax.naming.NameAlreadyBoundException: StudentManager
            at org.jnp.server.NamingServer.bind(NamingServer.java:209)
            at org.jnp.interfaces.NamingContext.bind(NamingContext.java:650)
            at org.jnp.interfaces.NamingContext.bind(NamingContext.java:611)
            at javax.naming.InitialContext.bind(InitialContext.java:400)
            at org.jboss.util.naming.Util.bind(Util.java:105)
            at org.jboss.util.naming.Util.bind(Util.java:91)
            at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bind(JndiSessionRegistrarBase.java:910)
            ... 67 more