0

Excpetion in java while parsing XML yahoo web service rest call

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.commons.httpclient.HttpClient.<clinit>(HttpClient.java:66)
at javaapplication1.YahooWebServiceParseResults.main(YahooWebServiceParseResults.ja
va:43)
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 java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 2 more



i recieved this exception while running the example file YahooWebServiceParseResults.java dwnloaded from the site.........
please help

by
5 Replies
  • You have to add the dependencies commons-logging from Apache Commons. The current version will work "commons-logging-1.1.1"
    0
  • added commons-logging-1.1.1 .......
    now the following msg is displayed:


    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException
    at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:220)
    at org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)
    at javaapplication1.YahooWebServiceParseResults.main(YahooWebServiceParseResults.ja
    va:46)
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.DecoderException
    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 java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    ... 3 more
    Java Result: 1
    0
  • to solve the aboce exception I added commons-codecs-1.4 package....now the following msg is displayed:
    Exception in thread "main" java.net.UnknownHostException: api.search.yahoo.com
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:519)
    at java.net.Socket.connect(Socket.java:469)
    at java.net.Socket.<init>(Socket.java:366)
    at java.net.Socket.<init>(Socket.java:240)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket
    (DefaultProtocolSocketFactory.java:80)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket
    (DefaultProtocolSocketFactory.java:122)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDire
    ctor.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirecto
    r.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
    at javaapplication1.YahooWebServiceParseResults.main(YahooWebServiceParseResults.ja
    va:49)

    has anyone been able to run the sample code "YahooWebServiceParseResults.java"......
    please help.!!!!!!!!!
    0
  • Basically you have to add 3 libraries:

    commons-httpclient-3.1.jar (v4.0+ will not work)
    commons-logging-1.1.1.jar
    commons-codec-1.4.jar
    0
  • QUOTE (Anoop K @ Sep 29 2009, 05:39 AM) <{POST_SNAPBACK}>
    Basically you have to add 3 libraries:

    commons-httpclient-3.1.jar (v4.0+ will not work)
    commons-logging-1.1.1.jar
    commons-codec-1.4.jar


    done that
    still following exception!!!!!!!!!! ::
    .UnknownHostException: api.search.yahoo.com
    0

Recent Posts

in Java Development