mavenjakarta-eewarwebsphere-6.1ejb-2.x

How to deploy EJB (MDB 2.1.x) in a web project


I use Maven, WebSphere 6.x, RAD 8.x and got a maven web project.

I tried to add a MDB to the web project. I placed the MDB under src/main/java and placed ejb-jar.xml and the websphere binding under WEB-INF directly

When I deploy the web project I don't see the MDB getting deployed.

How can I fix this?

Should I add something in web.xml informing the web app that it has an EJB?

I asked a different question Here where i created a MDB project separately and tried to depend on classes inside a web project and got a response that I could deploy my EJB as part of a web app itself.

The MDB deploys properly when deployed as a separate ejb project. But the dependencies on the web project are unable to be found by the EJB project during runtime. Its throwing No Class Found exception.

So please help me on one of these 2

1) How to create EJB inside WAR and make the WAR understand that it has an EJB? - in this case the war is not recognizing the ejb

or

2)How to make a stand alone EJB project identify classes from inside a web project? - in this case the ejb is not recognizing the war classes


Solution

  • It is not possible to create EJB inside WAR in WebSphere 6.1 as it is using Java EE 1.4. You will need to upgrade to WebSphere 8.x for that.

    For WebSphere 6.1 you need to package war and ejb in single ear and change classloader settings for your application. After you deploy application, in the console go to Enterprise Applications > yourApp > Class loader and in the WAR class loader policy set Single class loader for application (these names are from 8.5 but you should have something very similar in 6.1, I dont have 6.1 console at hand as it very old and no longer supported).

    For details see Configuring application class loaders