简体   繁体   English

当Tomcat运行OutOfMemory时获取堆转储

[英]Get the heap dump when Tomcat runs OutOfMemory

I want to get the hprof file(dump) to analyze the OOME. 我想获取hprof文件(转储)来分析OOME。

The application is deployed in tomcat, it is running as a windows service. 该应用程序部署在tomcat中,作为Windows服务运行。 I used this link to change my catalina.bat file and also tried by placing a setenv.bat file. 我使用此链接更改了catalina.bat文件,还尝试通过放置setenv.bat文件进行尝试。 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. 但是,在本地开发环境中,当我使用jvisualvm创建转储时,转储已成功创建。

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. 我尝试了很多事情,最后我发现,当tomcat服务作为tomcat.exe的服务启动时,将环境变量设置为catalina.bat不会起作用,因为该tomcat提供了tomcat7w.exe因此存在在/bin目录中。

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. 但是在将tomcat配置为Windows服务时,您已将该服务的名称更改为fooBar然后需要将tomcat7w.exe重命名为fooBarw.exe ,然后可以在控制台窗口中配置其他变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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