Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

running Tomcat from jsvc daemon as user tomcat

 
Robert White
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18218
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jon Entwistle
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic