【问题标题】:How do I connect to remoting-connector using Wildfly 10?如何使用 Wildfly 10 连接到远程连接器?
【发布时间】:2016-05-24 09:22:24
【问题描述】:

有人知道如何更接近解决我的问题吗?

我正在努力与我的 Wildfly 服务器的 jmx 进行远程连接。

环境

WildFly 10.0.0 最终版

JDK 1.8.0_66

域模式

专用远程套接字

专用远程连接器

我引入了一个专用的远程连接器,因为我想只通过这个端口访问 jmx 并将我的管理保留在另一个端口上。我在那里定义了安全领域以及一些用户。

工作方式

我在语法“service:jmx:://:”中尝试了几个连接字符串。但没有协议有效:

  • 远程
  • http-remoting-jmx
  • 远程处理-jmx
  • 远程+http
  • 远程-远程
  • 远程处理-jmx

错误

这出现在我的 WF 服务器的 server.log 中

DEBUG [org.jboss.remoting.remote.connection](默认 I/O-5)JBREM000200:远程连接失败:java.io.IOException:XNIO000804:收到的无效消息长度为 1195725856

配置文件配置片段

<subsystem xmlns="urn:jboss:domain:remoting:3.0">
    <endpoint/>
    <connector name="remoting" socket-binding="remoting" security-realm="ApplicationRealm"/>
    <http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>
</subsystem>

我想在我的 Windows 客户端上使用 VisualVM 进行连接,所以我使用 Wildfly jconsole.bat 并调整了可执行文件以使用 VisualVM。

VisualVM 的环境脚本

@echo off
rem -------------------------------------------------------------------------
rem jconsole script for Windows
rem -------------------------------------------------------------------------
rem
rem A script for running jconsole with the remoting-jmx libraries on the classpath. 

rem $Id$
set JBOSS_HOME="C:\local\wildfly_10.0"
set JAVA_HOME="C:\Programme\Java\jdk1.8.0_66"


@if not "%ECHO%" == ""  echo %ECHO%
@if "%OS%" == "Windows_NT" setlocal

if "x%JAVA_HOME%" =="x" (
    echo JAVA_HOME environment variable has not been set - please set and re-run!
    goto :EOF
)

if "%OS%" == "Windows_NT" (
set "DIRNAME=%~dp0%"
) else (
set DIRNAME=.\
)

pushd %DIRNAME%..
set "RESOLVED_JBOSS_HOME=%CD%"
popd

if "x%JBOSS_HOME%" == "x" (
set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%" 
)

pushd "%JBOSS_HOME%"
set "SANITIZED_JBOSS_HOME=%CD%"
popd

if "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
    echo WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
)

set DIRNAME=

if "%OS%" == "Windows_NT" (
set "PROGNAME=%~nx0%"
) else (
set "PROGNAME=jdr.bat"
)

rem Setup JBoss specific properties
if "%JAVA_HOME%" == "x" (  
echo JAVA_HOME is not set. Unable to locate the jars needed to run jconsole.
goto END
)

rem Find jboss-modules.jar, or we can't continue
if exist "%JBOSS_HOME%\jboss-modules.jar" (
    set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar"
) else (
echo Could not locate "%JBOSS_HOME%\jboss-modules.jar".
echo Please check that you are in the bin directory when running this script.
goto END
)

rem Set default module root paths
if "x%JBOSS_MODULEPATH%" == "x" (
set  "JBOSS_MODULEPATH=%JBOSS_HOME%\modules"
)

rem Setup The Classpath
set CLASSPATH=


call :SearchForJars %JBOSS_MODULEPATH%\system\layers\base\org\jboss\remoting\main
call :SearchForJars %JBOSS_MODULEPATH%\system\layers\base\org\jboss\remoting-jmx\main
call :SearchForJars %JBOSS_MODULEPATH%\system\layers\base\org\jboss\remoting3\remoting-jmx\main
call :SearchForJars %JBOSS_MODULEPATH%\system\layers\base\org\jboss\remoting3\main
call :SearchForJars %JBOSS_MODULEPATH%\system\layers\base\org\jboss\logging\main
call :SearchForJars %JBOSS_MODULEPATH%\system\layers\base\org\jboss\xnio\main
call :SearchForJars %JBOSS_MODULEPATH%\system\layers\base\org\jboss\xnio\nio\main
call :SearchForJars %JBOSS_MODULEPATH%\system\layers\base\org\jboss\sasl\main
call :SearchForJars %JBOSS_MODULEPATH%\system\layers\base\org\jboss\marshalling\main
call :SearchForJars %JBOSS_MODULEPATH%\system\layers\base\org\jboss\marshalling\river\main


"%JAVA_HOME%\bin\jvisualvm.exe" "-cp:a" "%CLASSPATH%" 

:END
goto :EOF

:SearchForJars
pushd %1
for %%j in (*.jar) do call :ClasspathAdd %1\%%j
popd
goto :EOF

:ClasspathAdd
SET CLASSPATH=%CLASSPATH%;%1


:EOF

【问题讨论】:

  • 我不是这方面的专家,但有一点需要注意的是,您可以使用jboss-client.jar uber JAR 中的$JBOSS_HOME/bin/client 中的类路径。我认为该消息意味着您正在尝试使用 HTTP 之类的东西进行连接,但您正在使用远程处理 &lt;connector/&gt;

标签: java wildfly jmx remoting visualvm


【解决方案1】:

对于 Wildfly 10.1:

从 wildfly/bin 目录运行 jconsole.sh。

与服务连接:jmx:remote+http://server:port

以及您添加的管理用户。

在日志输出中可以看到端口

10:20:36,785 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://server:10090/management

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-24
    • 1970-01-01
    • 2016-08-25
    • 1970-01-01
    • 2019-02-23
    • 2014-12-09
    • 2017-03-25
    • 2015-07-10
    相关资源
    最近更新 更多