Meaningless Drivel is fun!*
The moose likes Tomcat and the fly likes Tomcat server restarted automatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat server restarted automatically" Watch "Tomcat server restarted automatically" New topic
Author

Tomcat server restarted automatically

Aby Arackal peter
Greenhorn

Joined: Apr 26, 2011
Posts: 7
Hi All,

I am using Tomcat 5.5.17 in Production.From the last few days the server is restarting automatically.Why it is happening?

Before, I have increased the tomcat memory.

For that I have used the command ' export JAVA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=128m" '.

kindly give me a solution. Its very urgent.

thanks,

Aby


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61450
    
  67

Welcome to the Ranch.

Aby Arackal peter wrote:Its very urgent.

Please read EaseUp to understand why this is not going to make anyone answer faster. Quite the opposite, in fact.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19725
    
  20

Check out your Tomcat logs.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Aby Arackal peter
Greenhorn

Joined: Apr 26, 2011
Posts: 7
Hi,

Please see the portion of the server logs.

org.hibernate.TransactionException: Transaction not successfully started

Jan 24, 2012 11:03:48 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/local/apache-tomcat-5.5.17/webapps/CT/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jan 24, 2012 11:04:13 AM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-80
Jan 24, 2012 11:04:14 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jan 24, 2012 11:04:14 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/70 config=null
Jan 24, 2012 11:04:14 AM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
DB PoolWatcher
Jan 24, 2012 11:04:14 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 40659 ms

This is repeatedly coming in the log.

Thanks,

Aby

Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
That all looks OK (except for the Hibernate error, but that most likely has nothing to do with Tomcat).

But Tocmat does not restart itself; there must be a script or some other external process that does that.
Aby Arackal peter
Greenhorn

Joined: Apr 26, 2011
Posts: 7

Thanks Tim .

Also Please tell me about the command export JAVA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=128m". Because already I have applied this command in tomcat ' setenv.sh' file for increasing memory.

is it any problem?

Thanks,

Aby
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

If I'm reading the log correctly, the WAR is defective. It contains a "servlet-api.jar" file in it which will conflict with the servlet-api.jar in the Tomcat server library directory, and that would definitely be enough to scramble the webapp's brains at least, if not actually bring down Tomcat.

A note about setenv.sh: If you're coding the "export" on your environment setting, don't do that. All you need is the "name=value" setting. This file is "source"d by the Tomcat script, so the environment is already propagated correctly without the need to export it.


Customer surveys are for companies who didn't pay proper attention to begin with.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Tim Holloway wrote:It contains a "servlet-api.jar" file in it which will conflict with the servlet-api.jar in the Tomcat server library directory, and that would definitely be enough to scramble the webapp's brains at least, if not actually bring down Tomcat.

I fairly certain that it won't. Tomcat is smart enough not to load the classes contained in servlet-api.jar and jsp-api.jar (that's what that message says, after all). I've taken a look at web apps that contained those jars in WEB-INF/lib for years without problems. Nonetheless, the jar file should be removed.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

Tim Moores wrote:
Tim Holloway wrote:It contains a "servlet-api.jar" file in it which will conflict with the servlet-api.jar in the Tomcat server library directory, and that would definitely be enough to scramble the webapp's brains at least, if not actually bring down Tomcat.

I fairly certain that it won't. Tomcat is smart enough not to load the classes contained in servlet-api.jar and jsp-api.jar (that's what that message says, after all). I've taken a look at web apps that contained those jars in WEB-INF/lib for years without problems. Nonetheless, the jar file should be removed.


True up to a point. However, the warning has 2 purposes. Firstly, WARs are supposed to be portable, and this is a warning that less diligent servers than Tomcat could have trouble. Secondly, servlet-api.jar is unversioned. Which means that a webapp could be using an API that's out of sync with the Tomcat servlet-impl.jar.

So the servlet-api.jar should definitely be removed. Also a check should be made that there's no copy of the servlet-impl.jar in the WAR, just in case Tomcat didn't see fit to warn.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat server restarted automatically