tags:

views:

570

answers:

2

i am geting following error Am i missing some jar file?

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
+8  A: 

Yes, you need the Apache Logging JAR file on your classpath. Download it here: http://commons.apache.org/downloads/download%5Flogging.cgi

Matthew B. Jones
I have added the jar files folund in lib foder fond after downloadingapache loging C:\Downloads\apache-ant-1.7.1-bin\apache-ant-1.7.1\libBut i am still geting same error
Can you tell us how you are trying to invoke the application that is throwing this exception? And you say you took the JAR files found in the download but where did you put them?
Matthew B. Jones
i am using netbeans 6.7 ide.I added the jar by right clicking the project > add libs >add jars
Earlier, your comment contained "C:\Downloads\apache-ant-1.7.1-bin\apache-ant-1.7.1\lib", what does your problem have to do with ant? Did you mistakenly download ant and not the apache logging JAR?http://apache.mirror.facebook.net/commons/logging/binaries/commons-logging-1.1.1-bin.zip
Matthew B. Jones
thanks for replying.but i am still geting same error.i added jar files found in this folderC:\Downloads\commons-logging-1.1.1-bin\commons-logging-1.1.1
I'm not familiar with NetBeans, so I cannot really help you much more. You need to find a way to add the JAR to the classpath of the JVM when NetBeans executes your program. This is usually easily done through the GUI and it would seem you already did that. Now that you have the correct JAR you need you are almost there.
Matthew B. Jones
+1  A: 

Adding the jar files to ant lib will make them available for ant's java process and not your applications java process. Setting your application's classpath correctly must work.

TheCoolestSid
i am new to java.Can u explain in detail.I am usinging netbeans 6.7 ide
Right click on your project -> click Properties -> from right hand side select Libraries -> In the Compile tab on the right hand side click Add Jar/Folder -> Browse to your jar files and click Open -> then click Ok to come out of the properties. This should work fine.
TheCoolestSid
this is for netbeans 6.5 .. i think this should work for 6.7 as well
TheCoolestSid