Tomcat uses too much memory when inside Tomcat lib folder

When aspose-words-19.11-jdk17.jar is placed inside the apache-tomcat-8.5.47\lib folder, after starting Tomcat will use too much memory and it takes too long to startup the server.
This is tested on Windows with Oracle JDK 8 and OpenJDK 11.02.

Some numbers:

  1. Starting up tomcat without Aspose: 682ms and 122 RAM memory usage
  2. Starting up tomcat with Aspose in Tomcat/lib folder: 197271ms and 2GB RAM memory usage
  3. Starting up tomcat with Aspose in Tomcat/webapp/examples/WEB-INF/lib folder: 2243ms and 200MB RAM memory usage

Interesting enough, when aspose-words-19.11-jdk17.jar is placed in the .war’s WEB-INF/lib folder instead, the memory usage goes back to normal and the server starts up much faster.

Could you please indicate what the issue is? It can be reproduced by simply downloading Tomcat from the website of Apache Tomcat, copying the Aspose Words jar into Tomcat/lib folder and starting Tomcat using Tomcat/bin/startup.bat

logs.zip (25.9 KB)

@avandenhoogen

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSJAVA-2249. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@avandenhoogen

Please note that Tomcat 8 runs slowly due to scanning of JARs. It’s common Tomcat 8 issue. We can suggest you following workaround. In order to disable scanning of Aspose.Words:

  • Go to Tomcat’s conf directory
  • Open file catalina.properties
  • Navigate to tomcat.util.scan.StandardJarScanFilter.jarsToSkip property
  • Amend the property like the following:

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=
annotations-api.jar,
…
xom-.jar,
aspose-
.jar

After this Tomcat will start in one to two seconds and consume something about 120 Megabytes of RAM.

Hope this helps you.

1 Like

@avandenhoogen

I analyzed this problem from my side and the startup time using Aspose.Words for Java 22.1 is about 2 minutes. Please try to use the latest version and follow the previous recommendations to speed up the loading process:

  1. Go to Tomcat’s conf directory
  2. Open file catalina.properties
  3. Navigate to tomcat.util.scan.StandardJarScanFilter.jarsToSkip property
  4. Amend the property like the following:

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=
annotations-api.jar,
xom-.jar,
aspose-
.jar

This is a known Tomcat’s problem: logging - How to fix JSP compiler warning: one JAR was scanned for TLDs yet contained no TLDs? - Stack Overflow.

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

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