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.

I had manually installed tomcat on Ubuntu 12.04 it worked fine for couple of time but now its throwing this error

alpha@TM:~/apache-tomcat-6.0.35/bin$ st
Using CATALINA_BASE:   /home/alpha/apache-tomcat-6.0.35
Using CATALINA_HOME:   /home/alpha/apache-tomcat-6.0.35
Using CATALINA_TMPDIR: /home/alpha/apache-tomcat-6.0.35/temp
Using JRE_HOME:        /usr/lib/jvm/java-6-openjdk-i386
Using CLASSPATH:       /home/alpha/apache-tomcat-6.0.35/bin/bootstrap.jar
usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ]  { -help | start | stop }
16 Jul, 2012 6:21:06 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:327)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
    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:422)
    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:338)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:416)

I Googled and searched on StackOverflow a lot, but couldn't fined correct solution to this problem. I have tried changing tomcats listening port and shutdown port in conf/server.xml , but it still didn't. Any help will be appreciated.

share|improve this question

migrated from stackoverflow.com Jul 19 '12 at 1:51

This question came from our site for professional and enthusiast programmers.

    
You should check your processes (ps -aux | grep tomcat-6.0.35) and kill your tomcat if it's still running. –  mihaisimi Jul 16 '12 at 14:05
1  
do you start it as root? if not, then used ports must be > 1024, as ports < 1024, called "priviledged ports", can only be used by the root user. –  Arcadien Jul 16 '12 at 14:06
    
Hey arcadien, thanks a lot.. that solved my problem.. –  abhimanyu5555 Jul 16 '12 at 15:09

1 Answer 1

From what I can see, tomcat is not starting at all. It seems like there is an error in your script. In fact, you can see that, before throwing the exception, it writes :

usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ]  { -help | start | stop }

This means that something is wrong with the command line your script is using to start (or stop) tomcat.

Then, there is the exception. That exception is not the Tomcat server having problems. It is actually the "stop" command not managing to connect to any Tomcat to stop, because Tomcat is not started given the previous error.

When Tomcat starts correctly, it listens on port 8080 (or whatever you configured it) to serve HTTP requests, but also listens on another port (usually 8005, bound only to localhost). This port is the "shutdown port". When you want to shutdown Tomcat, the script starts another small java program, that connects to port 8005 and issues the shutdown command to the running Tomcat.

This is the "connection refused" exception you see, there is no Tomcat to connect to, because Tomcat is not running.

In fact, you usually see the same exception if you issue a tomcat stop when you never started Tomcat.

You should inspect your script, find where it execute the start command, see what it looks like (replace it with an echo, see what it prints), and check if it is coherent with the usage instructions. It should look something like :

java -cp [some .jar files here] org.apache.catalina.startup.Catalina -config [path to config files, but it's optional] start
share|improve this answer

Your Answer

 
discard

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