This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "log4j.Logger fails to initialize LogManager" Watch "log4j.Logger fails to initialize LogManager" New topic
Author

log4j.Logger fails to initialize LogManager

S McCormick
Greenhorn

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!

====================

Classpath=.;.\lib\log4j.jar;.\lib\SLS.jar;.\lib\WendysCommon.jar;.\lib\classes12.jar;.\lib\DDConnectionBroker.jar;.\lib\sqljdbc.jar;.\lib\shiftone-arb
or.jar;.\lib\shiftone-oocjndi.jar;.\lib\c3p0-0.9.1.2.jar;.\lib\xercesImpl.jar;.\lib\xml-apis.jar;.\lib\TMxExportService_client.jar;.\lib\webserviceclient.jar;.\lib\weblogic.jar;.\resources

"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(Logger.java:85)
at com.wendys.common.logging.Logger.getLogger(Logger.java:1717)
at com.wendys.common.logging.Logger.canLog(Logger.java:116)
at com.wendys.common.logging.Logger.canLogDebug(Logger.java:144)
at com.wendys.tlg.TLGIntegration.main(TLGIntegration.java:164)
at com.wendys.tlg.TLGIntegrationGUI.startLaborGuide(TLGIntegrationGUI.java:275)
at com.wendys.tlg.TLGIntegrationGUI.actionPerformed(TLGIntegrationGUI.java:227)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5806)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4413)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2440)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
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
Greenhorn

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?

Thanks,
Shah
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: log4j.Logger fails to initialize LogManager
 
Similar Threads
Using Sun's Migration Tool...
problem regarding batch file
I found that inner classes cause problem run my jar file (no problem making the jar or compiling),
Turn Based Strategy Games
? File I/O (and-or) for each loop