Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse WST: Webapp sometimes not deployed on Tomcat

I am using Eclipse WTP to develop my spring app and deploy it on a tomcat server.

Usually my web app is deployed on tomcat and everything works fine, but sometimes, I could say randomly, my web app is just not deployed and tomcat starts without any modules:

17.03.2011 14:04:31 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [CUT BY ME]
17.03.2011 14:04:31 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNUNG: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:mywebapp' did not find a matching property.
17.03.2011 14:04:31 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
17.03.2011 14:04:31 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 573 ms
17.03.2011 14:04:31 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
17.03.2011 14:04:31 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.26
17.03.2011 14:04:31 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
17.03.2011 14:04:31 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
17.03.2011 14:04:31 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/34  config=null
17.03.2011 14:04:31 org.apache.catalina.startup.Catalina start
INFO: Server startup in 438 ms

If the app is deployed I see a much longer log and the server needs a much longer time to start, so I can definately be sure that no app is deployed.

To get rid of this problem I am currently randomly removing and adding my app again and restarting eclipse until it finally works. This is, of course, not a solution, so maybe someone has an idea why things go wrong.

Thanks!

EDIT: Now I found out that the problem occurs sometimes under these circumstances: I change something in a resource file (JS/HTML), the file is repusblished, but not only this file but also some class files are republished. Suddenly after this happens, not all class files are present any more and the server is missing some classes.

Only stoppping the server, removing the app and closing eclipse works here.

EDIT 2: I could now further go into the problem. It seems that the eclipse auto publish functionality has some problems. If I totally switch off automatic republishing and republish manually, everything works out well.

like image 349
Erik Avatar asked Mar 17 '11 13:03

Erik


People also ask

Can eclipse deploy a web application to Tomcat?

It is important to note that eclipse will not publish the application to the server's webapps folder. It will deploy this web application to a temporary folder. Therefore, leaving the Tomcat installation unmodified.

How to deploy Tomcat application using WTP Maven integration?

Install WTP Maven integration (don't know if this is necessary) Project -> Run Configurations (Select your tomcat server) -> Run For a few hours I tried to deploy and start application using Servers window but it didn't worked. My war was not placed in wptwebapps folder, manually deplying war to webapps worked.

How to update Tomcat server configuration in Eclipse?

In eclipse. Window -> Show View -> Servers. Double click to your server. In Tomcat Server's Overview. That really helped, I realized that there are not all files I would expect. What solved my problem was to make right click on project > Maven > Update Project Configuration.

How do I use deploy method 3 in Tomcat?

Deploy method #3: using Tomcat’s manager application 1 View a list of applications deployed on the server and their status. 2 Start, stop and restart an individual application. 3 Deploy a new web application either by uploading a WAR file or supplying a directory on the server. 4 Undeploy an individual application.


2 Answers

I found a possible answer: One solution is to use the clean function for the webserver.

Right-click on the server to open the context menu and click clean. That worked so far under all circumstances for me ...

like image 102
Erik Avatar answered Sep 28 '22 01:09

Erik


Today, as I run my webapp on tomcat via eclipse I get the problem you notified. I inspect the problem and I find that the webapp isn't loaded even if manually deployed on the file system tomcat installation. I check the .war file and that WebContent folder isn't included in the package. So the problem is about the packaging operation: I solved it as follows: R-click on the project ---> properties ----> Deploy Assemply. Check the parameters, are they ok? I missed the WebContent folder! So I added it (mapping to "/" deploy path) and the problem is fixed.

Hope it helps.

like image 43
MaVVamaldo Avatar answered Sep 28 '22 00:09

MaVVamaldo