3

Disclaimer: I am not a server admin, I am a windows user that has lead a life of sinful installation wizards and drag and drop

I'm attempting to install Tomcat on CentOS 5 hosted by a MediaTemple dedicated virtual server.

I basically followed this guide:

  1. Installed jpackage and configured the yum.repo.d jpackage file to set enabled=1
  2. Used yum to install java (yum install java)
  3. Downloaded the binary distribution of tomcat with "wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.14/bin/apache-tomcat-6.0.14.tar.gz"
  4. set JAVA_HOME to point at the jdk location I found with "export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/"
  5. I gunzip/untar the Tomcat files and run ./startup.sh to start the Tomcat server. That is supposed to put the Tomcat server at myserver.com:8080 - however, I just get a could not contact host error when I try to browse to it (or when I try 'curl localhost:8080' from SSH) After I type ./startup.sh, here is the console output:

[root@myserver bin]# ./startup.sh

Using CATALINA_BASE:   /root/apache-tomcat-6.0.14

Using CATALINA_HOME:   /root/apache-tomcat-6.0.14

Using CATALINA_TMPDIR: /root/apache-tomcat-6.0.14/temp

Using JRE_HOME:       /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/

[root@myserver bin]#

Is there a step I have missed here?

Edit: I've now discovered by looking at the log the following error is occuring:

Error occurred during initialization of VM Could not reserve enough space for object heap

5 Answers 5

3

Is Tomcat6 the requirement? What version of Centos? (I'm assuming "Tomcat of some sort" and "current Centos" which would be 5.3 as of this writing)

You don't need the jpackage repo unless you want Tomcat 6. Also, Centos 5.3 ships with openjdk 1.6.0, which has passed the Java SE 6 TCK.

Simply "yum install tomcat5" should pull in all the dependencies you would need (including openjdk), many of which will be based off the jpackage sources. Once it's installed, all you need is "service tomcat5 start" to start it up. NOTE: Running your web container as root is very, very bad because it is a massive security risk. The tomcat5 service installed by the repository version will drop its permissions to a 'tomcat' user with more limited permissions. To have tomcat start automatically when the system boots, use "chkconfig tomcat5 on".

In your case above, the port 8080 is probably blocked by the default firewall. You can turn the firewall off (recommended only for testing connectivity, do not run without the firewall in production) with "service iptables stop". Centos provides both a GUI and Text UI tool (system-config-securitylevel and system-config-securitylevel-tui respectively) for modifying the firewall, or you can use iptables directly (see 'man iptables').

4
  • CentOS release 5.3 (Final) And you're correct, tomcat6 is not a requirement. I just tried "yum install tomcat5" and got the following dependency error: --> Finished Dependency Resolution java-1.4.2-gcj-compat-1.4.2.0-40jpp.115.i386 from base has depsolving problems --> Missing Dependency: /usr/bin/rebuild-security-providers is needed by package java-1.4.2-gcj-compat-1.4.2.0-40jpp.115.i386 (base) Error: Missing Dependency: jdk = 2000:1.5.0_09-fcs is needed by package java-1.5.0-sun-compat-1.5.0.09-1jpp.noarch (jpackage-generic-nonfree)
    – andybaird
    May 29, 2009 at 18:30
  • It sounds like it's picking up dependencies from the jpackage repo. My best guess based on the errors is that you only have the Sun JRE and not the JDK installed.
    – Ophidian
    May 29, 2009 at 19:26
  • When installing tomcat i got the same error as andybaid: Error: Missing Dependency: /usr/bin/rebuild-security-providers is needed by package java-1.4.2-gcj-compat-1.4.2.0-40jpp.115.i386 (base) any idea? Sep 28, 2009 at 18:17
  • @andybaird: i find a reply of your request here cpurigs.com/forums/showthread.php?t=4770 Sep 28, 2009 at 18:33
3

I solved this one after carefully following this guide:

http://de0ris.blogspot.com/2008/08/installing-tomcat-6x-on-centos-5.html

As mentioned in the comments above, JRE and JDK are separate downloads. I couldn't seem to find them in any package manager, so I had to download them directly and run them.

1
  • Caveat: This is mostly applicable for Sun's JRE/JDK and Tomcat 6. Centos 5.3 ships openjdk (java-1.6.0-openjdk for JRE / java-1.6.0-openjdk-devel for JDK) and Tomcat 5 (ver. 5.5.23) in its repositories.
    – Ophidian
    Jun 2, 2009 at 16:59
2

Well, it looks tomcat is starting correctly, and the typical stuff to miss has been covered. I'd check and see if the machine has a firewall running. I'm not a Centos expert, so I don't know off hand if they run one by default. As root do a:

netstat -lnp | grep 8080

If that returns anything, your server is running and listening on 8080, but something (a firewall) is blocking access to it.

If it's not running, you have something else to dig into. You should have a "catalina.out" file wherever you have tomcat set to log to. As I recall that should be "/path/to/tomcat/server/logs". Check that out and see if it's throwing any exceptions. Might give some more clues as to what's going on.

1
  • It looks like you are right, the log file contains the following: /root/apache-tomcat-6.0.14/bin/catalina.sh: line 273: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0//bin/java: No such file or directory
    – andybaird
    May 29, 2009 at 18:31
1

Error occurred during initialization of VM Could not reserve enough space for object heap

There is not enough virtual memory to startup the VM. That is, there is not enough physical memory and swap to accommodate the heap side you requested with -Xms. As you're running inside a virtual environment, you'll need to talk to Media Temple about increasing the amount of virtual memory available to your instance.

0

Hmm Its basically you are on open VZ VPS, Try xen or install jboss it comes with tomcat as well this will solve the memory swap issue.

http://davidanand.blogspot.com/2010/06/jboss-tomcat-on-openvz-centos.html

Hope this helps ;)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .