简体   繁体   中英

Exception connecting WSO2 CEP to WSO2 Message Broker

I am trying to connect a WSO2 CEP server to a WSO2 Message Broker server.

I have created a jndi.properties file:

connectionfactory.TopicConnectionFactory = amqp://admin:admin@clientid/carbon?brokerlist='tcp://192.168.11.2:5673'
topic.testTopic = testTopic

an input event adaptor:

<?xml version="1.0" encoding="UTF-8"?>
<inputEventAdaptor name="MBJMSInputAdaptor" statistics="enable"
  trace="enable" type="jms" xmlns="http://wso2.org/carbon/eventadaptormanager">
  <property name="java.naming.provider.url">repository/conf/jndi.properties</property>
  <property name="transport.jms.SubscriptionDurable">false</property>
  <property name="java.naming.factory.initial">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</property>
  <property name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</property>
  <property name="transport.jms.DestinationType">topic</property>
</inputEventAdaptor>

a stream definition:

<streamDefinitions xmlns="http://wso2.org/carbon/databridge">
  <streamDefinition>
    {
      "name":"testStream",
      "version":"1.0.0",
      "payloadData":[
        {"name":"id","type":"INT"},
        {"name":"name","type":"STRING"}
      ]
    }
  </streamDefinition>
</streamDefinitions>

and an event builder:

<?xml version="1.0" encoding="UTF-8"?>
<eventBuilder name="testBuilder" statistics="enable" trace="enable" xmlns="http://wso2.org/carbon/eventbuilder">
  <from eventAdaptorName="MBJMSInputAdaptor" eventAdaptorType="jms">
    <property name="topic">testTopic</property>
  </from>
  <mapping customMapping="enable" type="json">
    <property>
      <from jsonPath="id"/>
      <to name="id" type="int"/>
    </property>
    <property>
      <from jsonPath="name"/>
      <to name="name" type="string"/>
    </property>
  </mapping>
  <to streamName="testStream" version="1.0.0"/>
</eventBuilder>

Unfortunately, the WSO2 CEP server does not receive messages from the WSO2 Message Broker server, and throws the following exception:

[2014-11-28 13:00:00,226] INFO - {JMSEventAdaptorType} JMS input event adaptor loading listeners
Exception in thread "Thread-29" java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:333)
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:988)
at org.wso2.carbon.event.input.adaptor.jms.JMSEventAdaptorType.createJMSAdaptorListener(JMSEventAdaptorType.java:291)
at org.wso2.carbon.event.input.adaptor.jms.JMSEventAdaptorType.tryStartAdaptor(JMSEventAdaptorType.java:262)
at org.wso2.carbon.event.input.adaptor.jms.internal.ds.JMSEventAdaptorServiceHolder.loadLateStartEventAdaptors(JMSEventAdaptorServiceHolder.java:66)
at org.wso2.carbon.event.input.adaptor.jms.internal.ds.JMSEventAdaptorServiceHolder$1.run(JMSEventAdaptorServiceHolder.java:43)
at java.lang.Thread.run(Thread.java:745)

Could you help me debugging this exception?

If you like to debug the code then you can checkout the source from below location [1].. But I think below blog [2] will help you to achieve the usecase.

[1] https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/event-stream/event-input-adaptor/org.wso2.carbon.event.input.adaptor.jms/1.0.1

[2] http://sajithr.blogspot.com/2014/04/sample-on-using-wso2-mb-with-wso2-cep.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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