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

时间:2014-09-15 12:18:07

标签: java noclassdeffounderror executable-jar

我正在Netbeans 8中开发一个外部jar的java代码。当我从Netbeans IDE运行它时,项目按预期运行,但是执行使用IDE的Clean and Build功能生成的jar(jar放在dist目录中,而dist目录中的lib目录中的依赖jar)给出了以下内容运行期间出错

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
    at com.informatica.powercenter.sdk.mapfwk.util.Logger.<init>(Unknown Source)
    at com.informatica.powercenter.sdk.mapfwk.util.Logger.getLogger(Unknown Source)
    at com.informatica.powercenter.sdk.mapfwk.util.JMFMessageCatalog.<clinit>(Unknown Source)
    at com.informatica.powercenter.sdk.mapfwk.repository.Repository.<clinit>(Unknown Source)
    at CM.CreateMappingFresh.createRepository(CreateMappingFresh.java:463)
    at CM.Base.init(Base.java:69)
    at CM.Base.execute(Base.java:57)
    at CM.CreateMappingFresh.pc_main(CreateMappingFresh.java:125)
    at CM.GUI2.jButton_GenerateXMLActionPerformed(GUI2.java:972)
    at CM.GUI2.access$2400(GUI2.java:34)
    at CM.GUI2$26.actionPerformed(GUI2.java:598)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
 Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 47 more

错误第二行(Logger.java)中提到的类存在于com / informatica / powercenter / sdk / mapfwk / util位置的jar中(如错误中所述)。这个jar包含在manifest.mf的Classpath中,也包含在lib / jarname.jar中(以及其他jar)。请建议消除此错误的步骤。

0 个答案:

没有答案