1

I am trying to run a Java webapp build instance but it stops in the middle of the build with this error:

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

It's obviously trying to bind to the 8080 port but another process has already done so and wont share.

So, I checked to see what process is using the 8080 (netstat -anp | grep 8080). Apparently the jsvc.exec process is listening to my 8080 port. Upon checking (ps -fp) I find out that this is Tomcat (boostrap.jar).

So, to see if the build would at least complete, I killed the process. And yeah!! The Webapp build installed completely. But when I navigated my browser to localhost:8080 it says the service is not running - coz I killed Tomcat! I even tried localhost:8080/manager/list. Still said service not running.

So I restart Tomcat, checked localhost:8080 and Tomcat was back up. Checked localhost:8080/manager/list but did not see the Webapp instance I had just built.

What I am not getting here! My webapp wont build if I run tomcat (cant share 8080). And If i kill tomcat to complete the build, the webapp obviously cant run coz Tomcat is dead.

Please help me. Running Tomcat 5.5 in a LAMP environment on a remote server. NOTE: I am running a pre-built webapp build application (war) which I cant make changes to.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Arno Hart
  • 21
  • 1
  • 3
  • 1
    How do you build your webapp? Using Maven? How come it needs to start your app on the port 8080? It is perfectly valid to do that, I am just trying to grab the missing pieces. – Guillaume Polet Mar 30 '12 at 17:39

2 Answers2

1

During a build? A build process usually doesn't require a port to be open. The issue is that two programs are attempting to use the same port. Without fixing the underlying issue, the immediate fix is to change the port Tomcat is running on. To change the port Tomcat runs on, edit install_dir/conf/server.xml and change the port attribute of the Connector element from 8080 to 8081.

freeone3000
  • 387
  • 4
  • 10
  • Thanks freeone3000 for reading my question. Your recommendation makes sense so I tried it. 1) I changed the Connector element in the server.xml file to 8081. 2) Rebooted server 3) Ran a netstat -anp | grep 8081 and sure enuff tomcat was running (jsvc.exec) 4) Ran the build again. And it completed. 5) When I went to localhost:8080 I still get HTTP ERROR: 503 Problem accessing /. Reason: Service Unavailable 6) And when I try localhost:8081 it does not resolve (I was expecting to see the standard Apache Tomcat page). Not sure what to say here, other than I am still confused. – Arno Hart Mar 30 '12 at 19:24
  • Extra note here. When I kill the build instance (by hitting return on the terminal console) the 503 error goes away at localhost:8080 and the page no longer resolves. – Arno Hart Mar 30 '12 at 19:26
  • Okay. So your build instance is running a webserver on port 8080. For some reason. Check the documentation on that WAR you're building for why it needs to do that, and how to access it. As for the tomcat instance, if you cannot access http://localhost:8081/ , then there is no webserver running locally on that port. If you have a 400 or 500 class error, sometimes reported as "cannot connect" errors in web browsers, then you're accessing the wrong URI and need to use the URI usually used to access your local application. – freeone3000 Apr 04 '12 at 16:24
  • Thanks. Your were very helpful. I figured out that the prebuilt web-app (war) came with an internal client server assigned to port 8080. Therefore was conflicting with tomcat (8080). So I switched tomcat to 8081. Problem solved. Thanks – Arno Hart Jun 01 '12 at 15:07
0

If this is your first time running Confluence or you have recently added applications or made changes to the system, investigate what's running on port 8080.

If Confluence was not shut down properly, you can restart the machine or kill the process: On Windows:

  1. Hit Ctrl-alt-delete and look at open programs. Look for {{java.exe}}.

  2. From a command window, run {{netstat -an}}. Check which ports are in use. You can identify which application is running this way, then close it from the Task Manager.

Yogesh Prajapati
  • 4,770
  • 2
  • 36
  • 77
  • Thanks. I figured out that the prebuilt web-app (war) came with an internal client server assigned to port 8080. Therefore was conflicting with tomcat (8080). So I switched tomcat to 8081. Problem solved. Thanks – Arno Hart Jun 01 '12 at 15:07