
我在 CentOS 上運行 Tomcat 8.0.23(我知道應該升級),我需要使用身份驗證和 SSL 設定 JMX。我能夠從 Windows 電腦透過 SSL 隧道使用 SSL 和密碼進行連線。但是當我輸入與 SSL 相關的 JVM 參數時,tomcat 不會啟動。我查看了很多文檔,但沒有發現我的設定有錯誤。
export JMS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$RMI_PORT -Dcom.sun.management.jmxremote.rmi.port=$RMI_PORT -Dcom.sun.management.jmxremote.local.only=false -D java.rmi.server.hostname=localhost"
export JMS_NO_AUTH="-Dcom.sun.management.jmxremote.authenticate=false"
export CONFIG_PATH="/opt/tomcat/default/conf"
export JMS_AUTH="-Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=$CONFIG_PATH/jmxremote.access -Dcom.sun.management.jmxremote.password.file=$CONFIG_PATH/jmxremote.password"
export JMS_SSL_OFF="-Dcom.sun.management.jmxremote.ssl=false"
export JMS_SSL_ON="-Dcom.sun.management.jmxremote.ssl=true -Djavax.net.ssl.keyStore=$CONFIG_PATH/jmx_ssl.jks -Djavax.net.ssl.keyStorePassword=StupidPassword"
export CATALINA_OPTS="$JMS $JMS_AUTH $JMS_SSL_ON"
湯姆貓日誌:
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 1616; nested exception is:
java.net.BindException: Address already in use
當我切換到無 SSL 時,Tomcat 正常啟動並且我可以連接
export CATALINA_OPTS="$JMS $JMS_AUTH $JMS_SSL_OFF"
知道問題出在哪裡嗎?
答案1
看起來像您在這裡定義的連接埠:
-Dcom.sun.management.jmxremote.port=$RMI_PORT
正在使用中。所以重新定義這個變數RMI_PORT
來指向其他連接埠。或檢查並停止(如果不需要)偵聽連接埠 1616 的服務