tags:

views:

23

answers:

1

hi im trying to use apatche 4.0.1 using the post methode in this example but i got HttpEntity ClassNotFound exception

+1  A: 

You are not correclty including the httpcore jar into your class path. Are you running it as a jar, webapp or just application via some IDE?

Edit: Based on your comment.

ClassNotFoundException: org.apache.commons.logging.LogFactory

Thats your culprit. Im assuming httpcore uses LogFactory and you are not including it in your classpath. Look for commons-logging.jar and include that in your classpath as well.

John V.
via Eclipse IDE, i import the the Jar Files to the project and the IDE recognize HttpEntity when i write it after the import.
Fevos
And youre running it as a "Java Application" through eclipse?
John V.
Yes, i running it as Java Application .
Fevos
Can you post the exception?
John V.
even when i declare just DefaultHttpClient httpclient = new DefaultHttpClient();i got this exceptionjava.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactoryCaused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory 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)
Fevos
@Fevos take a look at my edit
John V.
i included commons-logging-1.1.1.jar and it works , thank you so much.
Fevos