[英]Enabling jmx authentication on java app run as a service using procrun
我正在使用procrun將Java應用程序作為服務運行。 當未啟用JMX身份驗證時,該應用程序運行良好,但是當我添加訪問和密碼文件,限制對密碼文件的權限並啟用JMX身份驗證時,該應用程序未啟動並給出1074: The process terminated unexpectedly
錯誤。
以下是我使用最新版本的procrun將應用程序注冊為服務的腳本。
cd E:\MyApp
MyApp.exe //IS//MyApp --Install=%cd%\MyApp.exe --Jvm="C:\Program Files\Java\jdk1.8.0_131\jre\bin\server\jvm.dll" --JvmMx=2048 --JvmMs=2048 --Startup=auto --StartMode jvm --StartClass com.MyApp --StartParams start --StartMethod start --StopMode jvm --StopClass com.MyApp --StopParams stop --StopMethod stop --Classpath=%cd%\MyApp.jar --LibraryPath=%cd%\bin --JvmOptions="-Duser.dir=%cd%" ++JvmOptions=-XX:+RelaxAccessControlCheck ++JvmOptions=-Dcom.sun.management.jmxremote ++JvmOptions=-Dcom.sun.management.jmxremote.port=1099 ++JvmOptions=-Dcom.sun.management.jmxremote.ssl=false ++JvmOptions=-Dcom.sun.management.jmxremote.authenticate=true ++JvmOptions=-Dcom.sun.management.jmxremote.access.file=E:\MyApp\Conf\jmxremote.access ++JvmOptions=-Dcom.sun.management.jmxremote.password.file=E:\MyApp\Conf\jmxremote.password --JvmOptions=-XX:+UseConcMarkSweepGC --JvmOptions=-XX:CMSInitiatingOccupancyFraction=40 ++JvmOptions=-Dorg.xml.sax.parser="com.sun.org.apache.xerces.internal.parsers.SAXParser" ++JvmOptions=-Djavax.xml.parsers.DocumentBuilderFactory="com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl" ++JvmOptions=-Djavax.xml.parsers.SAXParserFactory="com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl" --LogPath=E:\Logs --LogLevel=DEBUG --StdOutput=auto --StdError=auto --StartPath=%cd% --StopPath=%cd% --DisplayName=MyApp
關於可能出什么問題的任何線索?
我認為您的密碼文件有問題。 首先,只需使用像我的簡單的jmx配置。 這是我用於啟動的簡單JMX配置:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=11099
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.local.only=false
-Djava.rmi.server.hostname=localhost
-Dcom.sun.management.jmxremote.rmi.port=11098
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.