Reputation: 28744
I'd like to do hot deployment in tomcat, but fails. I use maven tomcat plugin to to deployment. When I invoke "mvn tomcat:redeploy", the war is uploaded to tomcat webapps folder successfully. But it is not unpacked successfully, because the my original webapplication folder is not removed successfully. There's still a oracle jdbc jar exist under WEB-INF/lib. And it can not been delete event when I try to delete it manually. It tells me that there's one process is using it. I guess the jdbc connection is not released.
How can I solve this problem ? Thanks
Jeff Zhang
Upvotes: 3
Views: 2314
Reputation: 220
you can change antiJarLocking and antiResourceLocking properties in context.xml of tomcat,then the old war can be successfully removed so you will be able to redeploy yourr app.
<Context antiJARLocking="true" antiResourceLocking="true">
Upvotes: 5
Reputation: 57707
Webapps not undeploying can be caused by the webapp not being fully garbage collected due to references outside of your webapp classloader holding on to some instances/classes in the webapp. This will then lock those jars in the webapp preventing the webapp files from being removed.
Is this your own webapp? If so, you should try profiling it in tomcat with a memory profiler - do a deploy, use and undeploy cycle and see what references are retaining classes/instances of your webapp.
Since it's the jdbc driver, I'd start by looking at the data source. For example, if you are using Spring to configure the data source, ensure that the datasource is closed. E.g.
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
The destroy-method="close"
ensures that the datasource is properly shutdown when the webapp terminates.
Upvotes: 1