This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Tomcat Shutdown problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat Shutdown problem" Watch "Tomcat Shutdown problem" New topic
Author

Tomcat Shutdown problem

varun bihani
Ranch Hand

Joined: Aug 11, 2003
Posts: 96
Getting this error:
Catalina.stop: java.net.ConnectException: Connection refused
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:434)
at java.net.Socket.connect(Socket.java:384)
at java.net.Socket.<init>(Socket.java:291)
at java.net.Socket.<init>(Socket.java:119)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:581)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:402)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

Can nebody explain this..


<a href="http://www.galaxyweblinks.com" target="_blank" rel="nofollow">www.galaxyweblinks.com</a><br /><a href="http://www.freechatcode.com" target="_blank" rel="nofollow">www.freechatcode.com</a><br /><a href="http://www.onlinefamilytreemaker.com" target="_blank" rel="nofollow">www.onlinefamilytreemaker.com</a>
varun bihani
Ranch Hand

Joined: Aug 11, 2003
Posts: 96
I am using Linux redhat 7.2
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

when do you get that error?

if it's when you're trying to shut down tomcat, it's most likely because you are trying to shutdown a tomcat instance that is already shut down.

Otherwise, you'll have to provide a lot more detail about the "when".
varun bihani
Ranch Hand

Joined: Aug 11, 2003
Posts: 96
When I try to start tomcat using startup.sh in bin
folder it echos CATALINA_BASE , CATALINA_HOME ,
CATALINA_TEMPDIR AND JAVA_HOME and returns
silently to
command prompt.
But still i am not able to open any jsp...
tomcat is not running..
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Are the values for those variables ok? (does JAVA_HOME point to a JDK, for instance?)

Are there any messages in $CATALINA_HOME/logs/catalina.out ?
varun bihani
Ranch Hand

Joined: Aug 11, 2003
Posts: 96
no error messages...
everything is shown fine
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

tomcat is configured by default to start on port 8080. Is something else using this port already?

What about the other ports Tomcat uses? I think by default, there is a conflict with an Oracle product of some sort.
varun bihani
Ranch Hand

Joined: Aug 11, 2003
Posts: 96
it does not seem that any other process running on 8080
No oracle installed...
and how to check other ports..
Ashish Patel
Greenhorn

Joined: Jan 30, 2004
Posts: 20
Hi All,

I too am getting ConnectException when i try to shutdown my Tomcat Server.

Also it does not even allow me to kill the process.

Below is the exception that i get ......

Catalina.stop: java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:350)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:137)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:124)
at java.net.Socket.<init>(Socket.java:268)
at java.net.Socket.<init>(Socket.java:95)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:581)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:402)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)


I have no other server processes running on 8080 .

Any help in this would be appreciated .

Thanks.


Thanks ,<br />Ashish
Tim Wills
Greenhorn

Joined: Jun 24, 2004
Posts: 2
I have suddenly noticed this on installing Tomcat on a new system.

If I run and then without launching a browser or viewing a JSP page, I get the above Java exception.

However if I run , view a JSP page (for example http://localhost:8080), then run , I don't get the errors.

Perhaps Tomcat doesn't think it's started until a listener has been invoked at least once?

I am running:
Java version 1.4.2_04
Tomcat 5.0.25
Tim Wills
Greenhorn

Joined: Jun 24, 2004
Posts: 2
Can people run the following commands and tell me what you get (any errors??).

$CATALINA_HOME/bin/startup.sh
$CATALINA_HOME/bin/shutdown.sh

Don't run a browser, just fire up tomcat and then immediately shutdown it again. My problem is that I can't close Tomcat down without viewing at least one page using a browser. Just like to know what other people get.

I am logged in as "root" and have not created any user, group or set any directory permissions for Tomcat. I have no services running on port 8080 and the same error occurs on a fresh install machine with virtually nothing installed apart from Tomcat 5.0.25 and Java 1.4.2_04.
Stephen Taylor
Greenhorn

Joined: Jul 18, 2004
Posts: 1
Had the same trouble. Tracked it down to my Zone Alarm software. Check that you don't have something external to Tomcat blocking access to port 8080 (SW, firewalls etc)
Judith Merges
Greenhorn

Joined: Jul 27, 2004
Posts: 2
I have the same problem, you mentioned above:
- "startup.sh" shows not error but does not start tomcat
- manual start of "catalina.sh run" is stopped after some seconds even with a timeout setting of 0
- "shutdown.sh" results in ConnectException error

I did the installation onto a remote server via ssh-connection.

Unfortunately I do not know how to check if some services deny the running of tomcat like ZoneAlarm (mentioned above). Does anybody know how I can check the system? Or found another solution to the problem?
[ July 27, 2004: Message edited by: Judith Merges ]
Judith Merges
Greenhorn

Joined: Jul 27, 2004
Posts: 2
The solution to prevent the automatic shut-down of tomcat was the linking of all (!) connectors to a single ip-adress. For example to the locale loopback interface, like:

<Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8080" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" address="127.0.0.1" acceptCount="100" debug="0" connectionTimeout="20000" useURIValidationHack="false" disableUploadTimeout="true" />

My provider did automatic shutdown of all applications, that were not linked to my ip address.


The other problem that "startup.sh" did not start my application, was in my case just a misunderstanding. I work in a shell and startup runs the application not in the current window. My manual start command "catalina.sh -run" did run it in the current window, so the fact that I just could not see that tomcat has started, did not mean it had not.
Here are all options catalina may be used with:

debug Start Catalina in a debugger
debug -security Debug Catalina with a security manager
embedded Start Catalina in embedded mode
jpda start Start Catalina under JPDA debugger
run Start Catalina in the current window
run -security Start in the current window with security manager
start Start Catalina in a separate window
start -security Start in a separate window with security manager
stop Stop Catalina
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15960
    
  19

To shutdown Tomcat, you invoke a program that sends a shutdown request to its shutdown port (in the default config, it's port 8005). Assuming you don't forcibly kill its process, anyhow (and you shouldn't).

Once Tomcat begins shutting down, it stops listening on ports. If the shutdown process hangs, you will get a connection refused. We have a production server that has exactly this problem, probably either due to a known Cocoon issue or a custom module that needed to be cleaned up in some way that we don't know about. When the shutdown hangs, about the only way I know to handle it is to shutdown the normal way, wait for the Tomcat system to quiesce, then forcibly terminate the remnants.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat Shutdown problem
 
Similar Threads
java.net.ConnectException: Connection refused
Tomcat Shutdown problem
tomcat configuration problem
Another shutting down problem
connection refused on tomcat web server