Argh. So, if you tried installing tomcat5.5 from the repositories, you may have noticed that it's broken. You get a configuration error about JAVA_HOME not being set. Actually, there are three problems!
All looks well when you run the startup script...
The problem arises from a fifo at /usr/share/tomcat5.5/logs/catalina.out which is the target for
normal console output from the catalina (tomcat launch) script. This fifo doesn't flow at all.
Replacing it with a regular file fixes the problem and tomcat launches OK.
###############################################
Here's what you can do to get it to work:
1) Install
Code:
sudo aptitude install sun-java6-jdk tomcat5.5
(Note that you absolutely need the JDK, not just the JRE.)
2) Set Tomcat's default JAVA_HOME
Code:
sudo gedit /etc/default/tomcat5.5
Uncomment the JAVA_HOME line and set it to your JDK path. For Java 6 installed from the repositories, it's as so:
Code:
JAVA_HOME=/usr/lib/jvm/java-6-sun
3) Fix catalina.out
Unfortunately, it seems that Tomcat's log file is set to be a pipe, but Tomcat can't seem to start with it. We'll recreate it as a regular file with the same security settings:
Code:
cd /var/log/tomcat5.5/
sudo rm catalina.out
sudo touch catalina.out
sudo chown tomcat55:nogroup catalina.out
sudo chmod uo-wrx catalina.out
Tomcat should work now as a daemon. Start it like this:
Code:
sudo /etc/init.d/tomcat5.5 start
And point your browser at http://localhost:8180/
Hooray!
This may be good enough for you. However, if you want to try to run Tomcat not as a daemon, but from a development tool (in my case I was using Sysdeo's Tomcat plugin for Eclipse), you will find Tomcat announcing rather bizarre errors. So:
4) Change permissions on Tomcat's work directory
Code:
cd /var/cache
sudo chmod go+rwx tomcat5.5
(This is probably not the most secure solution, but it should be OK for development environments. For production environments, you really don't want anything to have access to Tomcat's work directory! Another solution may be to change the link to this directory from /usr/share/tomcat5.5/work, which is what Tomcat actually uses.)
Thanks to the many folk on Ubuntu Forums who struggled to make this work. I merely put their advice together into a howto. Good luck, and let's hope the tomcat5.5 package manager fixes these bugs!
All looks well when you run the startup script...
$ export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/
$ sudo /usr/share/tomcat5.5/bin/startup.sh
Using CATALINA_BASE: /usr/share/tomcat5.5
Using CATALINA_HOME: /usr/share/tomcat5.5
Using CATALINA_TMPDIR: /usr/share/tomcat5.5/temp
Using JRE_HOME: /usr/lib/jvm/java-1.5.0-sun-1.5.0.11/
but netstat tells you nothing is actually going on...
sudo netstat -plut
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 *:www *:* LISTEN 3679/apache
tcp6 0 0 *:ssh *:* LISTEN 3602/sshd
The problem arises from a fifo at /usr/share/tomcat5.5/logs/catalina.out which is the target for
normal console output from the catalina (tomcat launch) script. This fifo doesn't flow at all.
Replacing it with a regular file fixes the problem and tomcat launches OK.
###############################################
Here's what you can do to get it to work:
1) Install
Code:
sudo aptitude install sun-java6-jdk tomcat5.5
(Note that you absolutely need the JDK, not just the JRE.)
2) Set Tomcat's default JAVA_HOME
Code:
sudo gedit /etc/default/tomcat5.5
Uncomment the JAVA_HOME line and set it to your JDK path. For Java 6 installed from the repositories, it's as so:
Code:
JAVA_HOME=/usr/lib/jvm/java-6-sun
3) Fix catalina.out
Unfortunately, it seems that Tomcat's log file is set to be a pipe, but Tomcat can't seem to start with it. We'll recreate it as a regular file with the same security settings:
Code:
cd /var/log/tomcat5.5/
sudo rm catalina.out
sudo touch catalina.out
sudo chown tomcat55:nogroup catalina.out
sudo chmod uo-wrx catalina.out
Tomcat should work now as a daemon. Start it like this:
Code:
sudo /etc/init.d/tomcat5.5 start
And point your browser at http://localhost:8180/
Hooray!
This may be good enough for you. However, if you want to try to run Tomcat not as a daemon, but from a development tool (in my case I was using Sysdeo's Tomcat plugin for Eclipse), you will find Tomcat announcing rather bizarre errors. So:
4) Change permissions on Tomcat's work directory
Code:
cd /var/cache
sudo chmod go+rwx tomcat5.5
(This is probably not the most secure solution, but it should be OK for development environments. For production environments, you really don't want anything to have access to Tomcat's work directory! Another solution may be to change the link to this directory from /usr/share/tomcat5.5/work, which is what Tomcat actually uses.)
Thanks to the many folk on Ubuntu Forums who struggled to make this work. I merely put their advice together into a howto. Good luck, and let's hope the tomcat5.5 package manager fixes these bugs!
Powered by ScribeFire.
No comments:
Post a Comment