This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j.Logger fails to initialize LogManager

 
S McCormick
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
shah khairudin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic