File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes running Tomcat from jsvc daemon as user tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "running Tomcat from jsvc daemon as user tomcat" Watch "running Tomcat from jsvc daemon as user tomcat" New topic

running Tomcat from jsvc daemon as user tomcat

Robert White

Joined: Mar 03, 2003
Posts: 8
I am running Tomcat from jsvc daemon as user "tomcat". When I do this, I cannot run JSPs because Tomcat cannot create java files in the work directories and subsequently cannot compile them (cuz they're not there).

When I run Tomcat using as user "root" I have no problems.

When I run Tomcat using as user "tomcat", I can compile at least some of the java files, but there's another problem with one particular app which uses css stylesheets and the stylesheets don't get made properly.

Of course, the quick solution is to simply invoke as root from my /etc/init.d/tomcat script. But according to instructions
on the Apache site, I'm supposed to be able to run Tomcat as daemon using jsvc.

But something's amiss. I installed Tomcat as user "tomcat" and user "tomcat" owns the entire directory tree (ie. /usr/local/tomcat5/...).

Any ideas?

BTW, the exact error message I am getting is: /usr/local/tomcat5/work/Catalina/localhost/AHEMSS/org/apache/jsp/ahess/
at Method)
at org.apache.jasper.compiler.Compiler.generateJava(
... etc....

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

I use the RPM version of Tomcat and that's only a problem when debugging (since my Eclipse setup is getting upset about Tomcat's rights vs. my user rights.

We had a problem in Solaris where Tomcat would be started as root and create the $TOMCAT_HOME/work directory under root rights, which would make the later runs under user tomcat fail - they couldn't write the compiled JSPs.

An IDE is no substitute for an Intelligent Developer.
Jon Entwistle
Ranch Hand

Joined: Feb 20, 2003
Posts: 118
I run tomcat directly from the start scripts as - a problem I found running it as non-root is that you are prevented from using ports < 1024. You can always us IPTables to redirect to a non priviledged port though....

Mr King

Joined: Nov 13, 2004
Posts: 1
I had the same problem. Turns out it's a unix ownership issue. The following should fix it (assuming you're running jsvc as user 'tomcat')

chown -R tomcat /usr/local/tomcat

Replace the path with the correct one for your installation. I have no idea whether it's appropriate for the tomcat user to own all the directories, however...

-- Mr King
I agree. Here's the link:
subject: running Tomcat from jsvc daemon as user tomcat
jQuery in Action, 3rd edition