6

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.

Erik
  • 11,944
  • 18
  • 87
  • 126
  • Have you tried removing and adding your webapp from Tomcat server inside Eclipse? – anubhava Mar 17 '11 at 13:21
  • I do it a dozen times to get it working again ... – Erik Mar 17 '11 at 13:34
  • I've had a similar problem when using maven without the maven plugin 'couse it seems eclipse does not behave well when the classes were not compiled by him. To solve this problem, whenever I was up to start the tomcat server and I've already compiled the classes with maven, I used to clean the project to tell eclipse to recompile all classes. Mabe it gives you some clues on solving your problem. – Iogui Mar 17 '11 at 18:29
  • As stated in the EDIT part, I also guess it has to do with the classes, but cleaning both the tomcat and the web app are no solution for me. – Erik Mar 17 '11 at 21:46
  • @Erik - This is so frustrating. I made an very slight change to a JSP, and now not only does my webapp not auto deploy, but when Tomcat is running, none of the webapps are available. Nothing in the logs to indicate what is wrong either. How to I remove and add my webapp from Tomcat server in Eclipse as suggested above. Do you mean simply delete the project and re-import it? – Mr Moose May 07 '12 at 07:32
  • @MrMoose by "add and remove" is meant, that when you are in servers view in Eclipse, you can right click on Tomcat, see screenshot - http://i.imgur.com/yMvJb.png – Betlista Sep 07 '12 at 10:04

3 Answers3

4

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 ...

Erik
  • 11,944
  • 18
  • 87
  • 126
  • 4
    Doesn't help me. All my projects are listed as "Synchronized" but none of them are actually deployed in ~\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps – mjaggard Apr 04 '13 at 14:48
3

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.

MaVVamaldo
  • 2,505
  • 7
  • 28
  • 50
1

I have the same problem, and it seems to be important to clear the server after the app is removed (before redeploying it).

T.Rob
  • 31,522
  • 9
  • 59
  • 103
Ralph
  • 118,862
  • 56
  • 287
  • 383
  • I will give that a try. I furthermore could reproduce the problem a little (see above in my post) – Erik Mar 17 '11 at 18:10