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
The class in the jetty-client.jar.
You can find it in the lib directory of the jetty distribution.
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:
delete the project from eclipse.
delete the .metadata folder in workspace.
Restart eclipse and Import the project back into eclipse.
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!
Related
yesterday I updated my STS to the latest version 4.12.0 and today when I wanted to export my project to a .war file, this feature was not there anymore.
Here you can see how it looked on my previous 4.8 version:
I read this issue: https://github.com/spring-projects/sts4/issues/53
As I do not use maven (our project exists since 2008 and back then we did not use it) I have no way to build a war file anymore or just go back to the previous version... I don't get it, why such an easy way to build war files has been removed?
Any tipps on how I can solve this?
After reading some documentation, I found that you need Eclipse for Enterprise Java Development. So just installing this plugin solved the problem:
Adding the war plugin and not using the embedded tomcat might help.Add a servletInitializer and see if it works.
I downloaded Eclipse Luna and Tomcat 8.0.24 some months ago but I started using it. I've been creating a web app without Maven. I downloaded manually Jersey 2.23, Jersey media moxy 2.23, java-son 1.0 , jdbc mysql 5.x and sql2o 1.5.4. I'm starting to learn Angular and I successfully created one page without any issue.
I remember have added my jars manually in the Build Path of my project and I was forced to add them in the Deployment Assemblies also. Fine.
Since 2 weeks I didn't shutdown my laptop, just in sleep mode. But yesterday I did shutdown. Since then I suffered to make it work again. I use postman chrome to test my restful services and I received after the shutting down the 404 error.
I realized that I started to see the exception in the console:
java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
I deleted my folders of tomcat and eclipse to start again from scratch desperately. However, I got the same issue. The last thing that I remember I was playing with, were these modified options.
Double click in server from servers tab
Change from Use workspace metadata to Use Tomcat installation
Properties in Server
Switch Location from metadata to localhost.server
It was thanks to these questions that I solved my issue:
org.glassfish.jersey.servlet.ServletContainer ClassNotFoundException
java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
Now, after "reinstalling" eclipse and tomcat, when I add the jars in the library tab, they are now added in deployment assemblies automatically. (Surprised)
According to the previous attached questions, I added all the jars in WEB-INF/lib from my workspace as also in the tomcat/wtpwebapps/myproject/WEB-INF/lib. If I don't do this, I won't be able to make it work. Postman finally gives me the desired output.
Nevertheless, I realized when I copy the jars manually through windows explorer, the console in Eclipse displays the tomcat restarting again. BUT I still see the exception: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer. At least I can run my project in the browser or in postman without any issue. Very strange.
I want to add a new User Library in Windows > Preferences > Java > Build Path > User Libraries, but my list is EMPTY!!! So...
Finally, my questions:
What's going on with Eclipse?
Why am I not able to see my user libraries previously added?
Why do I still see the exception of glassfish.jersey in the console if I added the jars in the web-inf folder which makes it work apparently.
Why do I need to add the jars in web-inf, if when I see all the jars included in the Tomcat library all my jars are there because I forgot to mention that I added a folder called External in lib of my Tomcat folder.
For all these changes, I restarted Eclipse
Instead of adding jars manually, use maven and let the maven manage dependency of jars.
ClassNotFoundException occurs when you don't have a jar in the classpath. Maybe the package you are deploying on the server is not bundled correctly. Make sure you have jar bundled in your package or present in the classpath.
Another reason could be you have duplicate class files in two jars and the class your programme picking is not suitable.
This question has been asked many times, but I have yet to see anyone discuss it regarding debugging GWT with Eclipse.
I started getting this error after upgrading from GWT 2.6.0 to 2.6.1 and now 2.7.0.
I can add tomcat-juhli.jar, which is now found in the bin directory, to the classpath and make the error go away, but then I may get a variety of other errors. (Jasper, Permissions, JSTL).
After many hours of moving jars from the classpath into the WEB-INF/lib folder and back again, I no longer can get the eclipse debug perspective to open.
All jars that you use in your server code must be both on the build path and in the WEB-INF/lib folder.
If you get other errors when you do that, you have to deal with those errors.
The tomcat-juli file is required by Tomcat to do its logging, usually not required by either eclipse or your app.
the correct location in that case is the tomcat lib folder, next to jakarta etc.
there should also be a juli adapter jar.
not sure if this is really related to gwt.
Update: Check this page regarding logging in Tomcat: http://tomcat.apache.org/tomcat-7.0-doc/logging.html
If I understand your problem correctly, your chapter is the log4j chapter. Esp. the part with the juli jars. You need to fix the classpath for the tomcat adapter in eclipse to fix it.
if someone could help that would be amazing.
This project is being started in the NetBeans IDE EE version that comes with GlassFish Server. I've used Lucene to make a searchable twitter index of ~5G and am getting the NoClassDefFoundError only when called from the server giving a 500 Page Error.
The problem really confuses me, NetBeans is able to compile and run the code. When I call my functions from the same project in the IDE I'm able to use it perfectly. When I compile to a WebProject and launch it seems like GlassFish isn't able to find the files but I've made sure it has all the jars in the WAR file in the proper directories.
I've tried this both manually adding all the library files and by using Maven. Neither have worked, I've even added classpaths to the files elsewhere and added the files to glassfishes /lib folder.
Here is my setup.
http://imgbin.org/images/22748.PNG
I guess the problem is that you are mixing two different versions of lucene together (3.4 and 4.0).
I don't know why this works on your local Glassfish instance but you should update your dependencies so that they all have the same version.
I just downloaded Jsoup to use in a program I'm writing in Eclipse. My program uses Seam and I can not figure out how to include the JAR file for Jsoup in my program. Any help would be greatly appreciated. Thanks
Drop the JAR file in /WEB-INF/lib folder of the WAR, or in the /lib folder of the EAR. Eclipse will do the remaining necessary magic. Don't fiddle with project's Build Path properties or things may go worse.
I did what BalusC recommended above, but I also had to 'refresh' Eclipse in order for the .jar file to be recognized. To refresh, just right-click on the left side window pane within Eclipse and select refresh.
Eclipse Version:
Eclipse Java EE IDE for Web Developers
Version: Kepler Service Release 1
Build id: 20130919-0819
OS: Fedora