16 May 2012

JNDI name duplication problem chez WebSphere

Yesterday a colleague and I have faced a subtle problem deploying a suite of enterprise applications on WebSphere Application Server - version 6.1.
The problem manifested itself with a marshalling error when a webapp called a service exposed as an EJB in the same enterprise application: this was very annoying due to two main aspects:
  1. there was no duplication, between webapp and EJB module, fot the classes involved in the call
  2. the issue seemed to occur randomly: not for all calls (and never for some), not always for the same call (apparently depending to application restart)
After a few hours of stop-and-start-and-read-the-log nightmare, we discovered that at the root of the problem was a JNDI name duplication between EJBs published by two different applications of the suite: these applications are based on the same infrastructural framework, and the framework published some framework services using a fixed JNDI name. This was clearly an error in suite packaging, but... WebSphere did not report in any way this name collision, deployed without errors nor warnings both the applications, and the duplicated JNDI name was associated with an implementation of the service or with the other, depending to starting order of the apps. So:
  1. the marshalling problem appeared when the webapp from an EAR called the service published by the other application
  2. the issue occurred only for the EJB with the duplicated name, not for the others; and coccurred or did not depending to the starting order
The solution was quite simple: changing the JNDI name of  one of the twins services.
But... why the application server did not give any error when deploying an EJB using an already-in-use JNDI name, as do for example JBoss and BEA Weblogic application servers?

Definitely something to remember!

No comments:

Post a Comment