WSO2 ESB Publisher的AMQAuthenticationException

时间:2013-10-17 11:53:10

标签: jms wso2 wso2esb

我正在尝试将WSO2 ESB(4.7.0)与WSO2 Message Broker(2.1.0)集成。

这是我的用例:

  1. 通用HTTP客户端向PassThrough代理发送REST请求 部署在WSO2 ESB上
  2. ESB代理有一个后果:将请求转发给真实的 然后,在后台,它将响应发送给一个 中介类(部署在WSO2 ESB内)
  3. mediator类制作一些东西,并在里面有这个方法 它可以将事件发布到Message Broker上的主题:
  4. 代码:

    private void publishEvent(){        
        String topicName = "MyEvent";
    
        Properties properties = new Properties();
        TopicConnection topicConnection = null;
    
        properties.put("java.naming.factory.initial", "org.wso2.andes.jndi.PropertiesFileInitialContextFactory");
    
    
        String connectionString = "amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5673'";
    
        properties.put("connectionfactory.QueueConnectionFactory", connectionString);
    
        try {
    
            InitialContext ctx =  new InitialContext(properties);
            TopicConnectionFactory tcf = (TopicConnectionFactory) ctx.lookup("QueueConnectionFactory");
            TopicConnection connection = tcf.createTopicConnection();
            TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
    
            Topic topic = session.createTopic(topicName);
            TopicPublisher publisher= session.createPublisher(topic);
            TextMessage textMessage =
                 session.createTextMessage("<asd>sono il publisher di WSO2 message Broker!</asd>");
    
            publisher.publish(textMessage);
         publisher.close();
    
        }catch (Exception e){
    
            e.printStackTrace();
        }
     }
    
    1. 另一端有“MyEvent”主题的订阅者 已经在运行。
    2. (我从此网址获取了发布商和订阅者的代码:http://wso2.com/library/articles/2011/12/wso2-esb-example-pubsub-soa/

      当客户端将REST请求发送到代理(1)时,调解器被正确调用,但是当它尝试执行PublishEvent方法(3)时,没有任何反应,WSO2 ESB会记录此530错误:

      INFO - ConnectionCloseMethodHandler ConnectionClose frame received
      [2013-10-17 12:43:47,733]  INFO - ConnectionCloseMethodHandler Error :530: not      allowed:Thread-33
      [2013-10-17 12:43:47,734] ERROR - AMQStateManager No Waiters for error saving as last  error:Attempt to redeclare exchange: amq.topic of type topic to null.
      [2013-10-17 12:43:47,735] ERROR - AMQConnection Throwable Received but no listener set: org.wso2.andes.client.AMQAuthenticationException: Attempt to redeclare exchange: amq.topic of type topic to null. [error code 530: not allowed]
      ERROR - AMQStateManager No Waiters for error saving as last error:Attempt to redeclare exchange: amq.topic of type topic to null.
      [2013-10-17 20:53:44,996] ERROR - AMQConnection error:
      org.wso2.andes.client.AMQAuthenticationException: Attempt to redeclare exchange: amq.topic of type topic to null. [error code 530: not allowed]
      at     org.wso2.andes.client.handler.ConnectionCloseMethodHandler.methodReceived(ConnectionCloseMethodHandler.java:79)
      at     org.wso2.andes.client.handler.ClientMethodDispatcherImpl.dispatchConnectionClose(ClientMethodDispatcherImpl.java:192)
      at     org.wso2.andes.framing.amqp_0_91.ConnectionCloseBodyImpl.execute(ConnectionCloseBodyImpl.java:140)
      at     org.wso2.andes.client.state.AMQStateManager.methodReceived(AMQStateManager.java:111)
      at     org.wso2.andes.client.protocol.AMQProtocolHandler.methodBodyReceived(AMQProtocolHandler.java:515)
      at org.wso2.andes.client.protocol.AMQProtocolSession.methodFrameReceived(AMQProtocolSession.java:456)
      at org.wso2.andes.framing.AMQMethodBodyImpl.handle(AMQMethodBodyImpl.java:96)
      at org.wso2.andes.client.protocol.AMQProtocolHandler$2.run(AMQProtocolHandler.java:466)
      at org.wso2.andes.pool.Job.processAll(Job.java:109)
      at org.wso2.andes.pool.Job.run(Job.java:157)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:724)
      javax.jms.JMSException: Error closing connection:     org.wso2.andes.client.AMQAuthenticationException: Attempt to redeclare exchange: amq.topic of type topic to null. [error code 530: not allowed]
      at org.wso2.andes.client.AMQConnection.doClose(AMQConnection.java:920)
      at org.wso2.andes.client.AMQConnection.close(AMQConnection.java:855)
      at org.wso2.andes.client.AMQConnection.close(AMQConnection.java:846)
      at org.wso2.andes.client.AMQConnection.close(AMQConnection.java:841)
      at innova.esb.mediator.TopicPublisher.publishMessage(TopicPublisher.java:49)
      at     innova.esb.mediator.MediatorEventPublisher.mediate(MediatorEventPublisher.java:35)
      at org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78)
      at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
      at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
      at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:239)
      at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:443)
      at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:166)
      at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
      at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:222)
      at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:724)
      Caused by: org.wso2.andes.client.AMQAuthenticationException: Attempt to redeclare exchange: amq.topic of type topic to null. [error code 530: not allowed]
      at org.wso2.andes.client.handler.ConnectionCloseMethodHandler.methodReceived(ConnectionCloseMethodHandler.java:79)
      at org.wso2.andes.client.handler.ClientMethodDispatcherImpl.dispatchConnectionClose(ClientMethodDispatcherImpl.java:192)
      at org.wso2.andes.framing.amqp_0_91.ConnectionCloseBodyImpl.execute(ConnectionCloseBodyImpl.java:140)
      at org.wso2.andes.client.state.AMQStateManager.methodReceived(AMQStateManager.java:111)
      at org.wso2.andes.client.protocol.AMQProtocolHandler.methodBodyReceived(AMQProtocolHandler.java:515)
      at org.wso2.andes.client.protocol.AMQProtocolSession.methodFrameReceived(AMQProtocolSession.java:456)
      at org.wso2.andes.framing.AMQMethodBodyImpl.handle(AMQMethodBodyImpl.java:96)
      at org.wso2.andes.client.protocol.AMQProtocolHandler$2.run(AMQProtocolHandler.java:466)
      at org.wso2.andes.pool.Job.processAll(Job.java:109)
      at org.wso2.andes.pool.Job.run(Job.java:157)
      

      显然,订阅者没有发现任何事件。

      有什么问题?为什么我有此连接异常?

      非常感谢。

0 个答案:

没有答案