Sripaul
Sripaul

Reputation: 2235

No Class Def Found Error : EJB EAR Packaging or Referencing issue

I have the following projects EJBWebClient EJBProj EJBDataAccess

I first created EJBProj. Created EJBDataAccess and added it to EJBProj.ear. Then created EJBWebClient and added it to same ear respectively.

Now from EJBWebClient I look up an EJB inside EJBProj, its looked up and working fine. Inside the bean implementation, I call a DAO inside EJBDataAccess and it throws NoClassDefFound error for that DAO.

Ex. PersonSerivceBean calls PersonDAO.getAllPeople() which is present inside EJBDataAccess. Here is where it throws NoClassDefFound.

I have referenced EJBDataAccess into the buildpath of EJBProj which in turn is referenced for EJBWebClient.

Any idea what's wrong here?

Upvotes: 0

Views: 856

Answers (2)

Sripaul
Sripaul

Reputation: 2235

I resolved the issue by manually including the jar names in MANIFEST.MF

Upvotes: 1

CodeChimp
CodeChimp

Reputation: 8154

I believe this is a problem with your EJB container. I am not sure what you are using (JBoss, WebSphere, WebLogic, etc), and I am no expert on any of them (we stopped using EJBs a long time ago), but any time you get a NoClassDefFound error, it means the current ClassLoader (the one that loaded the .class your code id "in") cannot find a referenced class.

I know many, many moons ago, JBoss used to have the idea of a "Universal ClassLoader". Basically, all JARs/EARs/WARs were loaded in one big pool. The problem is that a lot of time the code needed different versions of the same JAR, and they were not always compatible. Also, there technically a security risk if someone drops a "custom" class/JAR into the mix ahead of yours. I think it was around JBoss 3.5 that they switched away from the Universal ClassLoader, as I remember our app needed a LOT of work to fix things up to work right. Most of this was a packaging issue for us.

Upvotes: 1

Related Questions