如何使用JMXWS WS Connector(JSR-262)启动VisualVM?

wax*_*ing 6 java web-services jmx visualvm

我有一个在JBoss中运行的Java应用程序,我在其中启用了JMX远程监控.这允许我连接jconsole和visualvm等工具来监视内存使用情况,cpu利用率,mbeans等.运行我的应用程序的服务器具有限制性端口访问权限,这就是我使用JSR-262 JMX WS Connector的原因.

JSR-262实现有一个如何为jconsole启用jmx:ws协议的示例.但我想尝试使用visualvm.

我认为我必须做的是,在启动visualvm时:

  1. 在类路径中添加一些额外的JSR-262 jar
  2. 将java.endorsed.dirs设置为非捆绑JAXWS库所在的路径

有人能指出我正确的方向吗?有没有一种机制可以为visualvm提供额外的参数?它会起作用吗?还有更简单的方法吗?

wax*_*ing 7

我找到了答案.在运行visualvm的linux版本后,我发现有许多命令行参数可用:

General options:
  --help                show this help 
  --nosplash            do not show the splash screen
  --jdkhome       path to Java(TM) 2 SDK, Standard Edition
  -J        pass  to JVM

  --cp:p     prepend  to classpath
  --cp:a     append  to classpath
Core options:
  --laf  use given LookAndFeel class instead of the default
  --fontsize      set the base font size of the user interface, in points
  --locale  use specified locale
  --userdir       use specified directory to store user settings

Module reload options:
  --reload /path/to/module.jar  Installs or reinstalls a module JAR file.

Additional Module(s) Option(s):
  --openjmx            open application specified by JMX connection (host:port)
  --openid             open application with id 
  --openpid            open application with process id 
  --openfile           open file specified by , file can be Application snapshot, NetBeans Profiler snapshot or HPROF heap dump.

这导致我尝试以下命令:

visualvm\bin\visualvm -cp:a lib\wiseman-core.jar;lib\jmxws.jar -J-Djava.endorsed.dirs=lib\endorsed
Run Code Online (Sandbox Code Playgroud)

这就像一个魅力.