Tomcat undeployment not possible after reading license

Hello,
we have discovered the problem that after aspose words reads the license, the webapp cannot be undeployed from the tomcat anymore. The undeployment fails and the aspose-words.jar in the directory “webapps<webappName>\WEB-INF\lib” is not deleted.

I made an example maven project to reproduce this problem.
readingLicenseBlocksUndelpoymentExampleProject.zip (4.5 KB)

Steps to reproduce:

  1. Unzip the attached project
  2. Put a valid license with the file name “Aspose.Words.lic” in the directory “\src\main\resources\org\example” (I could not include our license so you need to put one there)
  3. Build the project (e.g. “mvn clean install”)
  4. Start a tomcat with the generated webapp and a tomcat manager webapp
  5. Undeploy with the following command curl --user admin:admin -X GET "http://localhost:8080/manager/text/undeploy?path=/<WAR-NAME>" (Standard .war name should be “readingLicenseBlocksUndeployment-1.0-SNAPSHOT”)

The undeployment should fail and the aspose-words.jar should still be available in the directory mentioned above.

@FlorianM We are working on your query and will reply you soon.

@FlorianM We have managed to reproduce the problem. It has been logged as WORDSJAVA-2677. We will keep you informed and let you know once it is resolved.

@FlorianM This is a native Tomcat problem, especially for Windows. Some files may be locked when the web application is deployed. I found a similar problem here: java - How to delete loaded Jar files in tomcat? - Stack Overflow. But antiJARLocking is a subset of antiResourceLocking ant Tomcat since 8.5 doesn’t include antiJARLocking attribute (Apache Tomcat 8 Configuration Reference (8.5.95) - The Context Container).

So, to prevent such problems, insert the following line into your …\conf\context.xml file:
<Context antiResourceLocking="true">

This issue is closed because it’s not our bug but Tomcat’s own problem.

@alexey.maslov When using Aspose.Words version 19.12 I cannot recreate the undeployment issue. This problem only occurs on newer versions. How can that be explained?

@FlorianM Thanks for this observation. I tested this scenario on my side using Aspose.Words version 19.12 and the undeployment issue didn’t reproduce. It has been logged as WORDSJAVA-2685. We will further look into the details of this problem and will keep you updated on the status of linked issue. Sorry for the inconvenience.

The issues you have found earlier (filed as WORDSJAVA-2677) have been fixed in this Aspose.Words for Java 22.2 update.

@alexey.maslov I updated the Aspose.Words version in the example project I attached to my opening post. But I still get the error message when undeploying. The Aspose.Words version 22.2 does not seem to fix the issue. Could you please verify, if you get the undeployment error too when using the example project?

@FlorianM Yes, I also get an undeployment error when using the sample project. This issue has been logged as WORDSJAVA-2685. We will keep you informed and let you know once it is resolved.

As a temporary solution, you can paste the following line into your …\conf\context.xml file:
<Context antiResourceLocking="true">

Sorry for the inconvenience.