[jboss-user] [Installation, Configuration & Deployment] - Re: Undeploying multiple wars inside an ear causes NameAlrea

daniele.ulrich do-not-reply at jboss.com
Fri Nov 6 10:11:42 EST 2009

I had a second problem that seems to be related, the Exception thrown is a little bit different:

2009-11-06 10:20:45,628 INFO  [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (main) deploy, ctxPath=/pa
  | 2009-11-06 10:20:45,677 ERROR [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (main) ENC setup failed
  | javax.naming.NameAlreadyBoundException: TransactionSynchronizationRegistry
  |         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 org.jboss.web.tomcat.service.deployers.TomcatDeployment$EncListener.lifecycleEvent(TomcatDeployment.java:466)

We are using JBoss 5.0.1.GA and are deploying two EARs containing muliple web service JARs (EJB endpoints). For these endpoints a web context is deployed from the TomcatDeployer. The first gets deployed successfully all subsequent are failing.

After some code inspection I patched the EncListener in the following way:

anonymous wrote :                try {
  | 		               envCtx.bind("TransactionSynchronizationRegistry", new LinkRef("java:TransactionSynchronizationRegistry"));
  | 		               log.debug("Linked java:comp/TransactionSynchronizationRegistry to JNDI name: java:TransactionSynchronizationRegistry");
  | 		               envCtx.bind("UserTransaction", new LinkRef("UserTransaction"));
  | 		               log.debug("Linked java:comp/UserTransaction to JNDI name: UserTransaction");
  | 		               envCtx = envCtx.createSubcontext("env");
  |              		} catch (javax.naming.NameAlreadyBoundException nabe) {
  |              			log.warn("tried to create java:/comp again");
  |              		}	

This is a simple try catch block around the binding calls.

Frankly, I don't really understand what is happening here. From the code I have to assume that each web service component within the ear gets the same java:/comp context, the first component can successfully bind and all subsequent have to fail... But if I check the JNDIView afer the deployment I find a java:comp listed for EACH component!

This problem could be related to https://jira.jboss.org/jira/browse/JBWS-2384, because when we use the web service stack from JBoss WS native it works perfectly, with Metro 3.2.0.GA this problem occurs.

With this patch everything works perfectly but it would be very nice to have a convincing explanation for this effect.

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

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

More information about the jboss-user mailing list