Biribu
Biribu

Reputation: 3833

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. About a month without problems.

Then I deploy it to my production machine (VM debian). I stopped tomcat, I copy war file to the webapps folder and start tomcat again.

First, when I try to stop/start/restart tomcat, I get this "error":

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:

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

9010 is the tomcat port. 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.

But after this, tomcat seems to start, register both resources availables in my servlet and so on.

And at the end, I get this in 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.

I am using this library Log4j . I read here: http://javarevisited.blogspot.com.es/2012/01/tomcat-javalangoutofmemoryerror-permgen.html can causes Permgem error. 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. 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

Upvotes: 1

Views: 1143

Answers (3)

Emmerich  Liang
Emmerich Liang

Reputation: 141

how you "I stopped tomcat" ?

I always

kill -9 ${pid} 

but not using

${tomcat_home}/bin/shutdown.sh .

there's problem using shutdown.sh script.

Upvotes: 0

Mallik
Mallik

Reputation: 61

Shut down the service to verify or change port of either service or tomcat. Try increasing jvm memory check this link Increase permgen space Try changing to 64bit JVM if ubuntu 64 bit OS. May be application jars grown in size. Reduce the application jars being used if unused or unnecessary. Get dump and verify which thread failed.

Upvotes: 0

claj
claj

Reputation: 5412

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).

See Increase PermGen Space question.

Upvotes: 0

Related Questions