Is Tomcat 6 ready for continuous integration or how to get it work?
I'm looking for a hint how to make tomcat CI ready or an servlet container / application container which stand often redeploys like they happen when using hudson ci.
I experienced that Tomcat 6 do开发者_如何学运维es not properly undeploy webapps, leaving classes in jvm.
For example I monitored tomcat 6 with VisualVM: on start 2000 classes, on deploy of an app 3000 after redeploy 4000 and redeploy 5000 classes and so on - leading to crashes, memory leaks...
Okay hope one have a hint on tomcat and continuous-integration or other app servers.
Update : I've performed some tests with a moderately complex web application using Spring, Hibernate, GWT, C3P0 and HsqlDB.
Stock Tomcat 6.0.24 works just fine , provided you use the client compiler. It works on ten redeploys, whereas the server compiler breaks down on the fourth. I suggest you try with the -client
flag.
Trying to debug the usage of the server compiler was fruitless, as the Eclipse MAT showed no GC roots for the classloaders, and yet they were retained. An oft-referenced bug , PermHeap bloat in and only in server VM was reportedly fixed in Java 6 update 16, but my tests fail with Java 6 update 16.
Tomcat has been checked and double-checked for such memory problems, and quite often the applications were to blame. No that is not to say that it's necessarily hard to have such a perm gen leak.
There are two possibilities here:
- use the latest Tomcat 6.0.26 , which has recently received memory leak detection capabilities : basic memory leak detection was added to the standard Host implementation and exposed via JMX to detect memory leaks on web application reload. (markt/kkolinko)
- embed the container and run using a container-per-application model. Tomcat, Jetty and Winstone are all well-suited for this.
If you actually want to debug this problem and make sure that it's Tomcat's fault, you can you the Eclipse memory analyser. They have a good blog post explaining how to debug PermGen problems.
I always like to take drastic measures to make sure that everything is clean and in a fully reproducible state when starting
1) kill tomcat
2) delete it from disk
3) unzip a clean version
4) overwrite your personalized modified configured files
5) restart tomcat
6) deploy your app
Take a look at Apache Cactus - it's a framework for server-side in-container unit testing. It works pretty much with any servlet container.
精彩评论