----- Message from lesmikesell@xxxxxxxxx ---------
Date: Fri, 09 May 2008 07:54:42 -0500
From: Les Mikesell <lesmikesell@xxxxxxxxx>
Reply-To: CentOS mailing list <centos@xxxxxxxxxx>
Subject: Re: can't get Tomcat5 to work on centos 5.1, how
do I get it to work?
To: CentOS mailing list <centos@xxxxxxxxxx>
Rudi Ahlers wrote:
Filipe Brandenburger wrote:
Hi,
On Thu, May 8, 2008 at 6:00 PM, Rudi Ahlers <Rudi@xxxxxxxxxxx> 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@vps06 /]# /etc/init.d/tomcat5 restart
Starting tomcat5: [ OK ]
[root@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@vps06 /]# ps -ef | grep java
root 14011 12038 0 02:40 pts/0 00:00:00 grep java
[root@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@xxxxxxxxx
_______________________________________________
Yea, I have upped the RAM to 1024MB, and it's working now.
Is this what you're looking for?
[root@vps06 ~]# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20070626 (Red Hat 4.1.2-14)
How / where does one optimize java's usage?
output from top:
top - 09:05:42 up 1:59, 1 user, load average: 0.02, 0.02, 0.00
Tasks: 30 total, 1 running, 29 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1048576k total, 799828k used, 248748k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 0k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
15908 tomcat 15 0 595m 134m 35m S 0 13.1 0:28.89 java
5506 mysql 18 0 133m 18m 3992 S 0 1.8 0:00.08 mysqld
14282 root 18 0 7440 5420 1600 S 0 0.5 0:00.01 miniserv.pl
10132 root 18 0 9144 2884 2200 S 0 0.3 0:00.09 sshd
19532 root 18 0 10428 2832 1388 S 0 0.3 0:00.00 httpd
3674 named 25 0 68504 2752 1756 S 0 0.3 0:00.00 named
19533 apache 25 0 10428 2096 628 S 0 0.2 0:00.00 httpd
19535 apache 25 0 10428 2096 628 S 0 0.2 0:00.00 httpd
19536 apache 25 0 10428 2096 628 S 0 0.2 0:00.00 httpd
19537 apache 25 0 10428 2096 628 S 0 0.2 0:00.00 httpd
19538 apache 25 0 10428 2096 628 S 0 0.2 0:00.00 httpd
19539 apache 25 0 10428 2096 628 S 0 0.2 0:00.00 httpd
19540 apache 25 0 10428 2096 628 S 0 0.2 0:00.00 httpd
19541 apache 25 0 10428 2096 628 S 0 0.2 0:00.00 httpd
11791 postfix 18 0 6820 1868 1496 S 0 0.2 0:00.00 qmgr
11789 root 18 0 6700 1768 1408 S 0 0.2 0:00.01 master
12080 postfix 18 0 6768 1760 1416 S 0 0.2 0:00.00 pickup
25774 root 15 0 2420 1312 1092 S 0 0.1 0:00.02 bash
11784 root 18 0 2420 1308 1088 S 0 0.1 0:00.03 bash
1985 root 17 0 2424 1304 1084 S 0 0.1 0:00.17 bash
5470 root 22 0 2416 1128 964 S 0 0.1 0:00.00 mysqld_safe
3376 root 18 0 3184 1104 576 S 0 0.1 0:00.00 crond
7548 root 18 0 6148 1036 668 S 0 0.1 0:00.00 sshd
10122 root 18 0 2172 1028 824 R 0 0.1 0:00.49 top
3326 root 20 0 2684 856 684 S 0 0.1 0:00.00 xinetd
1 root 15 0 2040 656 564 S 0 0.1 0:00.35 init
3297 root 18 0 1700 580 484 S 0 0.1 0:00.00 syslogd
11908 root 18 0 1664 440 368 S 0 0.0 0:00.00 tail
1980 root 15 0 1868 436 336 S 0 0.0 0:00.28 vzctl
25773 root 17 0 1872 316 216 S 0 0.0 0:00.00 vzctl
--
Kind Regards
Rudi Ahlers
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos