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.
Related
I'm not sure what i'm doing wrong here... i downloaded this sample project which is basically the simplest possible working example of an annotation based controller. I downloaded Tomcat and started the server no problem in eclipse. I downloaded Spring 4.3.7 from here (i'm not using Maven nor do i want to). Added as external JARs under libraries.
When i go run the application i get a ClassNotFoundException for the ServletDispatcher class so i followed the instructions here to resolve this. But when i add the Spring JARs then my server times out with the following error sure enough in the deployment assembly there are being deployed to WEB-INF. So i removed the JARs, and i added them one by one based on the ClassNotFoundException. First i added spring-beans, then context, then webmvc and it seems when i add core this is when the error switches from the ClassNotFoundException to the server timeout error... I'm not sure what to do?
EDIT: Found out that my compiler was set to 1.7 while my JDK was set to 1.8. I changed this and now get a java.lang.NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable error. I tried adding the core JAR but then i continue to get the server timing out error.
In Project Properties.
Check your java build path it should contain
JRE system library: JDK 1.7 or above
Server Run time: Tomcat
Check your Java Compiler
It should be 1.7 or above
You need to add the Java build path in the Deployment Assembly
1) Right click on your project, select Properties
2) Select Deployment Assembly. Click Add button.
3) Click on "Java Build Path Entries"
4) Select yours jars
5) click Finish
Clean build your project and restart tomcat.
I'm using Netbeans 8.1 with Apache 1.7.1. I've been working on the project for more than a year now, on and off. It's been working perfectly more or less. The majority of project libs are inside server lib folder.
All of a sudden it is decided to remove rich faces libs from the server on Production and include them inside of the project - not my idea, but here we are. So I remove the libs from server on my machine, include them in project libraries, and the aforementioned error appears just like that:
...\build-impl.xml:1066: The module has not been deployed.
See the server log for details.
But the server log is clean and without errors.
I tried restarting server, Netbeans, pc and whatnot, but to no avail. I decided to take a step back: remove libs from project, copy them back to sever. But the problem remains.
I've tried solutions from at least three topics here: disabling network, cleaning Netbeans cache, ending Java task and others, but the problem still remains. Is there anything else that can be done?
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.
I have got a war file generated using Maven and it works perfectly fine when i manually deploy it on the tomcat server.
However, the war file was generated using Maven on eclipse and when i try deploying this on the server using eclipse, it just doesn't act. The tomcat server starts perfectly fine. What I do is : Right click on the Tomcat Server 7.0, then Add/Remove Project and add it to the server.
The problem is when I deploy and publish it on the server and nothing happens after that.
On trying to access it, it says - The required resource is not found
Eclipse doesn't deploy the WAR. Instead, it knows how Tomcat works and deploys the exploded WAR.
The next step is to look into the webapps/ folder of Tomcat to make sure Eclipse really has deployed something.
If that looks ok, you need to look into the Tomcat log to see why it doesn't like the deployed web app.
Most of the time, there is old code which is somehow stuck in Tomcat, so Tomcat can't undeploy the old version. If that's the case, stop Tomcat, delete the app manually and try again.
There were certain jars required in specific versions for the application to work. I was usin the maven supported versions. I have got it to work adding them directly in Tomcat's lib folder for time being and the application now works. (Anyways i need to look to get them configured now on the maven)
Also, i guess installing the plugin for m2e - eclipse.org/m2e-wtp helped as well. Thanks #Aaron Digulla for the inputs.
I am developing a web application and have hit a wall and could use some advice. So the application was written by a coworker who is no longer at our company. They wrote a web application for Apache Tomcat with Java and Javascript in the back end. The application makes use of the JDBC api to interface with a SQL Server database. This person did all the development in Eclipse and running it this way.
I am trying to take this web application and move it to a server. I attempted this by using Eclipse to export a WAR file and then placing this within the Tomcat webapps folder. Then when I started Tomcat the program was extracted. So far so good. The website comes up and works well. However, when I try to access the pages which rely upon database info everything is coming up NULL. I went through the Tomcat logs and found that in the standard out the following message was given:
ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
I had assumed that the WAR file would include all dependencies but I am guessing that probably this is not the case. If anyone is experienced, is this what has happened? If anyone out there is aware, is there a way to tell Eclipse to do this? Otherwise, what is my option? I am not a Java dev and so I would not know how to install JDBC if needed.
Any help is appreciated.
Mike
You can do the following
Go to Microsoft JDBC Driver download page and download the JDBC driver and install it to a location.
Open the .war file using a zip utility like 7-zip or winzip.
Copy the sqljdbc.jar from the sqljdb_4.0/enu directory where you installed the downloaded JDBC driver and paste it in WEB-INF/lib of the extracted war file.
Zip it back as .war file and deploy it again.
This will get the application running.
If you want to fix this permanently, then you should add the stop to include sqljdbc.jar to your WEB-INF/lib while building war file, in your build system, i.e. in build.xml if you are using ANT or in your Maven's pom.xml under dependencies section for this particular dependency.
You don't need to do the "Export WAR > copy to tomcat > start tomcat" manually, you could configure eclipse to do the deploy directly in your tomcat installation, firts double click tomcat server, and then select "Use tomcat installation" in the "Server Locations" section.
Make sure that your application contains the SQLServer JDBC driver (sqljdbc4.jar) in your project WebContent/WEB-INF/lib directory (assuming your coworker used the Eclipse "Dynamic Web Project" for the project layout), if not, download from here, unzip and copy it to the mentioned folder, the next time you start tomcat, it will automatically add it for you.
If the project uses the maven project layout (there is a file named pom.xml in the project root folder), use the following instructions to install the dependency in your local repository (there are some disagreements between Maven and Microsoft about licensing and redistribution of the driver, so there is no repo)