OneClick Tomcat won't startup due to java.net.BindException
search cancel

OneClick Tomcat won't startup due to java.net.BindException

book

Article ID: 32837

calendar_today

Updated On:

Products

CA Spectrum DX NetOps

Issue/Introduction

OneClick Tomcat won't startup due to java.net.BindException exception because default shutdown port, i.e. TCP/8005 was being used by other process. OneClick Tomcat log shows the following exception.

SEVERE: StandardServer.await: create[localhost:8005]: 
java.net.BindException: Address already in use: JVM_Bind
at java.net.DualStackPlainSocketImpl.bind0(Native Method)
at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190)
at java.net.ServerSocket.bind(ServerSocket.java:376)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:426)
at org.apache.catalina.startup.Catalina.await(Catalina.java:777)
at org.apache.catalina.startup.Catalina.start(Catalina.java:723)
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:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)

Environment

Release:
Component:

Cause

Tomcat shutdown port, i.e. by default TCP/8005, has been used by other process. Because of that, OneClick Tomcat cannot allocate this port during start up. This happens typically when you install CABI on the same machine. When CABI Tomcat was running the default shutdown port TCP/8005 was being used so OneClick Tomcat won't be able to allocate the port.

Resolution

You can check to see what process is using port 8005 by running netstat:

netstat -anop | grep 8005

This output will provide a pid.  You can then run a process listing:

ps -ef | grep <the_pid>

You can then either shut down the process using port 8005 or you can reconfigure OneClick Tomcat to use different available TCP port, e.g. TCP/8006, for shutdown port. You can do the following steps.

1. Run the following netstat command to make sure that the TCP port you want to allocate is not being used. You should not get any entry as output of the command when the port is not being used.

netstat -anop | grep <port number>

Note: Replace <port number> with the new port number you want to use - for this example, port 8006

2. Backup $SPECROOT/tomcat/conf/server.xml file and use vi editor or other text editor to modify

From

<Server port="8005" shutdown="SHUTDOWN">

To

<Server port="<new port number>" shutdown="SHUTDOWN">

Note: Replace <new port number> with the new port number you want to use

3. Restart OneClick Tomcat

Additional Information

Depending on your version of Spectrum WebTomcat also uses a shutdown port of 8005.  If you find the port binding issue is due to WebTomcat, edit the $SPECROOT/webtomcat/conf/server.xml and change the SHUTDOWN port to 8006:

<Server port="8006" shutdown="SHUTDOWN">

Stop and restart the WebTomcat service:

Navigate to $SPECROOT/webtomcat/bin

Run: ./stopWebTomcat.sh

./StartWebtomcat.sh