Meaningless Drivel is fun!*
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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
Author

running Tomcat from jsvc daemon as user tomcat

Robert White
Greenhorn

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 startup.sh as user "root" I have no problems.

When I run Tomcat using startup.sh 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 startup.sh 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:

java.io.FileNotFoundException: /usr/local/tomcat5/work/Catalina/localhost/AHEMSS/org/apache/jsp/ahess/ess0_jsp.java
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:223)
... etc....

..Bob.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16022
    
  20

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
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....


SCJD, SCEA
Mr King
Greenhorn

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
 
 
subject: running Tomcat from jsvc daemon as user tomcat