我正在尝试打开与远程计算机上运行的Java应用程序的JMX连接.
应用程序JVM配置有以下选项:
我可以localhost:1088使用jconsole或jvisualvm 进行连接.但是我无法使用xxx.xxx.xxx.xxx:1088远程计算机进行连接.
服务器之间或操作系统之间没有防火墙.但是为了消除这种可能性我telnet xxx.xxx.xxx.xxx 1088和我认为它连接起来,因为控制台屏幕变成了空白.
两台服务器都是Windows Server 2008 x64.尝试使用64位JVM和32位,都不起作用.
我正在尝试使用jConsole连接到远程tomcat JMX实例.但无法成功连接.任何的想法?
我在远程tomcat中包含以下选项catalina.sh:
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=9004 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false"
Run Code Online (Sandbox Code Playgroud) 出于某种奇怪的原因,我无法使用VisualVM或连接jconsole到JMX.
用于启动要监视的VM的参数:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1100
我检查过,我可以从本地和远程telnet到这个端口.
尽管如此,在花费了相当多的时间尝试之后,VisualVM或jconsole仍无法连接.
REMOTE MACHINE with JMX (debian)
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
MY WORKSTATION (OS X)
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
Run Code Online (Sandbox Code Playgroud)
问题是什么?
我在我的远程计算机中使用以下命令启动了我的OSGi应用程序:
java -Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=8080 \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-jar bin/felix.jar
Run Code Online (Sandbox Code Playgroud)
在我的本地机器上,我有VisualVM,我尝试连接到远程JVM实例:



我错过了什么?
谢谢!
我想通过JMX远程通过VisualVM分析Java应用程序.因为它是一个NAT和防火墙的EC2实例,我不能使用默认的RMI方法,需要使用我必须首先下载的可选JMXMP扩展.
注意 - 如果您想使用JMXMP连接器,下载JSR 160的参考实现FROM,并添加JMXREMOTE_OPTIONAL.JAR文件到您的CLASSPATH.您将在JMX远程API补习中找到使用JMXMP连接器的示例,包括JSR 160参考实现.
http://docs.oracle.com/javase/6/docs/technotes/guides/jmx/overview/connectors.html
但是当我去那个页面时,我找不到下载.事实上,谷歌找不到下载.我在哪里可以获得这些扩展?
当我使用时jVisualVM,我看到两个本地进程:VisualVM本身和我感兴趣的进程让我们调用它ProcessX.当我双击这个VisualVM过程时,一切正常.当我双击时ProcessX,应用程序卡住了,不再对应了.我用eclipse运行我的Java应用程序,和我有一个单机版jVisualVM上的Windows x64盒子.我从"C:\ Program Files\Java\jdk1.7.0_51\bin"运行jVisualVM.在VisualVM菜单中将代理设置为"无代理"对我也没有帮助
我想监视生产环境中的JVM性能.我只安装了JRE,而不是JDK,因此我不能使用jstat,jconsole等来监控JVM性能.
有人可以帮助理解我如何在这种情况下监控JVM性能?
有没有办法实现这个目标?
(请注意,我不想通过JMX或其他方式远程监控它.我想在每台机器上安装本地代理,它将以1分钟的间隔将指标发送到服务器.)
谢谢,KS
我想将调试器附加到我在 dockerized WebLogic 12c 中部署的 WAR。我使用 WebLogic 的官方镜像(这是一个 Linux 容器) https://hub.docker.com/_/oracle-weblogic-server-12c 并使用 docker 命令启动容器:
docker run -d -p 4002:4002 -p 9002:9002
-v c:/my-path-to-shared-volume:/u01/oracle/properties
-e ADMINISTRATION_PORT_ENABLED=true -e DOMAIN_NAME=docker_domain
-e JAVA_TOOL_OPTIONS=\"-agentlib:jdwp=transport=dt_socket,address=4002,server=y,suspend=n\"
--name weblogic store/oracle/weblogic:12.2.1.3-dev-200109
Run Code Online (Sandbox Code Playgroud)
weblogic 控制台在https://localhost:9002/console/ 上活跃起来,但是在尝试运行调试器时,我的 IDE 说:
无法打开调试器端口(本地主机:4002):java.io.IOException“握手失败 - 连接过早关闭”
我的操作系统是Windows10。我尝试了Visual Studio Code 和 IntelliJ,并得到了相同的输出。WAR 运行得很好,当我使用 portman 命中某些服务端点时,它们会做出响应。
似乎发生的是容器内的 weblogic 启动脚本尝试两次应用 Java 选项参数!请参阅下面的容器输出的相关部分:
域主页是:/u01/oracle/user_projects/domains/docker_domain 拿起 JAVA_TOOL_OPTIONS:“-agentlib:jdwp=transport=dt_socket,address=localhost:4002,server=y,suspend=n” 在地址侦听传输 dt_socket:4002 正在初始化 WebLogic 脚本工具 (WLST) ... 欢迎使用 WebLogic Server 管理脚本外壳
[...] (在我得到的日志中进一步向下:)
使用以下行启动 WLS:/usr/java/jdk-8/bin/java -server -Djava.security.egd=file:/dev/./urandom -cp /u01/oracle/wlserver/server/lib/weblogic-launcher …
我有很多与jconsole.exe和JVisualVM.exe经验,在JDK1.6及以上已连接数千次从Windows JVM到Windows JVM通过JMX.remote另一台机器上,但是当我尝试监视失败一个在Linux主机上运行的java实例(来自Windows主机,我在redhat上尝试了JMX监听器,在Amazon EC2上尝试了SUSE).我也尝试使用jconsole.exe并得到类似的错误.
是否有任何人可以想到的原因,为什么这种JMX连接会有问题.我可以尝试任何想法吗?有没有人"实际"做到这一点,可以说如果我坚持下去会有效吗?
我从JVisualVM获得的错误(在远程连接尝试中)是这样的:
"Cannot connect using service:jmx:rmi:///jndi/rmi://<jmx service ip>:8001/jmxrmi"
Run Code Online (Sandbox Code Playgroud)
我的远程JMX服务配置是这样的:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8001
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.hostname=<jmx service ip>
Run Code Online (Sandbox Code Playgroud)
在此链接中发现了类似的问题,但它没有回答我的问题.
我确认"iptables"没有作为服务启用而且没有打开,所以我没有成像,有任何类型的防火墙阻塞.此外,Windows和Linux机器都在10.0.0.0私有内部子网上.我能够telnet到端口8001来验证它的存在,并在linux机器上监听它(netstat -ap).
我的Spring应用程序运行在NAT防火墙(pfSense)后面的机器上.机器的内部IP是a.b.c.d,NAT IP是w.x.y.z
Spring配置的serviceUrl设置为a.b.c.d端口上的内部IP()1100,当我启动应用程序时,我提供以下开关:
-Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=w.x.y.z -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
Run Code Online (Sandbox Code Playgroud)
如上所示,我进行了设置-Djava.rmi.server.hostname=w.x.y.z,以便可以通过NAT连接到应用程序.我还打开了机器防火墙上的相关端口,并设置了一个从w.x.y.z:1100前往的端口a.b.c.d:1100
当我尝试使用jconsole从网络外部连接到应用程序时w.x.y.z:1100,我得到了一个java.io.IOException: jmxrmi
java.io.IOException: jmxrmi
at sun.tools.jconsole.ProxyClient.checkSslConfig(ProxyClient.java:236)
at sun.tools.jconsole.ProxyClient.<init>(ProxyClient.java:127)
at sun.tools.jconsole.ProxyClient.getProxyClient(ProxyClient.java:483)
at sun.tools.jconsole.JConsole$3.run(JConsole.java:524)
Caused by: java.rmi.NotBoundException: jmxrmi
at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:136)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:409)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:378)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) …Run Code Online (Sandbox Code Playgroud) 我尝试将 Java Mission Control (JMC) 与Wildfly 16连接起来。应用程序服务器位于 Docker 上。
我通过 jconsole 成功连接到 wildfly,为了管理它,我按照此处描述的步骤进行了管理。
不幸的是,我没有运气通过 JMC 连接。我使用的 URL 如下所示:
服务:jmx:remoting-jmx://192.168.99.100:9990
Unable to connect错误。Unable to connect.然后,我在这里找到了硬编码一些 jboss 类以通过 remoting-jmx 启用连接的想法。我根据wildfly16提供的这些更改了jars的版本,并像这样将其放入jmc.ini。
-Xbootclasspath/a:"C:/Program Files/Java/jdk-10.0.2/lib/missioncontrol/dropins/jboss-cli-client.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/remoting-jmx/main/remoting-jmx-3.0.1.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/remoting/main/jboss-remoting-5.0.8.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/logging/main/jboss-logging-3.3.2.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/xnio/main/xnio-api-3.6.5.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/xnio/nio/main/xnio-nio-3.6.5.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/marshalling/main/jboss-marshalling-2.0.6.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/marshalling/river/main/jboss-marshalling-river-2.0.6.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/as/cli/main/wildfly-cli-8.0.0.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/staxmapper/main/staxmapper-1.3.0.Final;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/as/protocol/main/wildfly-protocol-8.0.0.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/dmr/main/jboss-dmr-1.5.0.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/as/controller-client/main/wildfly-controller-client-8.0.0.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/threads/main/jboss-threads-2.3.3.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.7.Final.jar"
Run Code Online (Sandbox Code Playgroud)
在那之后,最后,我有另一个错误,那就是
无法初始化类 org.jboss.remotingjmx.RemotingConnector
我添加了remoting-jmx-3.0.1.Final对 Xbootclasspath 的依赖项,但仍然出现相同的错误。
我的问题是,您知道如何使这种连接有效吗?也许有人以不同的方式做到了?
任何建议我如何调试这个问题,将是无价的?因为我缺乏如何解决它的想法。
谁能给我一个暗示我做错了什么?
所以,在Redhat(Amazon AMI Instance)上,我试图获得正在运行的应用程序的核心转储.即使远程端口是全开的(并且JMX服务器已正确配置),我也无法从jboxsole.exe或jvisualvm.exe从Windows框连接到JMX端口.我不知道为什么,所以我试图直接从JVM获得核心转储(Cntrl-\didnt工作).所以,这是我如何设置以获得核心转储,但它不起作用,我不知道为什么.
[ec2-user bin]$
jsadebugd 2504 -F Attaching to process
ID 2504 and starting RMI services,
please wait... Debugger attached and
RMI services started.
Run Code Online (Sandbox Code Playgroud)
因此,在调试器运行后,我尝试使用它创建转储,但它失败了:
[ec2-user ~]$ jmap -dump:live,format=b,file=dump.t 2504
2504: Unable to open socket file:
target process not responding or
HotSpot VM not loaded The -F option
can be used when the target process is
not responding
[ec2-user ~]$ jmap -dump:live,format=b,file=dump.t 2504 -F
Attaching to core -F from
executable 2504, please wait... Error
attaching to core file: …Run Code Online (Sandbox Code Playgroud)