1

我可以通过本地 Jconsole 访问 Mbean,但无法从远程主机访问 MBean。

我的配置:

<?xml version='1.0' encoding='UTF-8'?>

<server xmlns="urn:jboss:domain:1.4">
    <extensions>
        <extension module="org.infinispan.server.endpoint"/>
        <extension module="org.jboss.as.clustering.infinispan"/>
        <extension module="org.jboss.as.clustering.jgroups"/>
        <extension module="org.jboss.as.connector"/>
        <extension module="org.jboss.as.jdr"/>
        <extension module="org.jboss.as.jmx"/>
        <extension module="org.jboss.as.logging"/>
        <extension module="org.jboss.as.modcluster"/>
        <extension module="org.jboss.as.naming"/>
        <extension module="org.jboss.as.remoting"/>
        <extension module="org.jboss.as.security"/>
        <extension module="org.jboss.as.threads"/>
        <extension module="org.jboss.as.transactions"/>
        <extension module="org.jboss.as.web"/>
    </extensions>
    <management>
        <security-realms>
            <security-realm name="ManagementRealm">
                <authentication>
                    <local default-user="$local"/>
                    <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
                </authentication>
            </security-realm>
            <security-realm name="ApplicationRealm">
                <authentication>
                    <local default-user="$local" allowed-users="*"/>
                    <properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
                </authentication>
            </security-realm>
        </security-realms>
        <management-interfaces>
            <native-interface security-realm="ManagementRealm">
                <socket-binding native="management-native"/>
            </native-interface>
            <http-interface security-realm="ManagementRealm">
                <socket-binding http="management-http"/>
            </http-interface>
        </management-interfaces>
    </management>
    <profile>
        <subsystem xmlns="urn:jboss:domain:logging:1.2">
            <console-handler name="CONSOLE">
                <level name="INFO"/>
                <formatter>
                    <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                </formatter>
            </console-handler>
            <periodic-rotating-file-handler name="FILE" autoflush="true">
                <formatter>
                    <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                </formatter>
                <file relative-to="jboss.server.log.dir" path="server.log"/>
                <suffix value=".yyyy-MM-dd"/>
                <append value="true"/>
            </periodic-rotating-file-handler>
            <logger category="com.arjuna">
                <level name="WARN"/>
            </logger>
            <logger category="org.apache.tomcat.util.modeler">
                <level name="WARN"/>
            </logger>
            <logger category="org.jboss.as.config">
                <level name="DEBUG"/>
            </logger>
            <logger category="sun.rmi">
                <level name="WARN"/>
            </logger>
            <logger category="jacorb">
                <level name="WARN"/>
            </logger>
            <logger category="jacorb.config">
                <level name="ERROR"/>
            </logger>
            <root-logger>
                <level name="INFO"/>
                <handlers>
                    <handler name="CONSOLE"/>
                    <handler name="FILE"/>
                </handlers>
            </root-logger>
        </subsystem>
        <subsystem xmlns="urn:infinispan:server:endpoint:6.0">
            <hotrod-connector socket-binding="hotrod" cache-container="clustered">
                <topology-state-transfer lazy-retrieval="false" lock-timeout="1000" replication-timeout="5000"/>
            </hotrod-connector>
            <memcached-connector socket-binding="memcached" cache-container="clustered"/>
            <!--<rest-connector virtual-server="default-host" cache-container="clustered" security-domain="other" auth-method="BASIC"/> -->
            <rest-connector virtual-server="default-host" cache-container="clustered" />
            <websocket-connector socket-binding="websocket" cache-container="clustered"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:datasources:1.1">
            <datasources/>
        </subsystem>
        <subsystem xmlns="urn:infinispan:server:core:5.3" default-cache-container="clustered">
            <cache-container name="clustered" default-cache="default">
                <transport executor="infinispan-transport" lock-timeout="60000"/>
                <distributed-cache name="default" mode="SYNC" segments="20" owners="2" remote-timeout="30000" start="EAGER">
                    <locking isolation="READ_COMMITTED" acquire-timeout="30000" concurrency-level="1000" striping="false"/>
                    <transaction mode="NONE"/>
                </distributed-cache>
                <distributed-cache name="memcachedCache" mode="SYNC" segments="20" owners="2" remote-timeout="30000" start="EAGER">
                    <locking isolation="READ_COMMITTED" acquire-timeout="30000" concurrency-level="1000" striping="false"/>
                    <transaction mode="NONE"/>
                </distributed-cache>
                <distributed-cache name="namedCache" mode="SYNC" start="EAGER"/>
            </cache-container>
            <cache-container name="security"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:jca:1.1">
            <archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/>
            <bean-validation enabled="true"/>
            <default-workmanager>
                <short-running-threads>
                    <core-threads count="50"/>
                    <queue-length count="50"/>
                    <max-threads count="50"/>
                    <keepalive-time time="10" unit="seconds"/>
                </short-running-threads>
                <long-running-threads>
                    <core-threads count="50"/>
                    <queue-length count="50"/>
                    <max-threads count="50"/>
                    <keepalive-time time="10" unit="seconds"/>
                </long-running-threads>
            </default-workmanager>
            <cached-connection-manager/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:jdr:1.0"/>
        <subsystem xmlns="urn:jboss:domain:jgroups:1.2" default-stack="${jboss.default.jgroups.stack:udp}">
            <stack name="udp">
                <transport type="UDP" socket-binding="jgroups-udp"/>
                <protocol type="PING"/>
                <protocol type="MERGE2"/>
                <protocol type="FD_SOCK" socket-binding="jgroups-udp-fd"/>
                <protocol type="FD_ALL"/>
                <protocol type="pbcast.NAKACK"/>
                <protocol type="UNICAST2"/>
                <protocol type="pbcast.STABLE"/>
                <protocol type="pbcast.GMS"/>
                <protocol type="UFC"/>
                <protocol type="MFC"/>
                <protocol type="FRAG2"/>
                <protocol type="RSVP"/>
            </stack>
            <stack name="tcp">
                <transport type="TCP" socket-binding="jgroups-tcp"/>
                <!--<protocol type="MPING" socket-binding="jgroups-mping"/>-->
                <protocol type="TCPPING">
                    <property name="initial_hosts">10.32.50.53[7600],10.32.50.64[7600]</property>
                </protocol>
                <protocol type="MERGE2"/>
                <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>
                <protocol type="FD"/>
                <protocol type="VERIFY_SUSPECT"/>
                <protocol type="pbcast.NAKACK">
                    <property name="use_mcast_xmit">false</property>
                </protocol>
                <protocol type="UNICAST2"/>
                <protocol type="pbcast.STABLE"/>
                <protocol type="pbcast.GMS"/>
                <protocol type="UFC"/>
                <protocol type="MFC"/>
                <protocol type="FRAG2"/>
                <protocol type="RSVP"/>
            </stack>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:jmx:1.1">
            <show-model value="true"/>
            <remoting-connector use-management-endpoint="false"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:modcluster:1.1">
            <mod-cluster-config advertise-socket="modcluster" connector="ajp" excluded-contexts="console">
                <dynamic-load-provider>
                    <load-metric type="busyness"/>
                </dynamic-load-provider>
            </mod-cluster-config>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:naming:1.2"/>
        <subsystem xmlns="urn:jboss:domain:remoting:1.1">
            <connector name="remoting-connector" socket-binding="remoting" security-realm="ApplicationRealm"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:security:1.2">
            <security-domains>
                <security-domain name="other" cache-type="infinispan">
                    <authentication>
                        <login-module code="Remoting" flag="optional">
                            <module-option name="password-stacking" value="useFirstPass"/>
                        </login-module>
                        <login-module code="RealmUsersRoles" flag="required">
                            <module-option name="usersProperties" value="${jboss.server.config.dir}/application-users.properties"/>
                            <module-option name="rolesProperties" value="${jboss.server.config.dir}/application-roles.properties"/>
                            <module-option name="realm" value="ApplicationRealm"/>
                            <module-option name="password-stacking" value="useFirstPass"/>
                        </login-module>
                    </authentication>
                </security-domain>
                <security-domain name="jboss-web-policy" cache-type="infinispan">
                    <authorization>
                        <policy-module code="Delegating" flag="required"/>
                    </authorization>
                </security-domain>
            </security-domains>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:threads:1.1">
            <thread-factory name="infinispan-factory" group-name="infinispan" priority="5"/>
            <unbounded-queue-thread-pool name="infinispan-transport">
                <max-threads count="25"/>
                <keepalive-time time="0" unit="milliseconds"/>
                <thread-factory name="infinispan-factory"/>
            </unbounded-queue-thread-pool>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:transactions:1.2">
            <core-environment>
                <process-id>
                    <uuid/>
                </process-id>
            </core-environment>
            <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
            <coordinator-environment default-timeout="300"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
            <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>
            <virtual-server name="default-host" enable-welcome-root="false">
                <alias name="localhost"/>
                <alias name="example.com"/>
            </virtual-server>
        </subsystem>
    </profile>
    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:10.32.222.111}"/>
        </interface>
        <interface name="public">
            <inet-address value="${jboss.bind.address:10.32.222.111}"/>
        </interface>
    </interfaces>
    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
        <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
        <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
        <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>
        <socket-binding name="ajp" port="8089"/>
        <socket-binding name="hotrod" port="11222"/>
        <socket-binding name="http" port="8080"/>
        <socket-binding name="https" port="8443"/>
        <socket-binding name="jgroups-mping" port="0" multicast-address="${jboss.default.multicast.address:234.99.54.14}" multicast-port="45700"/>
        <socket-binding name="jgroups-tcp" port="7600"/>
        <socket-binding name="jgroups-tcp-fd" port="57600"/>
        <socket-binding name="jgroups-udp" port="55200" multicast-address="${jboss.default.multicast.address:234.99.54.14}" multicast-port="45688"/>
        <socket-binding name="jgroups-udp-fd" port="54200"/>
        <socket-binding name="memcached" port="11211"/>
        <socket-binding name="modcluster" port="0" multicast-address="224.0.1.115" multicast-port="23364"/>
        <socket-binding name="remoting" port="4447"/>
        <socket-binding name="txn-recovery-environment" port="4712"/>
        <socket-binding name="txn-status-manager" port="4713"/>
        <socket-binding name="websocket" port="8181"/>
    </socket-binding-group>
</server>

远程进程:service:jmx:remoting-jmx://10.32.222.111:4447

我将用户添加到管理和应用程序领域

管理员=2a0923285184943425d1f53ddd58ec7a

测试=2b1be81e1da41d4ea647bd82fc8c2bc9

但是当我尝试连接它时说:连接失败:重试

当我在服务器上使用远程进程 as:10.32.222.111:4447 时,它会提示警告:

16:29:48,084 错误 [org.jboss.remoting.remote.connection](远程处理“djd7w4r1”读取 1)JBREM000200:远程连接失败:java.io.IOException:收到的无效消息长度为 -2140864253

还禁用了远程身份验证:-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=12345

仍然无法连接。

任何帮助将不胜感激。谢谢

类路径:

    C:\Developer\JDK\Java\jdk1.6.0_34\lib\jconsole.jar;C:\Developer\JDK\Java\jdk1.6.0_34\lib\tools.jar;C:\Users\<user>\Downloads\infinispan-server-6.0.0.CR1-bin\infini
span-server-6.0.0.CR1\jboss-modules.jar;C:\Users\<user>\Downloads\infinispan-server-6.0.0.CR1-bin\infinispan-server-6.0.0.CR1\modules\system\layers\base\org\jboss\
remoting-jmx\main\remoting-jmx-1.1.0.Final.jar;C:\Users\<user>\Downloads\infinispan-server-6.0.0.CR1-bin\infinispan-server-6.0.0.CR1\modules\system\layers\base\org
\jboss\staxmapper\main\staxmapper-1.1.0.Final.jar;C:\Users\<user>\Downloads\infinispan-server-6.0.0.CR1-bin\infinispan-server-6.0.0.CR1\modules\system\layers\base\
org\jboss\as\protocol\main\jboss-as-protocol-7.2.0.Final.jar;C:\Users\<user>\Downloads\infinispan-server-6.0.0.CR1-bin\infinispan-server-6.0.0.CR1\modules\system\l
ayers\base\org\jboss\dmr\main\jboss-dmr-1.1.6.Final.jar;C:\Users\<user>\Downloads\infinispan-server-6.0.0.CR1-bin\infinispan-server-6.0.0.CR1\modules\system\layers
\base\org\jboss\as\controller-client\main\jboss-as-controller-client-7.2.0.Final.jar;C:\Users\<user>\Downloads\infinispan-server-6.0.0.CR1-bin\infinispan-server-6.
0.0.CR1\modules\system\layers\base\org\jboss\threads\main\jboss-threads-2.1.0.Final.jar
4

1 回答 1

0

你错过了 jconsole 的类路径上的一些 jars。要么直接使用 jconsole.sh(来自 bin/ 目录),要么从这个脚本中找出你需要的东西并直接使用类路径。

于 2013-11-04T18:14:49.897 回答