1

I have following configuration on my system.

JDK 1.6
Apache Tomcat 6.0.16
Windows 7

and i am using mysql-connector-java-5.1.21 jar file.

I have also set following parameter in Tomcat context.xml file

<Context antiResourceLocking="true" antiJARLocking="true">

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->

</Context>

Still when i undeploy my application it doesn't remove mysql-connector-java-5.1.21 jar everything else is removed.

when i tried to remove manually i got following error message:

File is open in Apache Tomcat

Please help

Ankur Raiyani
  • 1,509
  • 5
  • 21
  • 49
  • you need to stop tomcat before removing. I think tomcat is still openning the connection to database through the driver, therefore, it wont let you to delete the file – Thai Tran Jan 30 '13 at 07:56
  • yes if i stop the tomcat service i am able to remove that file – Ankur Raiyani Jan 30 '13 at 08:42
  • This problem is not about the jar file. Your appliction needs to handle transaction better so it wont keep the connection forever – Thai Tran Jan 30 '13 at 09:03
  • In application we am using Spring and Hibernate, so DB connection is completely handled by these frameworks. – Ankur Raiyani Jan 30 '13 at 09:05

1 Answers1

1

Tomcat 6 has some classpath locking problems while redeploying applications.

The solution that should always work is to stop the Tomcat and delete the application's directory with the jar in it.

flash
  • 6,730
  • 7
  • 46
  • 70