Server Apache Tomcat v9 at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.

不知道為什麼, web server 一直掛掉,重開機之後也一樣。

解法: 在 server 分頁裡面 server 第一層,點2下,層開timeout 設定值,修改原本的 45 秒為 60 或 90.

上面是網路上的解決方案,實測無效。

我發生的原因,是在 eclipse 沒有關閉的情況下,升級 tomcat 從 9.0.86 升到 9.0.93, 並直接使用 9.0.86 的 server.xml, 結果就是 tomcat 的舊版本 class 被 cached 住,造成舊版本的 server.xml 設定值在 tomcat 9.0.93 上居然正常的執行,但是在隔了4天之後,太舊的 cached 的 class 被回收走了,系統就掛掉了。

這時候,重開機就是固定會出現錯誤訊息,發生的原因就是 tomcat 9.0.89 版之後 ssl 的寫法修改了。

舊的寫法:

<Connector SSLEnabled="true" clientAuth="false" connectionTimeout="20000" keystoreFile="conf/your-ca.jks" keystorePass="your-password" maxParameterCount="1000" maxThreads="150" port="443" protocol="HTTP/1.1" scheme="https" secure="true"/>

新的寫法:

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
           maxThreads="150" SSLEnabled="true"
           maxParameterCount="1000"
           >
    <SSLHostConfig>
        <Certificate certificateKeystorePassword="your-password" certificateKeystoreFile="conf/your-ca.jks"
                     type="RSA" />
    </SSLHostConfig>
</Connector>

Tomcat 官方說明

The HTTP Connector
https://tomcat.apache.org/tomcat-9.0-doc/config/http.html

certificateKeystoreFileThe pathname of the keystore file where you have stored the server certificate and key to be loaded. By default, the pathname is the file .keystore in the operating system home directory of the user that is running Tomcat. If your keystoreType doesn’t need a file use "" (empty string) or NONE for this parameter. Relative paths will be resolved against $CATALINA_BASE. A URI may also be used for this attribute. When using a domain keystore (keystoreType of DKS), this parameter should be the URI to the domain keystore.This attribute is required unless certificateFile is specified.
certificateKeystorePasswordThe password to use to access the keystore containing the server’s private key and certificate. If not specified, a default of changeit will be used.


相關文章

如何在eclipse升級tomcat 版本
https://stackoverflow.max-everyday.com/2023/10/how-to-upgrade-tomcat-version-in-eclipse/

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *