having java.lang.NoClassDefFoundError error

I've download pakage commons-httpclient-3.0.zip from apache site to try to test something.
I've placed commons-httpclient-3.0.jar file extracted from the above zip
into C:\Program Files\Java\jdk1.5.0_06\jre\lib\ext directory.
in my project folder c:\java  I've placed sample program from this package : BasicAuthenticationExample.java. (can be found in the link below)
http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/httpclient/trunk/src/examples/

My PATH is following:
Path=C:\Program Files\Java\jdk1.5.0_06\bin;C:\Program Files\Java\jre1.5.0_06\bin
;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32\dri
vers\etc;C:\Program Files\Progress\bin
My CLASSPATH :
CLASSPATH=C:\java;C:\Program Files\Java\jre1.5.0_06\lib;C:\Program Files\Java\jr
e1.5.0_06\lib\ext\QTJava.zip;C:\Program Files\Java\jdk1.5.0_06\jre\lib\ext\commons-httpclient-3.0.jar


The programm compiles fine , but when running I've got following error :

C:\java>java BasicAuthenticationExample
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lo
gging/LogFactory
        at org.apache.commons.httpclient.HttpClient.<clinit>(HttpClient.java:65)

        at BasicAuthenticationExample.main(BasicAuthenticationExample.java:54)

Any help would be approciated.
Thanks.







lez60Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RytmisCommented:
commons-httpclient seems to have a dependency on commons-logging. Download it from http://jakarta.apache.org/commons/logging/ and put it on your classpath, then try again.

Note that commons-logging is known to have some design issues, see http://www.qos.ch/logging/classloader.jsp for more information.

0
lez60Author Commented:
Thanks a lot, it works now ;), just one more issue aftrewords:
in the program there is piece of code:
new UsernamePasswordCredentials("username", "password")
should I replace it with username and password for my site ??

 
0
RytmisCommented:
Assuming that you have modified the URLs in the example to match your site and that your site is using HTTP Basic authentication, yes.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

lez60Author Commented:
I am not sure what king of autentication the site I am acessing is using . What is the best way to find out ?? here is the  of loging html source:

<HTML>
<HEAD>
      <META NAME="HandheldFriendly" CONTENT="true">
      <META NAME="PalmComputingPlatform" CONTENT="true">
      <META NAME="HistoryListText" CONTENT="Login to ABC">
      <META HTTP-EQUIV="Expires" CONTENT="Sat, 04 Sep 1999 07:32:02 GMT">
      <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <TITLE>Login to ABC</TITLE>
</HEAD>
<BODY>
<CENTER>
<IMG SRC="/gifs/wireless/banner_re.gif" ALT="ABC Logo">
<FORM ACTION="https://www.abcd.com/c/a/WirelessLogIn" METHOD="post" NAME="LOGINFORM" autocomplete="off">
<INPUT TYPE="hidden" NAME="pagehandler" VALUE="PHWirelessLogIn">
<INPUT TYPE="hidden" NAME="DV_DATA" VALUE="1144341481423">
<INPUT TYPE="hidden" NAME="USERGROUP" VALUE="ACCT">
<INPUT TYPE="HIDDEN" NAME="COMPANY" VALUE="AABB">
<TABLE>
      <TR>
          <TH ALIGN="right">Account #:</TH>
        <TD><INPUT TYPE="Text" NAME="USERID" SIZE="11" MAXLENGTH="9" value=""></TD>
    </TR>
      <TR>
        <TH ALIGN="right">PIN:</TH>
        <TD><INPUT TYPE="Password" NAME="PASSWORD" SIZE="11" MAXLENGTH="4"></TD>
      </TR>
</TABLE>
<P>
<INPUT TYPE="submit" NAME="login" VALUE="Login">
</CENTER>
</FORM>
<CENTER>
      <A HREF="http://www.abc.com/c/a/WirelessIndex"><B> Home</B></A>
</CENTER>
<!-- VERSION: prd lapp9 - dev_2006.03.00.00_echange_BUILD_01 -->
</BODY>
</HTML>

 
0
RytmisCommented:
You might as well explain what you're going for, would make it a lot easier to guide you to the right direction.

Looks to me like the site uses form-based authentication, so Basic Auth is not going to do the trick here.
0
lez60Author Commented:
Thanks,
I am tring to login to my account to read some values,  the site looks like http://www......com/c/a/WirelessIndex 
 
0
RytmisCommented:
In that case, it gets a bit tricky. What you want to do is something along the lines of:

1) (optional) Issue a HTTP GET to fetch the login form in your example, then parse the resulting HTML to locate the username/password form fields and the form URL
2) Do a HTTP POST to the form URL, sending the username/password pair in the request
3) Get a redirect address from the server, along with an authentication token (most likely a session ID)
4) Send the authentication token along with any subsequent requests to the actual resources you're after.

etc. etc. Like I said, tricky, since you're essentially trying to automate a sequence of human <-> browser <-> server interaction. Now, if the resource was protected by HTTP Basic authentication, or offered a Web Services API or somesuch, it would be a lot simpler :)

(Oh, and btw, I haven't ever actually implemented anything like this, it's just based on my observations on how form logins tend to work)
0
lez60Author Commented:
I've done this , but didn't work, that is why I am trying to use some robust packages like jackarta , does jacarta have form-based authentication classes ??
 
0
RytmisCommented:
Seeing as the implementation details of form-based logging differ from site to site, it would be challenging to create a catchall form login client. What exactly didn't work when you tried the steps I described?
0
lez60Author Commented:
that is what I am getting, I am showing headers as well

1.  first run reading sess ID .......
null=HTTP/1.1 200 OK
Date=Thu, 06 Apr 2006 17:56:21 GMT
Server=Apache
Set-Cookie=ABC=G1WFnvlSJwxTHyy0hqx5GD95D7YZJJ2bGZkLzNpK9lq91wxprpTc!-114
6504025; path=/; secure


2. second run ... (passing user, pass and cookies )

https://www.abc.com/c/a/WirelessLogIn?userid=999999&password=12324&pagehandl
er=PHWirelessLogIn&DV_DATA=1144346181059&USERGROUP=ACCT&COMPANY=AABB
null=HTTP/1.1 200 OK
Date=Thu, 06 Apr 2006 17:56:21 GMT
Server=Apache
Keep-Alive=timeout=15, max=1000
Connection=Keep-Alive
Transfer-Encoding=chunked
Content-Type=text/html; charset=ISO-8859-1
Set-Cookie=NSC_c7c8093201bb=c0a8174e1fd6;path=/
null=null
<HTML>
<HEAD>
        <META NAME="HandheldFriendly" CONTENT="true">
        <META NAME="PalmComputingPlatform" CONTENT="true">
        <META NAME="HistoryListText" CONTENT="Login to ABC">
        <META HTTP-EQUIV="Expires" CONTENT="Sat, 04 Sep 1999 07:32:02 GMT">
        <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <TITLE>Login to ABC</TITLE>
</HEAD>
<BODY>
<CENTER>
<IMG SRC="/plus/gifs/wireless/banner_re.gif" ALT="ABC Logo">
</CENTER>
<P>
<CENTER><B>Your session was logged off.  Please try again.<BR>
Contact o have difficulty acces sing your account.</B></CENTER>
</P>
<!-- VERSION: prdkclsapp20  - dev_2006.03.00.00_echange_BUILD_01 -->
</BODY>
</HTML>
0
RytmisCommented:
Hmm.. you could always log in using a browser and use something like LiveHttpHeaders to view what exactly goes on between the browser and server, then see what your requests are missing (if anything :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lez60Author Commented:
Thanks a lot ,
could you e-mail me to   cleaning_4_u@yahoo.com with sample setup, I have one more question
 
0
lez60Author Commented:
How to set up  LiveHttpHeaders and where to get it from ??
0
RytmisCommented:
It's a Mozilla Firefox extension, and you can get it from http://livehttpheaders.mozdev.org/installation.html :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.