简体   繁体   中英

Get the heap dump when Tomcat runs OutOfMemory

I want to get the hprof file(dump) to analyze the OOME.

The application is deployed in tomcat, it is running as a windows service. I used this link to change my catalina.bat file and also tried by placing a setenv.bat file. And then I manually generated out of memory in the application.

I can see the application going out of memory, but the dump is never created, am I missing something here ?

However in my local development environment when I used the jvisualvm to create the dump, the dump was successfully created.

I tried many things and in the end I found out that when the tomcat service is started as a service from the tomcat.exe setting the environment variables at catalina.bat will have no effect, for this tomcat has provided tomcat7w.exe this is present in the /bin directory.

But while configuring your tomcat as a windows service you have changed the name of that service to say fooBar then you need to rename tomcat7w.exe to fooBarw.exe and then you can configure different variables in the console window.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM