This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Java in General and the fly likes HTTPServletRequest containing an HTTPEntity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "HTTPServletRequest containing an HTTPEntity" Watch "HTTPServletRequest containing an HTTPEntity" New topic
Author

HTTPServletRequest containing an HTTPEntity

Vikas Solegaonkar
Greenhorn

Joined: Oct 17, 2011
Posts: 8

I am trying to have a simple Java application running on the client machine communicate with a HttpServlet on server machine. But, I am not able to get it working. I know this means mixing two different technologies.. but it will make my life much simpler if I can get this to work. Have you tried this before?

The code is some what like this..

Client

Server:


This fails with a ClassNotFoundException.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
That means a required class is not the classpath. Without seeing the stack trace (which includes the information about which class is missing) there's not much else we can do.
Vikas Solegaonkar
Greenhorn

Joined: Oct 17, 2011
Posts: 8

The Class is there in the classpath - I am running it in eclipse. Here is the stack trace



Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Which classpath is that? It needs to be in the servlet container's WEB-INF/lib directory if it's used in the web app.
Vikas Solegaonkar
Greenhorn

Joined: Oct 17, 2011
Posts: 8

Tim Moores wrote:Which classpath is that? It needs to be in the servlet container's WEB-INF/lib directory if it's used in the web app.


Thanks Tim for your time on this..
Yes, I have added the Apache jars (httpclient-4.1.3.jar, httpcore-4.1.4.jar, commons-logging-1.1.1.jar) to the WEB-INF/lib directory as well as in the eclipse project build configuration. I believe the HttpEntity is a part of the httpcore. The strange thing is that none of the println traces are visible on the console.

I have a feeling the problem is something really silly that I have missed in the sequence of calls either on client or server. But unable to get to it.
Vikas Solegaonkar
Greenhorn

Joined: Oct 17, 2011
Posts: 8

Found the problem! I had dropped the jar files in the WEB-INF/lib folder. But did not refresh the eclipse project after that !!
It worked well after a refresh !
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HTTPServletRequest containing an HTTPEntity