1. How to kill 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.
In windows netstat is used to Displays protocol statistics and current TCP/IP network connections. Just find the process which is using the port number. Let's assume the process number is 6324. Then use taskkill command to forcefully terminate that process.
- netstat -ano | find "8080"
- taskkill /F /PID 6324
Similarly in Linux we can use netstat command to find the process. In linux netstat is used to show network status and grep command is used to find the particular port out of it as shown below. Then use kill command to terminate the process.
- netstat -an | grep "8080"
- kill - 6324
2. How to change web server to run on another port.
If you are using tomcat, Just 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"
Just change the above port number (E.g. 8080 ) to any other port number. Now your web server will run on the new port which you have provided.