我已经使用 GFSH 来启动定位器,如下所示
start locator --name=gemfire_locator --security-properties-file="../config/gfsecurity.properties" --J=-Dgemfire.ssl-enabled-components=all --mcast-port=0 --J=-Dgemfire.jmx-manager-ssl=true
同时启动服务器
start server --name=server1 --security-properties-file="../config/gfsecurity.properties" --J=-Dgemfire.ssl-enabled-components=all --mcast-port=0 --J=-Dgemfire.jmx-manager-ssl=true
我正在尝试连接到 Gemfire 作为 ClientCache,它在 SSL 上工作得很好。但是当我作为 JMX 客户端连接时,我在 Java 代码和 Jconsole 中遇到以下错误。
Error:
Exception in thread "main" java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: non-JRMP server at remote endpoint]
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:369)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:270)
at SamplePlugin.main(SamplePlugin.java:101)
我是否缺少任何其他配置?
这是我的 JAVA_TOOL_OPTIONS
:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=true
-Djava.rmi.server.hostname=myhostname
最佳答案
您还需要将 geode-core
jar 添加到 jvisualvm 的类路径中。使用 --cp:a
选项。我建议只使用 geode-dependencies.jar
,因为这将获得您可能需要的一切。
需要这样做的原因在 ContextAwareSSLRMIClientSocketFactory 的评论中有一些解释。 .基本上,当 RMI 使用 SSL 时,必要的 RMIClientSocketFactory
似乎从 server 导出到客户端以供在那里使用。一般来说,这只是 SslRMIClientSocketFactory
。但在我们的例子中,我们有一个自定义套接字工厂,因此客户端(在本例中为 jvisualvm)需要访问它。
关于ssl - 通过 SSL 与 Gemfire 的 JMX 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54569523/