Mac – Tomcat failed to start on Netbeans

macnetbeanstomcat

I have a problem with starting Apache Tomcat 9 from Netbeans 11 (on 8.2 version I had the same troubles. Where I used Apache Tomcat 8).

What I have tried:

  • Removed quotation marks in catalina.bat.
  • Removed the checkmark from "Use IDE Proxy Settings"
  • Changed/added the code below in server.xml (I did write just couldn't write it in without it being hidden for some reason)

    Connector
    connectionTimeout="20000"
    port="8080"
    protocol="HTTP/1.1"
    redirectPort="8443"
    server="Apache-Coyote/1.1"

On Netbeans 8.2 I started by installing the plugin "Java EE" to be able to add the tomcat. After that I then added the the Tomcat 8.5.46 tar.gz file (also tried with the zip file in the start, didn't work either).
Making a Web Application in Netbeans and running it just gave me the error that the server couldn't start. Trying to run the file again then gives "Starting of Tomcat failed, the server port 8080 is already in use."

On Netbeans 11 it downloaded the standard when trying to add a server. Once that was done I downloaded Tomcat 9.0.26 tar.gz. And this gives the exact same issues as in Netbeans 8.2.

It just says "Starting of Tomcat failed."
In debug mode I get these errors.

24-Sep-2019 18:08:14.774 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:552)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:852)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:639)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:662)
    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:309)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:995)
    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:219)
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1118)
    at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:224)
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:581)
    at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:68)
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:993)
    ... 13 more

Best Answer

Adding

<Connector
connectionTimeout="20000"
port="8080"
protocol="HTTP/1.1"
redirectPort="8443"
server="Apache-Coyote/1.1"
/>

to server.xml

And setting the proxy in NETBEANS to "No Proxy" (not on the server). Fixed the issue.

Related Question