IBM Websphere 中的 Java VisualVM JMX 连接

标签 java websphere rmi jmx visualvm

我正在尝试使用 JVisualVM 监视 IBM Websphere,但无法连接。 错误提示“无法使用服务连接:jmx:rmi:///jndi/rmi:///jmxrmi” 这是我们第一次在 WAS 中使用 IBM JDK。这在我们旧的 Solaris 服务器上运行顺利。

规范和配置。

  • IBM Websphere 8.0.0.5
  • 红帽 Linux
  • Java 版本 = 1.6.0,Java 编译器 = j9jit26,Java VM 名称 = IBM J9 虚拟机
  • JVM 参数:

-Djavax.management.builder.initial= -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=19823 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Xgcpolicy:gencon -verbose:gc -Djava.rmi.server.hostname=

VISUALVM 错误。

[com.sun.tools.visualvm.jmx.impl.JmxModelImpl]: connect(service:jmx:rmi:///jndi/rmi://<MYHOST>:19823/jmxrmi)
java.io.EOFException: SSL peer shut down incorrectly
    at sun.security.ssl.InputRecord.read(InputRecord.java:505)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954)
Caused: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1343)
    at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:728)
    at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
    at java.io.DataOutputStream.flush(DataOutputStream.java:123)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:229)
Caused: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: 
    javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:304)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:342)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:118)
Caused: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: 
    javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake]
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:122)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:205)
    at javax.naming.InitialContext.lookup(InitialContext.java:417)
    at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1929)
    at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1896)
    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:287)
Caused: java.io.IOException: Failed to retrieve RMIServer stub
    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:369)
    at com.sun.tools.visualvm.jmx.impl.JmxModelImpl$ProxyClient.tryConnect(JmxModelImpl.java:512)
[catch] at com.sun.tools.visualvm.jmx.impl.JmxModelImpl$ProxyClient.connect(JmxModelImpl.java:449)
    at com.sun.tools.visualvm.jmx.impl.JmxModelImpl.connect(JmxModelImpl.java:203)
    at com.sun.tools.visualvm.jmx.impl.JmxModelImpl.<init>(JmxModelImpl.java:192)
    at com.sun.tools.visualvm.jmx.impl.JmxModelProvider.createModelFor(JmxModelProvider.java:40)
    at com.sun.tools.visualvm.jmx.impl.JmxModelProvider.createModelFor(JmxModelProvider.java:21)
    at com.sun.tools.visualvm.core.model.ModelFactory.getModel(ModelFactory.java:91)
    at com.sun.tools.visualvm.tools.jmx.JmxModelFactory.getJmxModelFor(JmxModelFactory.java:49)
    at com.sun.tools.visualvm.jmx.impl.JmxApplicationProvider.addJmxApplication(JmxApplicationProvider.java:261)
    at com.sun.tools.visualvm.jmx.impl.JmxApplicationProvider.createJmxApplication(JmxApplicationProvider.java:170)
    at com.sun.tools.visualvm.jmx.JmxApplicationsSupport.createJmxApplicationImpl(JmxApplicationsSupport.java:273)
    at com.sun.tools.visualvm.jmx.JmxApplicationsSupport.createJmxApplicationInteractive(JmxApplicationsSupport.java:250)
    at com.sun.tools.visualvm.jmx.impl.AddJMXConnectionAction$1.run(AddJMXConnectionAction.java:60)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1393)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2005)

检查已完成。

  1. 公开服务器中的 JMX 端口。我可以看到它正在听。 我什至可以在我的设备中使用 telnet <19823> 连接到 笔记本电脑。
  2. 我在 websphere 端没有看到任何错误日志。

最佳答案

通过尝试在 Linux 中禁用 iptables 解决了这个问题。 然后不知何故,运营/支持部门批准打开一些默认的临时端口供 RMI 使用。

最终 JVM 参数如下。

-Djavax.management.builder.initial= -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=PORT -Dcom.sun.management.jmxremote.rmi.port=PORT -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=HOST

谢谢!

关于IBM Websphere 中的 Java VisualVM JMX 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60164083/

相关文章:

java - 在 JAVA 中将项目设置为组合框

java - @ExceptionHandler 响应在 Tomcat 中不起作用

java - Spring JPA - findAll() 带有示例/探针,包括相关/连接的实体

java.lang.NoClassDefFoundError : Could not initialize class org. Ghost4j.GhostscriptLibrary

java - 访问外部WS时为"WebServiceException: Failed to access the WSDL"和"CertificateException: PKIX path building failed"

java - 为什么我们需要 ibm-web-bnd.xml 和 ibm-web-ext.xml?

Websphere 8.5 上下文根更改不适用于 war 文件

java - 如何获取java RMI编程的客户端IP?

java - RMI stub 和子类继承

Java RMI第一次调用很慢