Tomcat error "Address already in use: JVM_Bind"
search cancel

Tomcat error "Address already in use: JVM_Bind"

book

Article ID: 5218

calendar_today

Updated On:

Products

CA Service Desk Manager CA Service Management - Service Desk Manager

Issue/Introduction

Trying to start Tomcat service this fails and logs shows:

SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"]

java.net.BindException: Address already in use: JVM_Bind :8080

Environment

SDM 14.1.X and higher

CABI 4.X SP1/SP3/SP5

Cause

As the error suggest there is already another server running on the same port (in this case 8080) . You can either kill that service or change your web server to run on another port.

Resolution

1. How to kill the previous service

If you have decided to kill the previous service, then you just have to find the process in which your service is running and simply kill that process.
Below are the commands to find the process and kill it.


Windows Environment


In windows, netstat is used to display protocol statistics and current TCP/IP network connections.
 
  1. Find the process which is using the port number. (See the below example where the process number is 6324).
  2. Then use taskkill command to forcefully terminate that process.
    • netstat -ano | find "8080"
    • taskkill /F /PID 6324

Linux

 
Similarly, in Linux you can use netstat command to find the process.
  1. In Linux, netstat is used to show network status
  2. Grep command is used to find the particular port out of it as shown below.
  3. Then use the kill command to terminate the process.
    • netstat -an | grep "8080"
    • kill - 6324

2. How to change the web server to run on another port

Tomcat

If you are using tomcat, locate the file server.xml (E.g. C:/apache-tomcat-7.0.11/conf/server.xml). You will see below code snippet.

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
 
  1. Change the above port number (E.g. 8080 ) to any other port number.
  2. Now your web server will run on the new port which you have provided.

Additional Information

The port showed in the logs is being used in the server by another process. The process can be:

1) Another tomcat deployment like REST, Federated Search, Visualizer
2) Another Application deployment using the same port. Example: CABI, Service Catalog, Process Automation, etc.
3) The same application that is already running. A ghost javaw.exe process from the same application that is still running and must be killed before start the process again.
4) A problematic Windows update has been installed in the server where SDM is installed. The following patches from July 2018 cause this issue to occur: For Windows 2012 KB4284878 and KB4338815. For Windows 2008 KB4338818 and  KB4338823

 

For Cause 1:

Review the server.xml for each tomcat installation by following the steps below:
1) Go to the server where Service Desk is installed

2) Go to NX_ROOT\bopcfg\www . Each CATALINA_BASE folder is a different tomcat installation.
CATALINA_BASE is for Service Desk
CATALINA_BASE_REST is for REST Services
CATALINA_BASE_SA is for Support Automation
CATALINA_BASE_VIZ is for Visualizer
CATALINA_BASE_FS is for Federated Search

3) Review each server.xml file under conf folder for each tomcat deployment and ensure the port number being used are different for each deployment.
You need to pay attention to the uncommented tags like:
<Server port="8085" shutdown="SHUTDOWN">
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>

4) Run pdm_configure to assign the right ports to each deployment

5) Start SDM Services

For Cause 2 and 3:

1) Go to the server where you are getting the issue
2) Open a Command Prompt Window and run: netstat -ano | findstr "Port Number"  (Example: netstat -ano | findstr "8080")
The command above will list at least one row with the 8080 port number
3) Go to task manager and locate the process that is running and using the same port number (example: javaw.exe) and kill if necessary. If it's another application, then you would need to configure the other applications to use another port number to avoid port conflicts again

For Cause 4:

1) To solve issue in Windows 2008: Install August 2018 Windows patches: KB4343900 + KB4343899
2) To solve issue in Windows 2012: Install August 2018 Windows patches: KB4343898 + KB4343888

Additionally, please examine
Apache cannot shutdown / restart after Windows Update