Customer modified the wrapper.conf file with the expectation that a heap dump file would be generated in the event of a hung jvm or an OutOfMemoryError event. The file was not found after a hung JVM event.
Tomcat was running on a Windows system, and the path to the dump directory contained backslashes. Backslashes are interpreted as an escape character, and they must be surrounded by double quotes in order to be interpreted correctly by tomcat / tc Server.
The following example shows how to format settings in wrapper.conf on a Windows system.
See section 8 below for the options that will enable automatic generation of a heap dump file (file name in a format like java_pid<PID-number>.hprof.
# ==============================================================
# wrapper.conf – Windows Production Template (Tomcat 9/10/11)
# Copy → C:\tomcat\conf\wrapper.conf (overwrite the old one)
# ==============================================================
# 1. App name (shows in Services)
wrapper.name=Tomcat11
wrapper.displayname=Apache Tomcat 11
wrapper.description=Tomcat 11 – Production
# 2. PID file (lets wrapper kill the right JVM)
wrapper.pidfile="C:\tomcat\logs\tomcat.pid"
# 3. Logging – one file, auto-rotate 10 × 10 MB
wrapper.logfile="C:\tomcat\logs\wrapper.log"
wrapper.logfile.maxsize=10m
wrapper.logfile.maxfiles=10
wrapper.loglevel=INFO
# 4. JVM location (64-bit only!)
wrapper.java.command="C:\Program Files\Java\jdk-21\bin\java.exe"
# 5. Classpath – NEVER use wildcards on Windows
wrapper.java.classpath.1="C:\tomcat\bin\bootstrap.jar"
wrapper.java.classpath.2="C:\tomcat\bin\tomcat-juli.jar"
wrapper.java.classpath.3="C:\tomcat\lib\*"
# 6. Main class
wrapper.java.mainclass=org.apache.catalina.startup.Bootstrap
# 7. JVM memory – change only these 2 lines
wrapper.java.additional.1="-Xms2g"
wrapper.java.additional.2="-Xmx6g"
# 8. Heap-dump on any hang or OOM
wrapper.java.additional.3="-XX:+HeapDumpOnOutOfMemoryError"
wrapper.java.additional.4="-XX:HeapDumpPath=C:\dumps"
wrapper.java.additional.5="-XX:+ExitOnOutOfMemoryError"
# 9. GC: G1 for < 32 GB heap (fast pause times)
wrapper.java.additional.6="-XX:+UseG1GC"
wrapper.java.additional.7="-XX:MaxGCPauseMillis=200"
# 10. Survive crashes – restart 10× then give up
wrapper.max_failed_invocation_count=10
wrapper.autorestart=true
# 11. Graceful shutdown (60 sec)
wrapper.shutdown.timeout=60
wrapper.jvm.shutdown.timeout=30
# 12. Run as Windows service (LOCAL SYSTEM is fine)
wrapper.ntservice.name=Tomcat11
wrapper.ntservice.displayname=Apache Tomcat 11
wrapper.ntservice.description=Tomcat 11 Production
wrapper.ntservice.starttype=AUTO_START
wrapper.ntservice.interactive=false
# 13. Hide console window
wrapper.console.visible=false
wrapper.ntservice.console=true
# 14. Lock pages (prevents paging of JVM)
wrapper.windows.lock_pages=true