I am facing some issues regarding tomcat startup and shutdown.
I am using
I start the tomcat using command:
$./catalina.sh jpda start
Then I try to stop it using command:
$./catalina.sh stop
and get the following message:
SEVERE: Catalina.stop:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:189)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:422)
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:597)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:338)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:416)
I also tried stopping it using command :
$./catalina.sh stop -force
but I got the message:
Kill failed: $CATALINA_PID not set
Then I again tried starting tomcat using command:
$./catalina.sh jpda start
In the /logs folder only catalina.out is generated with following error message:
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
As it is indicated in the error "Address already in use" I verified no other application is configured to run on port 8080. Everytime when I kill the process id and restart it, the startup works fine.This requires me to kill the process manually using "KILL" command, when I need to stop the tomcat server. This same behavior I am encountering on other machines too where same environment as mentioned above is set up.
Can anybody please let me know what is causing this and how to resolve this?
Thanks,
Jignesh
Dont use /etc/bash.bashrc just put this on your catalina.sh
After:
if [ -r "$CATALINA_BASE"/bin/setenv.sh ]; then
. "$CATALINA_BASE"/bin/setenv.sh
elif [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then
. "$CATALINA_HOME"/bin/setenv.sh
fi
put this:
export CATALINA_PID="$CATALINA_HOME/catalina_pid.txt"
And now your tomcat will be killed when you use catalina.sh stop -force