简体   繁体   English

将 Java Mission Control 连接到 Wildfly 16

[英]Connect Java Mission Control to Wildfly 16

I try to connect Java Mission Control (JMC) with Wildfly 16. Application server lays on Docker.我尝试将 Java Mission Control (JMC) 与Wildfly 16 连接起来。应用服务器位于 Docker。

I successfully connected to wildfly via jconsole, to manage it I followed steps described here .我通过 jconsole 成功连接到 wildfly,为了管理它,我按照此处描述的步骤进行操作。

Unfortunately, I have no luck to connect via JMC.不幸的是,我没有运气通过 JMC 连接。 The URL which I use looks like this:我使用的 URL 如下所示:

service:jmx:remoting-jmx://192.168.99.100:9990服务:jmx:remoting-jmx://192.168.99.100:9990

  • I tried to set Xbootclasspath to jboss-cli-client.jar as it was described here , but I just get Unable to connect error.我尝试将 Xbootclasspath 设置为 jboss-cli-client.jar,正如此处所述,但我只是遇到Unable to connect错误。
  • I set the same jars, which are used for jconsole, but still I got Unable to connect .我设置了相同的 jars,用于 jconsole,但我仍然得到Unable to connect
  • I gave a try to adding flags on container site, as it was shown here , but with these flags, even wildfly haven't started.我尝试在容器站点上添加标志,如此处所示,但是有了这些标志,甚至连 wildfly 都没有启动。

Then, I found here the idea to hardcode some jboss classes to enable connection via remoting-jmx.然后,我在这里发现了对一些 jboss 类进行硬编码以通过 remoting-jmx 启用连接的想法。 I changed version of jars, according to these provided by wildfly16 and put it to jmc.ini like this.我根据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"

After that, finally, I have another error, which is在那之后,最后,我有另一个错误,这是

Could not initialize class org.jboss.remotingjmx.RemotingConnector无法初始化 class org.jboss.remotingjmx.RemotingConnector

I added dependencies of remoting-jmx-3.0.1.Final to Xbootclasspath, but I got still the same error.我将remoting-jmx-3.0.1.Final的依赖项添加到 Xbootclasspath,但我仍然遇到同样的错误。

My question is, have you got any idea, how to make this connection works?我的问题是,您知道如何使这种连接有效吗? Maybe someone have done it in different way?也许有人以不同的方式做到了?

Any advices how can i debug this problem, will be priceless?任何建议我如何调试这个问题,将是无价的? Because I'm lack of ideas how to solve it.因为我不知道如何解决它。

  1. In %WILDFLY_HOME%\\bin\\standalone.conf.bat put:在 %WILDFLY_HOME%\\bin\\standalone.conf.bat 中:

    set "JAVA_OPTS=%JAVA_OPTS% -XX:+FlightRecorder"设置“JAVA_OPTS=%JAVA_OPTS% -XX:+FlightRecorder”

  2. In jmc.ini below -vmargs put在 jmc.ini 下面 -vmargs put

    -Xbootclasspath/a:C:\\%wildfly_home%\\bin\\client\\jboss-cli-client.jar -Xbootclasspath/a:C:\\%wildfly_home%\\bin\\client\\jboss-cli-client.jar

(%wildfly_home% is different of course, or just copy jboss-cli-client.jar to another directory and correct the path) 3. Run JMC, then Create New Connection - in Connection Properties pane push the button "Custom JMX service URL", put: (%wildfly_home% 当然不同,或者只是将 jboss-cli-client.jar 复制到另一个目录并更正路径) 3. 运行 JMC,然后创建新连接 - 在连接属性窗格中按下按钮“自定义 JMX 服务 URL” , 放:

service:jmx:http-remoting-jmx://localhost:9990    

In the credentials fields just put user and password, they should be created for Realm Management (eg using %wildfly_home%\\bin\\add-user.bat) Hope this helps someone.在凭据字段中只输入用户和密码,它们应该为领域管理创建(例如使用 %wildfly_home%\\bin\\add-user.bat) 希望这对某人有所帮助。

Solution doesn't work on java 11 for me.解决方案不适用于 java 11 对我来说。 Mission control fails on connect to wildfly with error:任务控制在连接到 wildfly 时失败并出现错误:

Caused by: java.lang.NoClassDefFoundError: org/ietf/jgss/GSSManager
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3137)
at java.base/java.lang.Class.getConstructor0(Class.java:3342)
at java.base/java.lang.Class.getConstructor(Class.java:2151)
at java.base/java.security.Provider.newInstanceUtil(Provider.java:152)
at java.base/java.security.Provider$Service.newInstance(Provider.java:1824)
at org.wildfly.security.WildFlyElytronBaseProvider$ProviderService.newInstance(WildFlyElytronBaseProvider.java:218)
at org.wildfly.security.sasl.util.SecurityProviderSaslClientFactory.createSaslClient(SecurityProviderSaslClientFactory.java:94)
at org.wildfly.security.sasl.util.AbstractDelegatingSaslClientFactory.createSaslClient(AbstractDelegatingSaslClientFactory.java:66)
at org.wildfly.security.sasl.util.ProtocolSaslClientFactory.createSaslClient(ProtocolSaslClientFactory.java:50)
at org.wildfly.security.sasl.util.AbstractDelegatingSaslClientFactory.createSaslClient(AbstractDelegatingSaslClientFactory.java:66)
at org.wildfly.security.sasl.util.ServerNameSaslClientFactory.createSaslClient(ServerNameSaslClientFactory.java:50)
at org.wildfly.security.sasl.util.AbstractDelegatingSaslClientFactory.createSaslClient(AbstractDelegatingSaslClientFactory.java:66)
at org.wildfly.security.sasl.util.ServerNameSaslClientFactory.createSaslClient(ServerNameSaslClientFactory.java:50)
at org.wildfly.security.sasl.util.FilterMechanismSaslClientFactory.createSaslClient(FilterMechanismSaslClientFactory.java:102)
at org.wildfly.security.sasl.util.AbstractDelegatingSaslClientFactory.createSaslClient(AbstractDelegatingSaslClientFactory.java:66)
at org.wildfly.security.sasl.util.LocalPrincipalSaslClientFactory.createSaslClient(LocalPrincipalSaslClientFactory.java:76)
at org.wildfly.security.sasl.util.PrivilegedSaslClientFactory.lambda$createSaslClient$0(PrivilegedSaslClientFactory.java:64)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.wildfly.security.sasl.util.PrivilegedSaslClientFactory.createSaslClient(PrivilegedSaslClientFactory.java:64)
at org.wildfly.security.auth.client.AuthenticationConfiguration.createSaslClient(AuthenticationConfiguration.java:1545)
at org.wildfly.security.auth.client.AuthenticationContextConfigurationClient.createSaslClient(AuthenticationContextConfigurationClient.java:430)
at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:419)
at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:244)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)

Besides, jmc that was embedded to jdk 8 isn't able to start flight recording for java 11 process.此外,嵌入到 jdk 8 中的 jmc 无法为 java 11 进程启动飞行记录。 So after investigation i found out that this class is loaded with bootstrap classloader.所以经过调查我发现这个 class 加载了引导类加载器。 According to https://openjdk.java.net/jeps/261 jdk.security.jgss module isn't defined to bootstrap classloader.根据https://openjdk.java.net/jeps/261 jdk.security.jgss 模块未定义为引导类加载器。 But classes in jboss-cli-client.jar(it originates from wildfly-elytron project) need jgss classes in runtime.但是jboss-cli-client.jar(源自wildfly-elytron项目)中的类在运行时需要jgss类。 So i found out dirty workaround for this problem: bootstrap needed classes from jre 8 in jmc.ini.所以我找到了解决这个问题的肮脏解决方法:bootstrap needed classes from jre 8 in jmc.ini。 Full option for linux is: linux 的完整选项是:

-vmargs -Xbootclasspath/a:<path_to_wildfly>/jboss-cli-client.jar:<path_to_jdk8>/jre/lib/rt.jar

And for windows:对于 windows:

-vmargs -Xbootclasspath/a:<path_to_wildfly>\jboss-cli-client.jar;<path_to_jdk8>\jre\lib\rt.jar

after this jmc(run on 11 jdk) succesfully connects to wildfly(run on 11 jdk) and can start and analyze flight recordings.在这个 jmc(在 11 jdk 上运行)成功连接到 wildfly(在 11 jdk 上运行)并且可以开始和分析飞行记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM