This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I’m stuck with a problem in WebSphere 5.1 with EJBs and enterprise applications.
I have 2 enterprise applications, A and B. Each has one stateless session EJB. There is also a WAR file in application A.
At runtime a client makes a call on a servlet in application A, it looks up EJB A and calls methods on it, and in turn this looks up EJB B in application B and calls methods on it.
It’s a big system and the goal is to do a complete automated system build via ANT from PVCS without involving WSAD. ie to get WebSphere to generate the EJB deployment code at the time of deploying the EARs. (ignore the IBM specific xmi files etc, for the time being they are hand crafted).
================================================= Deployment style 1, a temporary solution:
The EAR for A is built by ANT. When its deployed, WebSphere starts up the workbench and creates the missing EJB deployment code.
The EAR for B is built from WSAD, ie it contains EJB deployment code. On deployment WebSphere recognises that everthing needed is already present.
This works fine at both deployment and runtime. ================================================== Deployment style 2, ie the goal:
The EAR for A is built by ANT. The EAR for B is built by ANT.
The only difference between the structure of the EAR file for B is that it is now missing the EJB deployment code (~ classes starting with underscore).
There are no errors at deployment time. But at runtime, when EJB A tries to lookup EJB B it can’t find it. I’ve checked the JNDI tree - its fine the correct class is stored against the jndi lookup name. The error is a class not found exception.
So what do I need to do in WebSphere such that the EJB deployment code generated for the EJB in application B falls within the classloader / classpath such that the EJB in application A can access it ?
I’m surprised the problem doesn’t occur in application A. WebSphere creates the EJB deployment code and wherever it puts it, its available to the EJB lookup from the servlet. However, they are in the same application.