java.net.BindException: Address already in use

Hi Everyone ! 

I'm a newbie programmer from New York City. I'm trying to run a simple little Java Web Development app with Apache Tomcat 9 and the latest IntelliJ. Yet, whenever I turn-on my Tomcat Controller and Apache gives me confirmation that the server is running. I can't seem to get web app to display/run. What is this error and how do I fix it ?

/Library/Tomcat/bin/catalina.sh run
[2016-05-03 08:13:50,666] Artifact JavaEEHelloWorld:war exploded: Server is not connected. Deploy is not available.
03-May-2016 20:13:56.112 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/9.0.0.M4
03-May-2016 20:13:56.121 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Mar 12 2016 11:39:59 UTC
03-May-2016 20:13:56.121 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         9.0.0.0
03-May-2016 20:13:56.122 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Mac OS X
03-May-2016 20:13:56.122 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            10.11.4
03-May-2016 20:13:56.122 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          x86_64
03-May-2016 20:13:56.122 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre
03-May-2016 20:13:56.123 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_91-b14
03-May-2016 20:13:56.124 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
03-May-2016 20:13:56.125 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /Users/frederickpina/Library/Caches/IntelliJIdea2016.1/tomcat/Tomcat_9_0_0_M4_JavaEEHelloWorld
03-May-2016 20:13:56.125 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /usr/local/apache-tomcat-9.0.0.M4
03-May-2016 20:13:56.126 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/Users/frederickpina/Library/Caches/IntelliJIdea2016.1/tomcat/Tomcat_9_0_0_M4_JavaEEHelloWorld/conf/logging.properties
03-May-2016 20:13:56.134 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
03-May-2016 20:13:56.134 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
03-May-2016 20:13:56.136 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
03-May-2016 20:13:56.136 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
03-May-2016 20:13:56.137 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
03-May-2016 20:13:56.137 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
03-May-2016 20:13:56.137 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/Users/frederickpina/Library/Caches/IntelliJIdea2016.1/tomcat/Tomcat_9_0_0_M4_JavaEEHelloWorld
03-May-2016 20:13:56.138 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/Library/Tomcat
03-May-2016 20:13:56.139 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/Library/Tomcat/temp
03-May-2016 20:13:56.139 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/frederickpina/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
03-May-2016 20:13:57.097 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
03-May-2016 20:13:57.142 SEVERE [main] org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated with ProtocolHandler ["http-nio-8080"]
 java.net.BindException: Address already in use
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:433)
    at sun.nio.ch.Net.bind(Net.java:425)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:245)
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:798)
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:547)
    at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:66)
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:1010)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:549)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:873)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:606)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:629)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)

03-May-2016 20:13:57.151 SEVERE [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[HTTP/1.1-8080]]
 org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-8080]]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:549)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:873)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:606)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:629)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:1013)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
    ... 12 more
Caused by: java.net.BindException: Address already in use
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:433)
    at sun.nio.ch.Net.bind(Net.java:425)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:245)
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:798)
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:547)
    at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:66)
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:1010)
    ... 13 more

03-May-2016 20:13:57.170 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-50228"]
03-May-2016 20:13:57.202 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
03-May-2016 20:13:57.217 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 3138 ms
03-May-2016 20:13:57.470 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
03-May-2016 20:13:57.483 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/9.0.0.M4
03-May-2016 20:13:57.508 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [ajp-nio-50228]
03-May-2016 20:13:57.594 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 375 ms
Connected to server
[2016-05-03 08:13:57,876] Artifact JavaEEHelloWorld:war exploded: Artifact is being deployed, please wait...
[2016-05-03 08:13:58,733] Artifact JavaEEHelloWorld:war exploded: Artifact is deployed successfully
[2016-05-03 08:13:58,733] Artifact JavaEEHelloWorld:war exploded: Deploy took 857 milliseconds
03-May-2016 20:14:07.513 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/apache-tomcat-9.0.0.M4/webapps/manager
03-May-2016 20:14:07.588 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/apache-tomcat-9.0.0.M4/webapps/manager has finished in 74 ms

1 comment

As the message says you already have a process which uses 8080 port so you either need to stop that process or change the port used by Tomcat in the run configuration settings (Run | Edit Configurations).

Also please note that this forum is dedicated to questions related about developing plugins for IntelliJ IDEA, so it would be better to ask question like this in IntelliJ IDEA Users forum.

0

Please sign in to leave a comment.