Tomcat 9 APR Connector Failed to initialize component java.lang.UnsatisfiedLinkError

169 Views Asked by At

I'm trying to use APR Connector with Tomcat 9.x according to the steps given in Tomcat ans APR lib : requires the APR/native library which is not available to install APR native library. But I get the following error when running the application.

org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector["https-openssl-apr-8443"]]
    java.lang.UnsatisfiedLinkError: 'long org.apache.tomcat.jni.Address.info(java.lang.String, int, int, int, long)'
        at org.apache.tomcat.jni.Address.info(Native Method)
        at org.apache.tomcat.util.net.AprEndpoint.bind(AprEndpoint.java:361)
        at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1332)
        at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1345)
        at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:654)
        at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:75)
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:1009)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127)
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:554)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1039)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:724)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:746)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:307)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:477)

Server.xml

<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true">
      <SSLHostConfig protocols="TLSv1.2+TLSv1.3" sslProtocol="TLS">
           <Certificate certificateKeystoreFile="conf/keystore.p12"
                certificateKeystorePassword="password" certificateKeystoreType="PKCS12"/>
      </SSLHostConfig>
</Connector>

Installed versions

  • Java 11
  • Apache Tomcat 9.0.84
  • Tomcat Native 2.0.6
  • Apache APR 1.7.4
  • OS: MacOS 14.0 ARM

Other than the steps given in the link above, I used the follwoing environment variable in setenv.sh file since the given env was not working for me.

export JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$CATALINA_HOME/lib"
1

There are 1 best solutions below

0
On BEST ANSWER

You cannot use Tomcat Native 2.x if you use the APR connector. Stick to Tomcat Native 1.x.