This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a problem with Tomcat hot deployment. Any help will be heartity appreciated.
I am working on various web applications one of them being a Struts2 application. When I deploy the war file from Elcipse, the war is not exploded property.
So I have to Stop Tomcat -> Delete the context of the application -> Restart Tomcat, everytime I want to deploy the changes.
This is a problem only with the Struts2 application. Other applications are working all right.
Googling I came to know of setting attributes [reloadable="true" antijarlocking="true" antiresourcelocking="true"] in Context.xml but that too does not solve the problem.
Here is my environment detail:
Tomcat : 5.5.25
Eclipse for Java developer : 3.2.2
JDK : 1.5
Actually, I'm not really sure if exploding WARs has that much benefit unless you intend to go in and modify the live copy of the WAR in the server, but in current releases of Tomcat, explosion is turned on by default.
Despite how it looks, there's nothing Struts-specific about this. If you copy a new WAR file into TOMCAT_HOME/webapps, Tomcat will ignore it as long as there's an exploded WAR in the same directory, even though the WARfile is newer.
If you delete the WAR directory and there's a WARfile, it "should" explode the WARfile when the next request comes in. If there is no WARfile and you have a Context file in conf/Catalina/localhost, Tomcat will delete the Context file , which will undeploy the application.
There is a general problem with hot deployment in that a lot of times if you deploy a new set of servlets, the init() method of the new servlet won't be (re)invoked. This can be a problem for systems like Struts or JavaServerFaces, where config information is being read in and distilled. I've also had issues with ORM systems and hot-deployment for similar reasons.
An IDE is no substitute for an Intelligent Developer.