tomcat ajp 8009 Protocol family unavailable
Asked Answered
B

2

5

#question According to the official example of tomcat, I often configure the test and start. I encountered a strange problem and found that there is a problem with 8009 startup, Port and firewall are normal,and I don't know how to deal with it.

server.xml https://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html(Configuration Example)

# tomcat log   
<code>   

    INFO: Server version name:   Apache Tomcat/7.0.103
    INFO: Server version number: 7.0.103.0
    INFO: OS Name:               Linux
    INFO: CATALINA_HOME:         /home/tomcat/apache-tomcat-7.0.103

    INFO: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
    INFO: Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
    INFO: Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
    INFO: Command line argument: -Dignore.endorsed.dirs=
    INFO: Command line argument: -Dcatalina.base=/home/tomcat/apache-tomcat-7.0.103
    INFO: Command line argument: -Dcatalina.home=/home/tomcat/apache-tomcat-7.0.103
    INFO: Command line argument: -Djava.io.tmpdir=/home/tomcat/apache-tomcat-7.0.103/temp
    Apr 13, 2020 5:47:16 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
    INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
    Apr 13, 2020 5:47:16 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-bio-8080"]
    Apr 13, 2020 5:47:17 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["ajp-bio-0:0:0:0:0:0:0:0-8009"]
    Apr 13, 2020 5:47:17 PM org.apache.coyote.AbstractProtocol init
    SEVERE: Failed to initialize end point associated with ProtocolHandler ["ajp-bio-0:0:0:0:0:0:0:0-8009"]
    java.net.SocketException: Protocol family unavailable
            at java.net.PlainSocketImpl.socketBind(Native Method)
            at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
            at java.net.ServerSocket.bind(ServerSocket.java:376)
            at java.net.ServerSocket.<init>(ServerSocket.java:237)
            at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:55)
            at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:404)
            at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:750)
            at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:467)
            at org.apache.catalina.connector.Connector.initInternal(Connector.java:981)
            at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
            at org.apache.catalina.core.StandardService.initInternal(StandardService.java:560)
            at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
            at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:826)
            at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
            at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
            at org.apache.catalina.startup.Catalina.load(Catalina.java:686)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:244)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
            Apr 13, 2020 5:47:17 PM org.apache.catalina.core.StandardService initInternal
    SEVERE: Failed to initialize connector [Connector[AJP/1.3-8009]]
    org.apache.catalina.LifecycleException: Protocol handler initialization failed
            at org.apache.catalina.connector.Connector.initInternal(Connector.java:983)
            at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
            at org.apache.catalina.core.StandardService.initInternal(StandardService.java:560)
            at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
            at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:826)
            at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
            at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
            at org.apache.catalina.startup.Catalina.load(Catalina.java:686)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:244)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    Caused by: java.net.SocketException: Protocol family unavailable
            at java.net.PlainSocketImpl.socketBind(Native Method)
            at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
            at java.net.ServerSocket.bind(ServerSocket.java:376)
            at java.net.ServerSocket.<init>(ServerSocket.java:237)
            at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:55)
            at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:404)
            at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:750)
            at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:467)
            at org.apache.catalina.connector.Connector.initInternal(Connector.java:981)
            ... 13 more
            Apr 13, 2020 5:47:17 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 515 ms
    Apr 13, 2020 5:47:17 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service [Catalina]
    Apr 13, 2020 5:47:17 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.103
    Apr 13, 2020 5:47:17 PM org.apache.catalina.ha.tcp.SimpleTcpCluster startInternal
    INFO: Cluster is about to start
</code>    
Balata answered 13/4, 2020 at 10:34 Comment(0)
B
10

It has been resolved. The server may not support IP6. Modify the configuration as follows, the problem is solved。 Connector protocol="AJP/1.3" address=" ::1 changed to 0.0.0.0"

Balata answered 15/4, 2020 at 0:58 Comment(0)
S
3

My Issue resolved by fixing the below (tomcat 9):

<Connector protocol="AJP/1.3"
           address="0.0.0.0" 
           secretRequired="false"
           port="8009"
           redirectPort="8443" />
Scalp answered 23/3, 2021 at 20:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.