Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How to start, shutdown and restart tomcat as non-root user. I have tomcat5.x installed on ubuntu machine(usr/share/tomcat). The tomcat directory has full permissions. When I shutdown(/usr/share/tomcat/bin/shudown.sh) or startup(/usr/share/tomcat/startup.sh) tomcat as normal user, it starts & shuts down normally as if it is executed as root user but I could not access webpage even after starting tomcat as non-root user.

user1@station2:/usr/share/tomcat/webapps$ ../bin/shutdown.sh

Using CATALINA_BASE: /usr/share/tomcat

Using CATALINA_HOME: /usr/share/tomcat

Using CATALINA_TMPDIR: /usr/share/tomcat/temp

Using JRE_HOME: /usr

4 Oct, 2010 6:41:11 PM org.apache.catalina.startup.Catalina stopServer

SEVERE: Catalina.stop:

java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)

at java.net.Socket.connect(Socket.java:546)

at java.net.Socket.connect(Socket.java:495)

at java.net.Socket.<init>(Socket.java:392)

at java.net.Socket.<init>(Socket.java:206)

at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:421)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:616)

at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:337)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
share|improve this question
    
Do the logs show that the server has started and listening on some port ? –  JoseK Oct 4 '10 at 8:54

1 Answer 1

up vote 1 down vote accepted

Tomcat on ubuntu stores configuration under /etc/tomcat*. Normal users may not have read access to all configuration files (e.g. /etc/tomcat6/tomcat-users.xml). If you'd like to run tomcat as a normal user for testing/development I'd recommend just download tomcat binary distribution and untar/unzip to some directory under your $HOME. Then run bin/startup.sh and you're done. This also saves you the hassle of running sudo for each tomcat configuration change.

BTW, if you don't have specific requirements for Tomcat5 I'd recommend using a more recent version (Tomcat6/Tomcat7).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.