Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat Server Error - Port 8080 already in use

Tags:

java

tomcat

I received the following error while attempting to execute a Servlet program in Eclipse Mars EE.

'Starting Tomcat v8.0 Sever at localhost' has encountered a problem.

Port 8080 required by Tomcat v8.0 Server at localhost is already in use. There may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).

What should I do to stop the process? I'm assuming that Tomcat 7 server must be stopped. How shall I do it if my operating system is Windows 8?

Error Screenshot:

error screen shot

like image 233
Gayathri Ravi Avatar asked Dec 13 '15 17:12

Gayathri Ravi


People also ask

How do I fix the start of Tomcat failed the server port 8080 is already in use?

Change your Tomcat port address to 8084 and Shut Down Port to 8025 . This will resolve your problem.

How do I fix a port that is already in use?

If you are running the Development Application Server, changing the port used by the server is the easiest solution. Change the Server Port in the Application Server Control Panel and start the server. Specify a port that is not 80, such as 8080. Changing the port number may not desired in a Production environment.

Why is port 8080 already used?

So in general, If you get a “port 8080 was already in use” error, then it is certain that another application is already using that port. This is most likely due to bad configuration from your end, running the application multiple times, or not using proper startup and shutdown scripts.


4 Answers

For Ubuntu/Linux

Step 1: Find the process id that is using the port 8080

netstat -lnp | grep 8080
or
ps -aef | grep tomcat

Step 2: Kill the process using process id in above result

kill -9 process_id

For Windows

Step 1: Find the process id

netstat -ano | findstr 8080

Step 2: Open command prompt as administrator and kill the process

taskkill /F /pid 1088

In my case port 8005 was already in use so I used the same above steps.

enter image description here

like image 138
Tarun Kumar Avatar answered Oct 24 '22 03:10

Tarun Kumar


All I had to do was to change the port numbers. enter image description here

  1. Open Eclipse

  2. Go to Servers panel

  3. Right click on Tomcat Server select Open, Overview window will appear.

  4. Open the Portstab. You will get the following:

    • Tomcat adminport

    • HTTP/1.1

    • AJP/1.3

  5. I changed the port number of HTTP/1.1 (i.e. to 8081)

  6. You might have to also change the port of Tomcat adminport (i.e. to 8006) and of AJP/1.3 (i.e. to 8010).

  7. Access your app in the browser at http://localhost:8081/...

like image 24
Gayathri Ravi Avatar answered Oct 24 '22 01:10

Gayathri Ravi


If you want to regain the 8080 port number you do so by opening the task manager and then process tab, right click java.exe process and click on end process as shown in image attached.

screen shot

like image 25
Arun Gunalan Avatar answered Oct 24 '22 02:10

Arun Gunalan


In case of MAC users, go to Terminal and do the following

lsof -i :8080 //returns the PID (process id) that runs on port 8080
kill 1234 //kill the process using PID (used dummy PID here)
lsof -i :8443
kill 4321

8080 is HTTP port and 8443 is HTTPS port, by default.

like image 25
Vignesh Raja Avatar answered Oct 24 '22 02:10

Vignesh Raja