简体   繁体   English

Tomcat6问题和PermGen空间

[英]Tomcat6 problems and PermGen space

I am experimenting some issues while deploying my app in the production server. 在生产服务器中部署我的应用程序时,我正在尝试一些问题。

I have an ubuntu machine for development in which my servlet works fine. 我有一台用于开发的ubuntu机器,其中的servlet工作正常。 About a month without problems. 大约一个月没有问题。

Then I deploy it to my production machine (VM debian). 然后,将其部署到我的生产机器(VM debian)上。 I stopped tomcat, I copy war file to the webapps folder and start tomcat again. 我停止了tomcat,将war文件复制到webapps文件夹,然后再次启动tomcat。

First, when I try to stop/start/restart tomcat, I get this "error": 首先,当我尝试停止/启动/重启tomcat时,出现此“错误”:

root@VMMachine-34199:~/folder# sudo /etc/init.d/tomcat6  restart
[ ok ] Stopping Tomcat servlet engine: tomcat6 Tomcat servlet engine is not running but pid file exists, cleaning up.
[ ok ] Starting Tomcat servlet engine: tomcat6.
root@VMMachine-34199:~/folder# sudo /etc/init.d/tomcat6  status
[ ok ] Tomcat servlet engine is running with pid 22627.
root@VMMachine-34199:~/folder# sudo /etc/init.d/tomcat6  status
[ ok ] Tomcat servlet engine is not running, but pid file exists..

I don't know what to do to avoid this. 我不知道该怎么做才能避免这种情况。 Always happends just in production machine. 总是发生在生产机器中。

After that, I have this other problem, don't know if related to the first one. 之后,我还有另一个问题,不知道是否与第一个问题有关。

In catalina.out I get: 在catalina.out中,我得到:

java.net.BindException: Address already in use <null>:9010 

9010 is the tomcat port. 9010是tomcat端口。 This port is just used to connect to one of my deployed wars by other service I have. 该端口仅用于通过我拥有的其他服务连接到我部署的战争之一。 With netstat -atnp |grep 9010 I see just the other service LISTEN. 使用netstat -atnp | grep 9010,我只能看到其他服务LISTEN。

But after this, tomcat seems to start, register both resources availables in my servlet and so on. 但是之后,tomcat似乎开始启动,在我的servlet中注册这两个可用资源,依此类推。

And at the end, I get this in catalina.out: 最后,我在catalina.out中得到了这个:

May 05, 2014 8:34:29 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat6/webapps/SERVLET/WEB-INF/lib/servlet-api-2.3.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:   javax/servlet/Servlet.class
May 05, 2014 8:34:47 AM org.apache.tomcat.util.digester.Digester endElement
SEVERE: End event threw error
java.lang.OutOfMemoryError: PermGen space

May 05, 2014 8:34:47 AM org.apache.tomcat.util.modeler.Registry registerComponent
SEVERE: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/SERVLET,J2EEApplication=none,J2EEServer=none
May 05, 2014 8:34:47 AM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory SERVLET
java.lang.OutOfMemoryError: PermGen space

As I already said, in development machine, tomcat works fine and has never given me those errors so I don't know how to deal with them. 正如我已经说过的,在开发机中,tomcat可以正常工作,并且从未给我这些错误,因此我不知道如何处理它们。

I am using this library Log4j . 我正在使用此库Log4j。 I read here: http://javarevisited.blogspot.com.es/2012/01/tomcat-javalangoutofmemoryerror-permgen.html can causes Permgem error. 我在这里阅读: http ://javarevisited.blogspot.com.es/2012/01/tomcat-javalangoutofmemoryerror-permgen.html会导致Permgem错误。 Don't know if this can help you to figure out my problem 不知道这是否可以帮助您解决我的问题

Now I get this while starting and it stops: 现在我在启动时得到了它,它停止了:

May 5, 2014 8:42:17 AM org.apache.coyote.http11.Http11Protocol pause INFO: Pausing Coyote HTTP/1.1 on http-9010 May 5, 2014 8:42:18 AM org.apache.catalina.core.StandardService stop INFO: Stopping service Catalina May 5, 2014 8:42:18 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/SERVLET] appears to have started a thread named [Timer-0] but has failed to stop it. 2014年5月5日,上午8:42:17 org.apache.coyote.http11.Http11协议暂停INFO:在http-9010上暂停土狼HTTP / 1.1 2014年5月5日,上午8:42:18 org.apache.catalina.core.StandardService停止信息:正在停止服务Catalina 2014年5月5日上午8:42:18 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads严重:Web应用程序[/ SERVLET]似乎已启动名为[Timer-0]的线程,但失败了阻止它。 This is very likely to create a memory leak. 这很可能造成内存泄漏。 May 5, 2014 8:42:18 AM org.apache.coyote.http11.Http11Protocol destroy INFO: Stopping Coyote HTTP/1.1 on http-9010 2014年5月5日,上午8:42:18 org.apache.coyote.http11.Http11Protocol销毁INFO:在http-9010上停止土狼HTTP / 1.1

Try to increase the PermGen size of the VM on your production server (it's a memory area in the JVM reserved classes and some other constants that are guaranteed not to change and seldom is needed to be garbage collected). 尝试增加生产服务器上VM的PermGen大小(这是JVM保留类中的内存区域,以及一些其他常量,保证不更改,并且很少需要进行垃圾回收)。

See Increase PermGen Space question. 请参阅增加PermGen空间问题。

Shut down the service to verify or change port of either service or tomcat. 关闭服务以验证或更改服务或tomcat的端口。 Try increasing jvm memory check this link Increase permgen space Try changing to 64bit JVM if ubuntu 64 bit OS. 尝试增加jvm内存,请检查此链接,以增加permgen空间 。如果是ubuntu 64位操作系统,请尝试更改为64位JVM。 May be application jars grown in size. 可能是大小增长的应用程序罐。 Reduce the application jars being used if unused or unnecessary. 如果未使用或不必要,请减少使用的应用程序jar。 Get dump and verify which thread failed. 获取转储并验证哪个线程失败。

how you "I stopped tomcat" ? 你如何“我停止了tomcat”?

I always 我总是

kill -9 ${pid} 

but not using 但不使用

${tomcat_home}/bin/shutdown.sh .

there's problem using shutdown.sh script. 使用shutdown.sh脚本存在问题。

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

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