Jetty HTTPClient includes

211 Views Asked by At

I am trying to use Jetty to connect to an HTTP server that uses websocket. The problem is that the compiler cannot resolve the class HTTPClient. I've searched here on stackoverflow, i've found a solution but the link with the useful resource is no more available... What JAR should i include to run this example? http://wiki.eclipse.org/Jetty/Tutorial/HttpClient

The page doesn't tell anything about... Thank you

3

There are 3 best solutions below

0
obourgain On

The class in the jetty-client.jar. You can find it in the lib directory of the jetty distribution.

1
r3ap3r On

Did you copy http-client jar to yourapp/WEB-INF/lib? Adding jar to eclipse classpath adds that to your compile time classpath but also you need to add it to runtime classpath ( in case of webapps by adding it to WEB-INF/lib

OR

if you are using eclipse/ any other IDE:

  1. delete the project from eclipse.
  2. delete the folder in .
  3. Restart eclipse and Import the project back into eclipse.
0
Imre On

I had the exact same problem and the solution I figured out is to use another version of Jetty. The current latest (v9.2.6) was giving me the same error what's in the title above. Then I download jetty v8.1.16 and added in Eclipse (JUNO) to the "Java Build Path -> Libraries" (instead of v9.2.6) and the problem was resolved. Good luck!