You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Jerome Hollon <je...@gmail.com> on 2007/10/14 05:55:50 UTC

Error when creating PostMethod

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I get this error when creating a PostMethod object:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/commons/logging/LogFactory
        at
org.apache.commons.httpclient.HttpMethodBase.<clinit>(HttpMethodBase.java:104)
        at crevoscope.Main.main(Main.java:42)

With this code:
	String targetURL = "http://crevoscope.com/firstpage2.php";
        ...snip...
        PostMethod login = new PostMethod(targetURL);
        //add to post
        NameValuePair[] data = {
          new NameValuePair("username", username),
          new NameValuePair("password", pass)
        };
        login.setRequestBody(data);

I can't create the object, any help would be appreciated.

Jerome
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHEZNGC9PPyzQCv80RAhV0AJ4koVYg3LAAQeEOUh1qVxBR4B0WewCfc9kb
OnD49gBELuqxudybj6WWnEo=
=ZpP+
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Error when creating PostMethod

Posted by Puneet Lakhina <pu...@gmail.com>.
On 10/14/07, Jerome Hollon <je...@gmail.com> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I get this error when creating a PostMethod object:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/commons/logging/LogFactory
>         at
> org.apache.commons.httpclient.HttpMethodBase.<clinit>(HttpMethodBase.java
> :104)
>         at crevoscope.Main.main(Main.java:42)
>


httpclient requires commons-logging and commons-codec.

Please see here
http://jakarta.apache.org/httpcomponents/httpclient-3.x/dependencies.html

So you will have to download commons-codec and commons-logging from the
respective project sites.

http://commons.apache.org/codec/
http://commons.apache.org/logging/


-- 
Puneet
http://sahyog.blogspot.com/