1

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)
1
  • Do the logs show that the server has started and listening on some port ?
    – JoseK
    Oct 4, 2010 at 8:54

1 Answer 1

2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .