Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot use thirdparty JAR in EJB  RSS feed

 
Joe Cheung
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have developed a simple EJB project which uses Log4J to output some messages. I have included the jar file "log4j-1.2.11.jar" in the project and no syntax error when I completed the coding. However, the error occurred when I triggered the method in which log4J method is called:

Exception data: java.lang.NoClassDefFoundError: org/apache/log4j/Logger

I found that the "log4j-1.2.11.jar" was not included in the EAR file eventually.

What should I do in order to make the EJB reference the Log4J Jar file?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37180
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe,
You need to add the jar to the META-INF/manifest.mf file of your ejb.jar. it is easiest if the jar is in the EAR. Why can't you add it?
 
Joe Cheung
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne,

It works! Thank!

Another similar question is what I should do if the EJB needs to refer to some config. files like log4j.properties or other XML config. files?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!