Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat Shutdown problem

 
varun bihani
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
varun bihani
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Linux redhat 7.2
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no error messages...
everything is shown fine
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it does not seem that any other process running on 8080
No oracle installed...
and how to check other ports..
 
Ashish Patel
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Wills
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18272
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic