You are not logged in.

#1 2021-04-02 22:21:31

ethin
Member
Registered: 2021-03-12
Posts: 13

Tomcat10: SSLHostConfig attribute certificateFile must be defined

I'm trying to set up tomcat10 with the tomcat-native package installed. I've followed the guide over here, both with java keystores and OpenSSL-generated certificates, and no go. I still get the error "java.lang.IllegalArgumentException: SSLHostConfig attribute certificateFile must be defined when using an SSL connector". Thing is that I've defined all of this properly and its still dying on me. Here's my configuration fro the connector:

    <Executor name="tomcatTlsExecutor"    namePrefix="tls"
        maxThreads="200" minSpareThreads="4" />
    <Connector executor="tomcatTlsExecutor"
        port="8443"
        protocol="org.apache.coyote.http11.Http11AprProtocol"
        SSLEnabled="true" scheme="https" continueResponseTiming="onRead" secure="true">
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig disableSessionTickets="true" honorCipherOrder="true" protocols="TLSv1.3">
            <certificate
                certificateFile="/etc/tomcat10/tomcat.pem"
                certificateKeyFile="/etc/tomcat10/tomcat.key"
                type="RSA" />
        </SSLHostConfig>
    </Connector>

(Sorry for the wacky indentation.) I've tried both with relative and absolute paths and it still dislikes this configuration for some reason. The full exception is this:

SEVERE: Failed to initialize component [Connector[org.apache.coyote.http11.Http11AprProtocol-8443]]
org.apache.catalina.LifecycleException: Protocol handler initialization failed
        at org.apache.catalina.connector.Connector.initInternal(Unknown Source)
        at org.apache.catalina.util.LifecycleBase.init(Unknown Source)
        at org.apache.catalina.core.StandardService.initInternal(Unknown Source)
        at org.apache.catalina.util.LifecycleBase.init(Unknown Source)
        at org.apache.catalina.core.StandardServer.initInternal(Unknown Source)
        at org.apache.catalina.util.LifecycleBase.init(Unknown Source)
        at org.apache.catalina.startup.Catalina.load(Unknown Source)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.apache.catalina.startup.Bootstrap.load(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.init(Unknown Source)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:210)
Caused by: java.lang.IllegalArgumentException: SSLHostConfig attribute certificateFile must be defined when using an SSL connector
        at org.apache.tomcat.util.net.AprEndpoint.createSSLContext(Unknown Source)
        at org.apache.tomcat.util.net.AprEndpoint.bind(Unknown Source)
        at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(Unknown Source)
        at org.apache.tomcat.util.net.AbstractEndpoint.init(Unknown Source)
        at org.apache.coyote.AbstractProtocol.init(Unknown Source)
        at org.apache.coyote.http11.AbstractHttp11Protocol.init(Unknown Source)
        ... 18 more
Caused by: java.io.IOException: SSLHostConfig attribute certificateFile must be defined when using an SSL connector
        at org.apache.tomcat.util.net.SSLUtilBase.getKeyManagers(Unknown Source)
        at org.apache.tomcat.util.net.openssl.OpenSSLUtil.getKeyManagers(Unknown Source)
        at org.apache.tomcat.util.net.SSLUtilBase.createSSLContext(Unknown Source)
        ... 24 more

What am I doing wrong?

Last edited by ethin (2021-04-03 18:10:35)

Offline

#2 2021-04-03 17:20:48

twelveeighty
Member
Registered: 2011-09-04
Posts: 1,456

Re: Tomcat10: SSLHostConfig attribute certificateFile must be defined

Fix your XML snippet in terms of spacing/indentation. It's pretty much impossible to interpret that mess as a human. My guess is that config is wrong, since the error is about a missing attribute. For example, the Tomcat docs reference <Certificate>, not <certificate>, which may be OK if the XML parser is case-insensitive, but I wouldn't take that risk.

Offline

#3 2021-04-03 18:11:15

ethin
Member
Registered: 2021-03-12
Posts: 13

Re: Tomcat10: SSLHostConfig attribute certificateFile must be defined

I've done my best to fix it. Thanks for that. I hate XML myself... I don't know why Tomcat couldn't just use JSON or something like that. I'll give your fix a go.

Offline

#4 2021-04-03 18:14:13

ethin
Member
Registered: 2021-03-12
Posts: 13

Re: Tomcat10: SSLHostConfig attribute certificateFile must be defined

Okay, that fixed it. Thanks for your help!

Offline

Board footer

Powered by FluxBB