Article: Tomcat5 on (Suse) Linux »
FERDY CHRISTANT - OCT 22, 2005 (10:58:28 AM)
|
Suse 9.3 is a fairly complete Linux distribution that comes with Apache, PHP, but also Tomcat, if you enable it. I enabled it, but had many problems getting it to work. After a few frustrating hours I still had nothing but an empty Tomcat welcome page. I decided to start from scratch, minutes later I had everything working. |
Removing Tomcat
I had a lot of problems with my existing Tomcat installation. I therefore wanted it to be completely removed from my system, so I could start from scratch:
- First stop the Tomcat service if it is running, by issueing the following command:
/srv/init.d/tomcat5 stop
Alternatively, you can use the YaST system services panel to stop the Tomcat service.
- Next, remove all Tomcat packages from your system. Go to the YaST install and remove software panel, search for "tomcat" and uninstall the tomcat packages (there were 5 in my case).
- The previous step cleared out the packages, but left some files on the system that can conflict with your new installation. Therefore, be sure to remove the "/srv/www/tomcat5" directory completely.
Installing Tomcat
Now that we have a clean installation, there are two ways to install Tomcat. You can install fresh Tomcat and JVM packages and set up the whole thing manually. Or, you can let your distribution take care of it. Since Suse 9.3 comes with Tomcat, I prefer to let YaST take care of the install:
- Open up the YaST install and remove software panel, search for "tomcat" and install all 5 resulting packages. It is important that you also select the "sample web applications" package, as this contains the Tomcat welcome page and example applications. This will make it easy to check if your installation is working correctly later on.
-
Check if the CATALINA system variables are set correct. These variables tell the system where to look for the Tomcat software. Normally, the previous step has taken care of these values, but it doesn't hurt to check them. Open the YaST /etc/SysConfigEditor and drill down to "Network/WWW/J2EE/Tomcat". The values there should be as follow:
variable value CATALINA_HOME /usr/share/tomcat5 CATALINA_BASE
Note: it's not a typo, CATALINA_BASE should really be left empty.
Nowadays, Tomcat comes with a Deployer application. This enables you to deploy and update applications on Tomcat without having to reboot the server. Before we can use it, we need to define a user that is allowed to use this service. Edit the file "/srv/www/tomcat5/base/conf/tomcat-users.xml to add an administrator user to it. Below is my file, after adding the administrator (in bold): - Now it's time to enable the Tomcat service. If you like to run it as a service, thus letting it start automatically upon booting, go to the YaST system services console and enable the Tomcat service.
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcatadmin" password="pass" roles="admin,manager"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
</tomcat-users>
Testing Tomcat
Now that we have installed Tomcat, it is time to test if it is working correctly:
-
Although not neccessary, for a good test you may want to reboot your machine to see if Tomcat automatically starts.
-
Tomcat by default runs on port 8080. If you intend to do the test from a remote machine, first open up this port in the firewall settings. For now, I'll assume the test will be done locally.
-
Open your browser and point it to http://localhost:8080. If all goes well, the Tomcat welcome page will appear. Congratulations, your installation is successfull!
- As a final test, see if you can login to the Tomcat manager application, which let's you manage your applications. Open http://localhost:8080/manager/html and login using the credentials of the admin user we added in the tomcat-users.xml file. If the Tomcat Web Application Manager page appears, you have successfully set up the complete installation.
Troubleshooting
If you are still having problems getting everything to work, check out following log files on your system:
- /srv/www/tomcat5/base/logs/start.log
- /srv/www/tomcat5/base/logs/catalina.out
Documentation
If you installed the Tomcat sample application, which contains the Tomcat welcome page, you can find some excellent documentation in the following location: http://localhost:8080/tomcat-docs/
Next steps
Tomcat really is a subproject of the Apache Jakarta project. The Jakarta project is a treasure of open source frameworks, components and libraries. Be sure to learn about the Jakarta Commons sub-project, it provides world-class libraries for your benefit.



Comments: 27
Reviews: 13
Average rating:
Highest rating: 5
Lowest rating: 4
COMMENT: TECHIE
JAN 6, 09:43:49 PM
COMMENT: PABLO
FEB 9, 02:58:58 PM
COMMENT: MIBLO
FEB 13, 13:06:18
COMMENT: LATE
FEB 17, 01:27:34 PM
" error: catalina.sh line 284: /var/run/tomcat5.pid: permission denied".
(don't remember exactly now, not @ home at the moment)
There is no such tomcat5.pid -file in /var/run (actually sometimes there is, and the last line doesn't appear in start.log, but tomcat still won't start...
Has someone fu**** up the tomcat-packages on suse 9.3??
«
COMMENT: LATE
FEB 24, 11:31:31 AM
COMMENT: BABU
FEB 26, 12:30:07 AM
COMMENT: VAL

MAR 6, 11:33:41
But i don't have a "gui" for yast (i'm accessing my server with SSH) so i wonder how to find the yast command line informations (i still a new user under Suse 9.3 and i must admit that i still preffer Debian)... «
COMMENT: JERRYQ
MAR 6, 07:22:34 PM
COMMENT: SAMBASIVARAO
APR 22, 05:04:33 AM
if any one know for this problem please send me the solution «
COMMENT: NASORENGA
APR 24, 04:01:47 AM
The reason, it turns out, was that the packages I had installed - tomcat5 and its dependencies - did not include any webapps. Once I installed tomcat5-webapps, everything was fine.
Under Fedora Core 5:
#yum install tomcat5
#yum install tomact5-webapps «
COMMENT: NASORENGA
APR 24, 11:59:03 AM
COMMENT: GHANENDRA SISODIA


MAY 5, 01:51:07 PM
COMMENT: PAUL SANTA MARIA

MAY 24, 01:29:27 AM
COMMENT: FRODE NILSEN
JUN 5, 12:51:45 PM
COMMENT: ALEXANDER WILLNER


JUN 17, 18:37:53
Someone should fill out a bug report at Suse or Apache. «
COMMENT: CHRIS SMITH
JUL 5, 13:12:37
In the log file in /usr/share/tomcat5/logs there was a permissions error when creating tomcat-users.xml.new.
The solution was
su -
cd /etc/tomcat5
chmod 777 base
Thanks
Chris «
COMMENT: MICHAEL SHOR


AUG 4, 01:40:43 AM
Thanks in advance.
«
COMMENT: SIDDHARTH

AUG 30, 08:10:43 PM
considering that i am a new user on SuSE this does sounds good.
will try implementing it whenever such a task comes in front
thanks.
regards,
Siddharth. «
COMMENT: FUNTICK

SEP 18, 03:51:28 AM
- it simply means that you need OS user "tomcat"... «
COMMENT: FUNTICK
SEP 18, 03:52:27 AM
user username="tomcat" password="tomcat" roles="tomcat" «
COMMENT: FUNTICK
SEP 25, 06:39:45 PM
"error: catalina.sh line 284: /var/run/tomcat5.pid: permission denied"
try to start "rctomcat5 start" as a user "root", this script will correctly reset permissions. «
COMMENT: FUNTICK
SEP 29, 08:36:56 PM
COMMENT: MAESTRO

JAN 10, 10:59:41 PM
http://en.opensuse.org/Tomcat_HOWTO
Most important:
chown -R tomcat:tomcat /opt/jakarta
I run this from /etc/init.d without any problem... SuSE 10 ES, Tomcat 5.5.20, HTTPD 2.2 «
COMMENT: COALVILLEDAVE

MAY 17, 12:12:48 PM
COMMENT: THE MARKET SPY

JUN 1, 04:36:02 PM
I have a question: what is the best way to implement gzip as an HTTP response? Have anybody tried to configure Apache HTTPD with Cache Memory as frontend to Tomcat, with GZIP support at Apache layer?
Thanks!
COMMENT: BAMBARBIA KIRKUDU

JUL 24, 2008 - 05:39:41 PM
The best way is to use front-end such as Apache HTTPD, Apache Module mod_deflate:
Compress everything except images
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
Several filters exist in Java but nobody uses it; for even better performance use HTTP caching headers at Tomcat and configure mod_cache at Apache.
COMMENT: SIRIL
AUG 20, 2008 - 12:47:08 PM