I am having a problem adding log4j to my webapp. I have added the log4j jar file to my project as a user library.
When I add the line:
private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(“Logger.class”);
I get the error:
SEVERE: Error creating form bean of class com.akamai.struts.form.ConsoleForm
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at com.akamai.struts.form.ConsoleForm.<clinit>(ConsoleForm.java:26)
If I comment out the line the app works fine. I have not gotten to an actual logger.debug(~) statement yet.
What makes this especially maddening is that essentially the same code works fine as a straight java app but fails when run with tomcat. Any thoughts would be appreciated.