1

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

Biribu
  • 3,615
  • 13
  • 43
  • 79

3 Answers3

0

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.

Community
  • 1
  • 1
claj
  • 5,172
  • 2
  • 27
  • 30
  • I tried to do it with this line: export JAVA_OPTS="-Xms1024m -Xmx10246m -XX:NewSize=256m -XX:MaxNewSize=356m -XX:PermSize=256m -XX:MaxPermSize=356m" I added it on the last line available in catalina.sh but the error persist. – Biribu May 05 '14 at 09:14
  • OK. Can you connect to the JVM with jconsole and check what options the JVM actually has? – claj May 05 '14 at 10:24
  • How do I connect to JVM with jconsole? I think I deleted something neccessary. Now it doesn't start my servlet. I get SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". I will check right now before JVM console – Biribu May 05 '14 at 10:30
0

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.

Community
  • 1
  • 1
Mallik
  • 61
  • 5
  • I am doing an intensive cleaning of jar not used. I will tell you when I finish to see if I get something. – Biribu May 05 '14 at 09:11
0

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.

Emmerich Liang
  • 131
  • 1
  • 3