Hi all
A client of ours wants Tomcat 5 to be installed on a CentOS 5 server, I naturally just ran "yum -y install tomcat5 tomcat5-webapps tomcat5-admin-webapps" which installed it without any errors. Then I typed in service tomcat5 start, and tries to access it as such "lynx http://localhost:8080/" but keep on getting an error "connection refused"
[root@vps06 /]# service tomcat5 start Starting tomcat5: lock file found but no process running for pid 19684, continuing [ OK ]
I don't see any tomcat errors in /var/log/messages but get this:
[root@vps06 /]# tail -f /var/log/tomcat5/catalina.out at org.apache.catalina.core.StandardService.start(catalina-5.5.23.jar.sonuy1u1.so) at org.apache.catalina.core.StandardServer.start(catalina-5.5.23.jar.sonuy1u1.so) at org.apache.catalina.startup.Catalina.start(catalina-5.5.23.jar.sonuy1u1.so) at java.lang.reflect.Method.invoke(libgcj.so.7rh) ...2 more Exception in thread "main" java.lang.OutOfMemoryError: Cannot create additional threads at java.lang.Thread.start(libgcj.so.7rh) at java.lang.Runtime.runShutdownHooks(libgcj.so.7rh) at java.lang.Runtime.exitNoChecks(libgcj.so.7rh) at java.lang.Runtime.exitNoChecksAccessor(libgcj.so.7rh)
I don't know Tomcat at all.
Can someone please help me with this?
Hi,
On Thu, May 8, 2008 at 6:00 PM, Rudi Ahlers Rudi@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.
HTH, Filipe
Filipe Brandenburger wrote:
Hi,
On Thu, May 8, 2008 at 6:00 PM, Rudi Ahlers Rudi@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.
HTH, Filipe _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
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.
[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
Rudi Ahlers wrote:
Filipe Brandenburger wrote:
Hi,
On Thu, May 8, 2008 at 6:00 PM, Rudi Ahlers Rudi@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@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.
----- Message from lesmikesell@gmail.com --------- Date: Fri, 09 May 2008 07:54:42 -0500 From: Les Mikesell lesmikesell@gmail.com Reply-To: CentOS mailing list centos@centos.org Subject: Re: [CentOS] can't get Tomcat5 to work on centos 5.1, how do I get it to work? To: CentOS mailing list centos@centos.org
Rudi Ahlers wrote:
Filipe Brandenburger wrote:
Hi,
On Thu, May 8, 2008 at 6:00 PM, Rudi Ahlers Rudi@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@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@gmail.com _______________________________________________
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
Hi,
On Fri, May 9, 2008 at 9:06 AM, Rudi Ahlers Rudi@softdux.com wrote:
Mem: 1048576k total, 799828k used, 248748k free, 0k buffers Swap: 0k total, 0k used, 0k free, 0k cached
You have no swap on the machine! Try adding it. You can do that by creating a big file with "dd" and using "swapon" to start using it. Try starting Tomcat after that, I'm sure it will work.
HTH, Filipe
Rudi Ahlers wrote:
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.
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)
Note that gcj is not a full java implementation. If it works, it might be faster, though.
How / where does one optimize java's usage?
The [vm:] section of /etc/tomcat5/workers2.properties looks likely.