JMX密码读取访问问题

41
当我尝试使用JMX监控这样的应用程序时:
java -Dcom.sun.management.jmxremote.port=9999 \
     -Dcom.sun.management.jmxremote.authenticate=false \
     -Dcom.sun.management.jmxremote.ssl=false \
     JMX_tester

它告诉我:

Error: Password file read access must be restricted:
       /usr/lib/jvm/java-7-oracle/jre/lib/management/jmxremote.password

然而,当我使用 chmod 命令限制读取权限时,它告诉我:

Error: can't read password file

我是不是疯了?我该怎么解决这个问题?

顺便说一下,我使用的是Ubuntu操作系统,安装了最新的Oracle JDK。


1
我在Windows上也遇到了同样的问题。 - RobertG
2个回答

69

确保您用于运行Java进程的用户具有访问文件的权限(所有者/读取权限)。

尝试:

chmod 600 jmxremote.password

另外我建议您制作自己的密码文件并使用它来运行

-Dcom.sun.management.jmxremote.password.file=pwFilePath

所有内容都在这里解释。


12
Windows用户,请查看这个回答另一个问题:https://dev59.com/dGw15IYBdhLWcg3wntAQ#6501127 - RobertG
2
但是当authenticate=false被设置时,为什么我们需要密码呢? - Kanagavelu Sugumar
@KanagaveluSugumar,请检查您的配置中的属性拼写、可能的重写等。这往往容易出错。但是,authenticate=false确实禁用了密码检查。 - Yuri
有关于这个问题的任何答案吗? - Radioactive
@Radioactive,你指的是哪个问题? - Elad Tabak
@EladTabak,尽管我已经设置了“-Dcom.sun.management.jmxremote.authenticate=”:”false”,但我仍然遇到了同样的问题。因此,我的问题是,如果它设置为false,为什么它还要查找密码文件夹。 - Radioactive

1

如果你想绕过身份验证,请尝试使用以下参数。

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=port
-Dcom.sun.management.jmxremote.ssl=false

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接