Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deployment error:Starting of Tomcat failed, the server port 8080 is already in use

When I run my Java project using Netbeans I get the following error:

Deployment error: Starting of Tomcat failed, the server port 8080 is already in use. See the server log for details.         at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:166)         at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)         at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)         at sun.reflect.GeneratedMethodAccessor619.invoke(Unknown Source)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)         at java.lang.reflect.Method.invoke(Method.java:597)         at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)         at org.apache.tools.ant.Task.perform(Task.java:348)         at org.apache.tools.ant.Target.execute(Target.java:357)         at org.apache.tools.ant.Target.performTasks(Target.java:385)         at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)         at org.apache.tools.ant.Project.executeTarget(Project.java:1298)         at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)         at org.apache.tools.ant.Project.executeTargets(Project.java:1181)         at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)         at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)         at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151) Caused by: org.netbeans.modules.j2ee.deployment.impl.ServerException: Starting of Tomcat failed, the server port 8080 is already in use.         at org.netbeans.modules.j2ee.deployment.impl.ServerInstance._start(ServerInstance.java:1297)         at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1251)         at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1062)         at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.start(ServerInstance.java:939)         at org.netbeans.modules.j2ee.deployment.impl.TargetServer.startTargets(TargetServer.java:428)         at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:143)         ... 16 more BUILD FAILED (total time: 4 seconds) 

I tried changing the server port to 8081 and shutdown port in tool->server. It runs fine but again if I do any operations and run the project it says "Deployment error:Starting of Tomcat failed, the server port 8081 is already in use"

What would be the problem?

like image 489
user660450 Avatar asked Mar 15 '11 11:03

user660450


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 resolve a port 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.


2 Answers

goto command prompt

netstat -aon 

for linux

netstat -tulpn | grep 'your_port_number' 

it will show you something like

 TCP    192.1.200.48:2053      24.43.246.60:443       ESTABLISHED     248  TCP    192.1.200.48:2055      24.43.246.60:443       ESTABLISHED     248  TCP    192.1.200.48:2126      213.146.189.201:12350  ESTABLISHED     1308  TCP    192.1.200.48:3918      192.1.200.2:8073       ESTABLISHED     1504  TCP    192.1.200.48:3975      192.1.200.11:49892     TIME_WAIT       0  TCP    192.1.200.48:3976      192.1.200.11:49892     TIME_WAIT       0  TCP    192.1.200.48:4039      209.85.153.100:80      ESTABLISHED     248  TCP    192.1.200.48:8080      209.85.153.100:80      ESTABLISHED     248 

check which process has binded your port. here in above example its 248 now if you are sure that you need to kill that process fire

Linux:

kill -9 248 

Windows:

taskkill /f /pid 248 

it will kill that process

like image 129
jmj Avatar answered Sep 21 '22 14:09

jmj


If you are behind a proxy server this issue could happen i had the same issue and was solved by: Preferences -> General -> Proxy Settings -> No Proxy.

"Maybe the tomcat ready-message was sent to the proxy - and never reached the IDE."

found @: https://netbeans.org/bugzilla/show_bug.cgi?id=231220

like image 24
Mohamed Elwy Avatar answered Sep 20 '22 14:09

Mohamed Elwy