java.lang.NoClassDefFoundError

时间:2009-10-18 14:58:55

标签: java

我收到以下错误 我错过了一些jar文件吗?

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
        at org.slf4j.impl.JCLLoggerFactory.getLogger(JCLLoggerFactory.java:69)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:243)
        at org.smslib.helper.Logger.<init>(Logger.java:34)
        at org.smslib.Service.<init>(Service.java:93)
        at SendMessage.doIt(SendMessage.java:28)
        at SendMessage.main(SendMessage.java:82)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 6 more
Java Result: 1

2 个答案:

答案 0 :(得分:8)

是的,您需要在类路径上使用Apache Logging JAR文件。在此处下载:http://commons.apache.org/downloads/download_logging.cgi

答案 1 :(得分:1)

将jar文件添加到ant lib将使它们可用于ant的java进程而不是应用程序java进程。正确设置应用程序的类路径必须有效。