File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes log4j.Logger fails to initialize LogManager Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "log4j.Logger fails to initialize LogManager" Watch "log4j.Logger fails to initialize LogManager" New topic

log4j.Logger fails to initialize LogManager

S McCormick

Joined: Dec 09, 2011
Posts: 1
Hello all. I have a Java batch process that is trying to write to the Log4j log file, but it appears that the Logger class is failing to initialize the LogManager class.

Am I understanding this issue correctly? Any idea what would cause this? I have verified that the log4j.jar file is in the .\lib directory.

Any help would be appreciated!



"Using java version:"

C:\sls>C:\bea103\jdk160_05\bin\java.exe -version
java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)

"Calling StoreLaborSystem Batch - TLGIntegrationGUI"
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: Could not initialize class org.apache.log4j.LogManager
at org.apache.log4j.Logger.getLogger(
at com.wendys.common.logging.Logger.getLogger(
at com.wendys.common.logging.Logger.canLog(
at com.wendys.common.logging.Logger.canLogDebug(
at com.wendys.tlg.TLGIntegration.main(
at com.wendys.tlg.TLGIntegrationGUI.startLaborGuide(
at com.wendys.tlg.TLGIntegrationGUI.actionPerformed(
at javax.swing.AbstractButton.fireActionPerformed(
at javax.swing.AbstractButton$Handler.actionPerformed(
at javax.swing.DefaultButtonModel.fireActionPerformed(
at javax.swing.DefaultButtonModel.setPressed(
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
at java.awt.Component.processMouseEvent(
at javax.swing.JComponent.processMouseEvent(
at java.awt.Component.processEvent(
at java.awt.Container.processEvent(
at java.awt.Component.dispatchEventImpl(
at java.awt.Container.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.LightweightDispatcher.retargetMouseEvent(
at java.awt.LightweightDispatcher.processMouseEvent(
at java.awt.LightweightDispatcher.dispatchEvent(
at java.awt.Container.dispatchEventImpl(
at java.awt.Window.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(
Henrique Ordine
Ranch Hand

Joined: Sep 03, 2004
Posts: 127
Hi McCormick,

Did you ever manage to solve your problem? I'm getting the same error.

It seems that at runtime some class can't be found (hence the message NoClassDefFoundError) but the name of that class gets lost along the Exception Handling process.

In my classpath, both LogManager and Logger exist.

It's funny that the code seems to fail inside my ThinMPI class, where I do this:

Can anyone help?

J2EE Architect/Developer
shah khairudin

Joined: Sep 30, 2012
Posts: 2
Hi Henrique,

i'm getting the same problem too

"java.lang.NoClassDefFoundError: Could not initialize class org.apache.log4j.LogManager"

i've put the log4j.jar inside lib folder but the problem still there.

any idea?

I agree. Here's the link:
subject: log4j.Logger fails to initialize LogManager
It's not a secret anymore!