I get the following error when deploying my ear file to WebLogic 8.1 server.
[EJB:011026]The EJB container failed while creating the java:/comp/env namespace for this EJB deployment. javax.naming.NameAlreadyBoundException: UserTransaction is already bound; remaining name 'app/ejb/sample_app-ejb/jar#MyServiceBean/comp' at weblogic.jndi.internal.BasicNamingNode.bindHere(BasicNamingNode.java:333) at weblogic.jndi.internal.BasicNamingNode.bind(BasicNamingNode.java:291) at weblogic.jndi.internal.BasicNamingNode.bind(BasicNamingNode.java:298) at weblogic.jndi.internal.WLEventContextImpl.bind(WLEventContextImpl.java:279) at weblogic.ejb20.deployer.EnvironmentBuilder.addUserTransaction(EnvironmentBuilder.java:663) at weblogic.ejb20.deployer.EJBDeployer.setupEnvironmentContext(EJBDeployer.java:385) at weblogic.ejb20.deployer.EJBDeployer.setupEnvironmentFor(EJBDeployer.java:1172) at weblogic.ejb20.deployer.EJBDeployer.setupBeanInfos(EJBDeployer.java:943) at weblogic.ejb20.deployer.EJBDeployer.prepare(EJBDeployer.java:1345) at weblogic.ejb20.deployer.EJBModule.prepare(EJBModule.java:498) at weblogic.j2ee.J2EEApplicationContainer.prepareModule(J2EEApplicationContainer.java:3142) at weblogic.j2ee.J2EEApplicationContainer.prepareModules(J2EEApplicationContainer.java:1583) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1227) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1070) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2513) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2463) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2379) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:866) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:594) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:508) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2467) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2379) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:866) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:594) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:508) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178) --------------- nested within: ------------------ weblogic.management.ManagementException: - with nested exception: [weblogic.management.ApplicationException: Exception:weblogic.management.ApplicationException: prepare failed for sample_app-ejb.jar2 Module: sample_app-ejb.jar2 Error: Exception preparing module: EJBModule(sample_app-ejb.jar2,status=NEW)
Unable to deploy EJB: MyServiceBean from sample_app-ejb.jar:
You are trying to bind Usertransaction to the weblogic JNDI tree. But name "UserTransaction" bound to a javax.transaction.UserTransaction object. So you need to edit your ejb-jar.xml of MyServiceBean and change the name Usertransaction to something else.
Can u post the piece of code in my ejb where you use user transaction. you can go to your weblogic browser and right click on servers and do a view JNDI tree to see the list of JNDI names bound to the server. check for usertransaction and give us that info.
Can you post your weblogic.xml too? (I hope I named it correctly. This is the weblogic specific deployment descriptor that you would find co-located with ejb-jar.xml) The names that get bound to a jndi tree of the application server is present in the app server specific deployment descriptor. The ejb-jar.xml merely contains the references.