[CentOS] can't get Tomcat5 to work on centos 5.1, how do I get it to work?

Fri May 9 12:54:42 UTC 2008
Les Mikesell <lesmikesell at gmail.com>

Rudi Ahlers wrote:
> Filipe Brandenburger wrote:
>> Hi,
>>
>> On Thu, May 8, 2008 at 6:00 PM, Rudi Ahlers <Rudi at softdux.com> wrote:
>>  
>>> Exception in thread "main" java.lang.OutOfMemoryError: Cannot create
>>>     
>>
>> It looks like it's running out of memory when starting more threads.
>> Did you check if you have enough memory in this server to run Tomcat?
>> I think you need at least 512MB for it, but I would recommend more.
>>
>> I know there are some tunings made to the JVM for it to request more
>> memory. If you do "ps -ef | grep java" when Tomcat is started you will
>> see some parameters starting with -X that will specify memory sizes,
>> check how much it requests. I don't really know how to tweak those,
>> check the script that starts Tomcat to see if it allows changing them.
>>

> 
> 
> What you're saying could be true, but I don't think it's the case.
> 
> I have confirmed with the client, and he says that 128MB RAM would be 
> enough for his app.

The default config is probably asking for more than that.


> [root at vps06 /]# /etc/init.d/tomcat5 restart
> Starting tomcat5:                                          [  OK  ]
> [root at vps06 /]# ps -ef | grep java
> tomcat   13918     1 62 02:40 ?        00:00:02 
> /usr/lib/jvm/java/bin/java 
> -Dcatalina.ext.dirs=/usr/share/tomcat5/shared/lib:/usr/share/tomcat5/common/lib 
> -Dcatalina.ext.dirs=/usr/share/tomcat5/shared/lib:/usr/share/tomcat5/common/lib 
> -Djava.endorsed.dirs=/usr/share/tomcat5/common/endorsed -classpath 
> /usr/lib/jvm/java/lib/tools.jar:/usr/share/tomcat5/bin/bootstrap.jar:/usr/share/tomcat5/bin/commons-logging-api.jar:/usr/share/java/mx4j/mx4j-impl.jar:/usr/share/java/mx4j/mx4j-jmx.jar 
> -Dcatalina.base=/usr/share/tomcat5 -Dcatalina.home=/usr/share/tomcat5 
> -Djava.io.tmpdir=/usr/share/tomcat5/temp 
> org.apache.catalina.startup.Bootstrap start
> 
> [root at vps06 /]# ps -ef | grep java
> root     14011 12038  0 02:40 pts/0    00:00:00 grep java
> [root at vps06 /]# free -m
>             total       used       free     shared    buffers     cached
> Mem:           256         20        235          0          0          0
> -/+ buffers/cache:         20        235
> 
> 
> As you can see, the first time I ran "ps -ef | grep java" I could see 
> that it's starting up, but the second time, it's not running
> 
> I have another terminal open with top running, and the memory usage 
> didn't even blink when I ran it

What jvm are you running?  Chances are that you will have to install the 
Sun version to run the app(s) so you might want to do that before much 
other troubleshooting.


-- 
   Les Mikesell
    lesmikesell at gmail.com