administration mode
Pssst...Ferdy is the creator of JungleDragon, an awesome wildlife community. Visit JungleDragon

 

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.
Below is a small tutorial on setting up Tomcat5 on Suse Linux 9.3:

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:
     
    variablevalue
    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):
    <?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>

  • 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.

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.

Share |

Comments: 31
Reviews: 13
Average rating: rating
Highest rating: 5
Lowest rating: 4

COMMENT: TECHIE rating

JAN 6, 09:43:49 PM

comment » Very useful. «

COMMENT: PABLO rating

FEB 9, 02:58:58 PM

comment » Excellent! «

COMMENT: MIBLO rating

FEB 13, 13:06:18

comment » Cool !!!http://www.ferdychristant.com/blog/resources/$master_graphics/$FILE/emoticon01.gif «

COMMENT: LATE email

FEB 17, 01:27:34 PM

comment » Tomcat doesn't start on my system. /srv/www/tomcat5/base/logs/start.log -file says on the last line somtehing like this:

" 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?? 29 «

COMMENT: LATE email

FEB 24, 11:31:31 AM

comment » Yeap, I managed to do this last weekend. There was a dependency-issue, xml-common -package was missing from my install, yet when installing tomcat, there were no issues concerning the missing package. By reading catalina.out I managed to find out that the xml-common was missing, after installing that tomcat worked fine. If I only managed to install some nice tomcat-plugin to my Eclipse still... «

COMMENT: BABU email

FEB 26, 12:30:07 AM

comment » Excellent. «

COMMENT: VAL emailhomepage

MAR 6, 11:33:41

comment » Well, well, seems cool!

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 » You should be able to access YaST thru SSH. Just type in YaST on the command line. «

COMMENT: SAMBASIVARAO email

APR 22, 05:04:33 AM

comment » while i am creating file in linux by using jsp it is giving the follwoing exception

if any one know for this problem please send me the solution «

COMMENT: NASORENGA email

APR 24, 04:01:47 AM

comment » I had the same symptom under Fedora Core 5: tomcat5 appears to be running correctly, but http://localhost:80 displays a blank page. Also tried "telnet localhost 80" and then typed "get /" and got nothing back, no error, tomcat just shut down the connection.

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 email

APR 24, 11:59:03 AM

comment » (Well, 8080, more precisely.) «

COMMENT: GHANENDRA SISODIA emailhomepagerating

MAY 5, 01:51:07 PM

comment » Its really-really very good. It is sufficient for installing tomcat. «

COMMENT: PAUL SANTA MARIA emailrating

MAY 24, 01:29:27 AM

comment » Good stuff! Thank you very much! «

COMMENT: FRODE NILSEN rating

JUN 5, 12:51:45 PM

comment » Thanks a bunch, man. I wish I'd found your page sooner :) Cheers. «

COMMENT: ALEXANDER WILLNER emailhomepagerating

JUN 17, 18:37:53

comment » Thank you a lot! I wasted a couple of hours to configure Tomcat5 under Suse 10.1. I just got a blank site on http://localhost:8080. After setting CATALINA_BASE="" everything worked fine.

Someone should fill out a bug report at Suse or Apache. «

COMMENT: CHRIS SMITH rating

JUL 5, 13:12:37

comment » I had a similar problem with running installing Tomcat on SUSE 10.

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 emailhomepagerating

AUG 4, 01:40:43 AM

comment » I can't get TomCat5 to start on my SuSE 10.1 box. Please help. While installing it mentioned unresolved dependencies, but did not show which ones.

Thanks in advance. 23 «

COMMENT: SIDDHARTH emailrating

AUG 30, 08:10:43 PM

comment » was useful.

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 homepagerating

SEP 18, 03:51:28 AM

comment » You forgot to make this line bold:

- it simply means that you need OS user "tomcat"... «

COMMENT: FUNTICK

SEP 18, 03:52:27 AM

comment » This line:

user username="tomcat" password="tomcat" roles="tomcat" «

COMMENT: FUNTICK homepage

SEP 25, 06:39:45 PM

comment » "tomcat5.sh" (provided by SuSE) automatically sets permissions on /srv/www/tomcat5 for a default user "tomcat" with password "tomcat". In case of

"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 rating

SEP 29, 08:36:56 PM

comment » Thanks! «

COMMENT: MAESTRO homepagerating

JAN 10, 10:59:41 PM

comment » This is good article too:

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 emailhomepage

MAY 17, 12:12:48 PM

comment » Thanks NASORENGA, your fc5 tip got it working! 12 «

COMMENT: THE MARKET SPY emailhomepage

JUN 1, 04:36:02 PM

comment » Hi,

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!

01 «

COMMENT: BAMBARBIA KIRKUDU emailhomepage

JUL 24, 2008 - 05:39:41 PM

comment » Reply to The Market Spy:

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.

01 02 03 04 05 19 18 «

COMMENT: SIRIL email

AUG 20, 2008 - 12:47:08 PM

comment » can any body tell me how to install tomcat6.0 on open suse11.0 «

COMMENT: DARLINGTON email

OCT 30, 2008 - 09:29:40 AM

comment » can someone help.am an intern and with 2 months using linux, pratically am still getting to know linux. am trying a network installation for SLES 10 but its failing to see the installtion directory from the installation server.and l am suspecting that its because tomcat isnt running and every time l try running it, l get the following error:

"/srv/www/tomcat5/base//webapps not existing"

Please help.

23 «

COMMENT: GOOGLEHELPER

DEC 7, 2008 - 09:42:15 AM

comment » 19 great i am using suse 10.3 will try them out right now and let you know «

COMMENT: TONG

JAN 28, 2010 - 04:10:01 AM

comment » thank you very much 18 «

COMMENT: GIULIANO email

OCT 26, 2011 - 20:16:48

comment » ola sou novo na area e estou tentando fazer com que o tomcat incialize junto com o sistema do SLES 11e ja tentei varias maneiras desde o yast ou pelo gnome mas ta dificil alguem tem uma solução.

desde agradeço a atenção. «

RATE THIS CONTENT (OPTIONAL)
Was this document useful to you?
 
rating Awesome
rating Good
rating Average
rating Poor
rating Useless
CREATE A NEW COMMENT
required field
required field HTML is not allowed. Hyperlinks will automatically be converted.