jmx-【防火墙已关闭】帮看下JMX本地Main方法连接取Broker报错

问题描述

【防火墙已关闭】帮看下JMX本地Main方法连接取Broker报错

**帮我看下JMX本地Main方法连接取Broker报错

(No broker is found at any of the 1 configured urls)**

JConsole通过jmxrmi连接
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi本地正常

activemq.xml配置

 <!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<!-- START SNIPPET: example -->
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

    <!-- Allows us to use system properties as variables in this configuration file -->
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>file:${activemq.conf}/credentials.properties</value>
        </property>
    </bean>

   <!-- Allows accessing the server log -->
    <bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
          lazy-init="false" scope="singleton"
          init-method="start" destroy-method="stop">
    </bean>

    <!--
        The <broker> element is used to configure the ActiveMQ broker.
    -->
    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="wwwwww" dataDirectory="${activemq.data}" useJmx="true">

        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" >
                    <!-- The constantPendingMessageLimitStrategy is used to prevent
                         slow topic consumers to block producers and affect other consumers
                         by limiting the number of messages that are retained
                         For more information, see:

                         http://activemq.apache.org/slow-consumer-handling.html

                    -->
                  <pendingMessageLimitStrategy>
                    <constantPendingMessageLimitStrategy limit="1000"/>
                  </pendingMessageLimitStrategy>
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy>

        <!--
            The managementContext is used to configure how ActiveMQ is exposed in
            JMX. By default, ActiveMQ uses the MBean server that is started by
            the JVM. For more information, see:

            http://activemq.apache.org/jmx.html
        -->
        <managementContext>
            <managementContext createConnector="true"/>
        </managementContext>

        <!--
            Configure message persistence for the broker. The default persistence
            mechanism is the KahaDB store (identified by the kahaDB tag).
            For more information, see:

            http://activemq.apache.org/persistence.html
            <kahaDB directory="${activemq.data}/kahadb"/>
        -->
        <persistenceAdapter>
            <kahaDB directory="${activemq.data}/kahadb"/>
            <!--<jdbcPersistenceAdapter dataDirectory="${activemq.data}" dataSource="#derby-ds"/>
            <jdbcPersistenceAdapter dataSource="#mysql-ds" createTablesOnStartup="true" />-->
        </persistenceAdapter>

          <!--
            The systemUsage controls the maximum amount of space the broker will
            use before disabling caching and/or slowing down producers. For more information, see:
            http://activemq.apache.org/producer-flow-control.html
          -->
          <systemUsage>
            <systemUsage>
                <memoryUsage>
                    <memoryUsage percentOfJvmHeap="70" />
                </memoryUsage>
                <storeUsage>
                    <storeUsage limit="100 gb"/>
                </storeUsage>
                <tempUsage>
                    <tempUsage limit="50 gb"/>
                </tempUsage>
            </systemUsage>
        </systemUsage>

        <!--
            The transport connectors expose ActiveMQ over a given protocol to
            clients and other brokers. For more information, see:

            http://activemq.apache.org/configuring-transports.html
        -->
        <transportConnectors>
            <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
            <transportConnector name="openwire" uri="tcp://127.0.0.1:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
        </transportConnectors>

        <!-- destroy the spring context on shutdown to stop jetty -->
        <shutdownHooks>
            <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
        </shutdownHooks>

        <plugins>
        <simpleAuthenticationPlugin>
            <users>
                <authenticationUser username="user" password="user123" groups="users" />
            </users>
        </simpleAuthenticationPlugin>
    </plugins>

    </broker>

     <!--<bean id="derby-ds" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
        <property name="url" value="jdbc:mysql://10.0.10.66/activemq?relaxAutoCommit=true"/>
        <property name="username" value="root"/>
        <property name="password" value="123456"/>
        <property name="maxTotal" value="200"/>
        <property name="poolPreparedStatements" value="true"/>
     </bean>

        Enable web consoles, REST and Ajax APIs and demos
        The web consoles requires by default login, you can disable this in the jetty.xml file

        Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
    -->
    <import resource="jetty.xml"/>

</beans>
<!-- END SNIPPET: example -->

main方法报错 -----No broker is found at any of the 1 configured urls

 String ip = "127.0.0.1";
            RemoteJMXBrokerFacade createConnector = new RemoteJMXBrokerFacade();
            System.out.println("service:jmx:rmi:///jndi/rmi://"+ip+":1099/jmxrmi");
            System.setProperty("webconsole.jmx.url", "service:jmx:rmi:///jndi/rmi://"+ip+":1099/jmxrmi");
            System.setProperty("webconsole.jmx.user","admin");
            System.setProperty("webconsole.jmx.password","activemq");
            SystemPropertiesConfiguration configuration = new SystemPropertiesConfiguration();
            createConnector.setConfiguration(configuration);
            System.out.println(configuration);
            System.out.println(ip+"执行开始-------"+configuration.getJmxUser());
            try {
                BrokerViewMBean brokerAdmin = createConnector.getBrokerAdmin();
                String brokerName =brokerAdmin.getBrokerName();
                System.out.println("BrokerName ="+brokerName );
                long messages =brokerAdmin.getTotalMessageCount();
                System.out.println("messages ="+messages );
                long consumerCount=brokerAdmin.getTotalConsumerCount();
                System.out.println("consumerCount ="+consumerCount );
                long dequeueCount=brokerAdmin.getTotalDequeueCount();
                System.out.println("dequeueCount ="+dequeueCount );
                long enqueueCount=brokerAdmin.getTotalEnqueueCount();
                System.out.println("enqueueCount ="+enqueueCount );

                System.out.println(brokerAdmin.getBrokerName());
                //获取Topic相关的ObjectName
                ObjectName[] topicList=brokerAdmin.getTopics();
                System.out.println("topic ="+topicList.length);
                //获取Queue相关的ObjectName
                ObjectName[] queueList=brokerAdmin.getQueues();
                System.out.println("queue ="+queueList.length);
                //根据ObjectName创建相关的JMX对象获取相关的信息。
            } catch (Exception e) {
                e.printStackTrace();
            }
            System.out.println(ip+"执行结束-------");
    }

Console 信息

 service:jmx:rmi:///jndi/rmi://127.0.0.1:1099/jmxrmi
org.apache.activemq.web.config.SystemPropertiesConfiguration@4fccd51b
127.0.0.1执行开始-------admin
15:34:03.993 [main] DEBUG o.a.a.web.RemoteJMXBrokerFacade - Creating a new JMX-Connection to the broker
15:34:04.017 [main] DEBUG org.eclipse.jetty.util.log - Logging to Logger[org.eclipse.jetty.util.log] via org.eclipse.jetty.util.log.Slf4jLog
15:34:04.022 [main] INFO  org.eclipse.jetty.util.log - Logging initialized @283ms
15:34:04.023 [main] DEBUG jndi - InitialContextFactory.getInitialContext()
15:34:04.027 [main] DEBUG jndi - supportDeepBinding=false
15:34:04.027 [main] DEBUG jndi - Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@233c0b17
java.lang.IllegalStateException: No broker is found at any of the 1 configured urls
    at org.apache.activemq.web.RemoteJMXBrokerFacade.createConnection(RemoteJMXBrokerFacade.java:168)
    at org.apache.activemq.web.RemoteJMXBrokerFacade.getMBeanServerConnection(RemoteJMXBrokerFacade.java:114)
    at org.apache.activemq.web.RemoteJMXBrokerFacade.getBrokerAdmin(RemoteJMXBrokerFacade.java:88)
    at com.generateid.ActiveMQJMX.main(ActiveMQJMX.java:45)
127.0.0.1执行结束-------

解决方案

  1. ActiveMQ没有启动或启动失败
  2. ActiveMQ的连接方式错误!
  3. 连接的地址错误
时间: 2024-12-22 01:11:22

jmx-【防火墙已关闭】帮看下JMX本地Main方法连接取Broker报错的相关文章

c#利用upnp做端口映射成功了,但始终没法连接,哪位高手帮看下代码?

问题描述 c#利用upnp做端口映射成功了,但始终没法连接,哪位高手帮看下代码?这个是网上的代码,如下:目前有2个问题:1.mappings这个值经常为null,我windows7防火墙已经关闭,路由器upnp也开启了.但有时莫名其妙mappings不为null,于是就把映射信息添加到路由器了.如图2.当添加端口映射成功后,始终无法通信,如图:哪位高手指点一下,谢谢!!!!!!相关代码如下:usingSystem;usingSystem.Collections.Generic;usingSyst

服务器-azure新手,碰到个初级问题,请各位大侠帮看下

问题描述 azure新手,碰到个初级问题,请各位大侠帮看下 刚刚弄个1元钱的测试账户,在家看看 创建了个虚拟网络,存储账户等等. 也理解了下虚拟网络的用户,基本上就是VPN把local的服务器和放微软家的服务器连起来呗,想象成一个IDC内. 现在在家玩,也没什么vpn不vpn的,反正弄了2个虚拟机. 配置虚拟机的时候没地方选网络的嘛!我要是想给虚拟机增加块网卡怎么弄啊,我看配置修改也只能改CPU和RAM好像? 2.我把一台虚拟机的IP改了,能不能远程了.我看VM的仪表盘里,用来远程的不是应该是公

servlet-大神帮看下这段代码我想把文件上传到webroot下的upload文件夹该怎么改啊

问题描述 大神帮看下这段代码我想把文件上传到webroot下的upload文件夹该怎么改啊 package com.chamber.controller.upload; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Iterator;

java-大神帮看下我的代码哪里错了?

问题描述 大神帮看下我的代码哪里错了? 题目是编写程序,读入未指定个数的整数,判断读入的正数和负数分别有多少个,然后计算这些输入值的总和及其平均值(不对0计数).当输入为0时,表明程序结束.将平均值以浮点数显示. import java.util.Scanner; public class TextXXXXX { public static void main (String[] args){ Scanner input = new Scanner(System.in); int count1

代码分析-JAVA 求大神帮看下这段代码 怎么修改 救命啊

问题描述 JAVA 求大神帮看下这段代码 怎么修改 救命啊 真心看不懂 public static char[] a(char[] paramArrayOfChar) { char[] arrayOfChar1 = new char[12]; char[] arrayOfChar2 = new char[12]; arrayOfChar2[0] = '?'; arrayOfChar2[1] = '?'; arrayOfChar2[2] = 'o'; arrayOfChar2[3] = '/';

c-有没有大神帮看下鄙人写的高斯完全主元素消元法代码哪里出了问题,真心感谢啊!

问题描述 有没有大神帮看下鄙人写的高斯完全主元素消元法代码哪里出了问题,真心感谢啊! /*矩阵A用于存放线性方程组的增广矩阵,向量X表示线性方程组的解 #include #include int main() { double m,p,A[10][10],X[10]; int n,i,j,k,q,l,c,w; char a; printf("请输入方程的阶数(小于等于8):n"); scanf("%d",&n); for(i=1;i<=n;i++)//

java 调用cmd 执行读取sql文件问题?求大神帮看下

问题描述 java 调用cmd 执行读取sql文件问题?求大神帮看下 Runtime run =Runtime.getRuntime(); Process process = run.exec("cmd /cmysql -u root -pssdlh test <d:/test.sql"); InputStreamReader ir = new InputStreamReader(process .getInputStream()); LineNumberReader input

struts2 3 15-Struts2.2升级到2.3.15 启动时出错,能帮看下是什么原因不

问题描述 Struts2.2升级到2.3.15 启动时出错,能帮看下是什么原因不 [ERROR]: [2013-12-02 20:30:41] com.opensymphony.xwork2.util.logging.commons.CommonsLogger.error(CommonsLogger.java:38): Dispatcher initialization failed Unable to load configuration. - Class: java.net.PlainSoc

IT大神们帮看下什么情况

问题描述 IT大神们帮看下什么情况 SELECT SUM(recivedPrincipal) AS 'leiji_invest_sum',COUNT(id) AS 'leiji_count',MAX(repayDate) AS 'lately_gathering_date',a.*,c.* FROM t_invest v LEFT JOIN (SELECT investor AS 'inv',SUM(recivedPrincipal+recivedPrincipal) AS 'yishou_su