Search code examples
log4jwebsphereejb-3.0classnotfoundexception

EJB cannot locate the log 4j in the classpath


on my WAS 6.1, I have an EJb deployed in an EAR and the EJb uses log4j. I am getting this error while trying to call EJb through a remote client:

Caused by: java.lang.NoClassDefFoundError: org.apache.log4j.Priority
    at java.lang.J9VMInternals.verifyImpl(Native Method)
    at java.lang.J9VMInternals.verify(J9VMInternals.java:69)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:131)
    at com.bmo.olbb.prs.integration.service.util.PRSUtil.<clinit>(PRSUtil.java:13)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:196)
    ... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority

Inside the installedapps directroy, in the EAR folder, I have the EJB jar and also log4j-1.2.15.jar. So why am I getting this? The otehr thing is how can it be ClassNotFoundException and NoClassDefFoundError at the same time?


Solution

  • Did you add the log4j jar to your EJB jar's meta-inf/Manifest.mf file?

    Manifest-Version: 1.0
    Class-Path: log4j-1.2.15.jar