Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Nifi ConsumeJMS Problem

Nifi ConsumeJMS Problem

New Contributor

91481-bb.jpg

Hi.

I am new to NIFI. I am trying to connect to an openmq server.

I've configured my server in a fashion that seems to be consistent with the documentation. Specifically I am connecting my connection factory to the following URI: mqtcp://192.168.16.171:30001 (as seen from the nifi-app.log):

2018-09-17 15:34:42,042 INFO [Flow Service Tasks Thread-1] o.a.nifi.controller.StandardFlowService Saved flow controller org.apache.nifi.controller.FlowController@f099b1c // Another save pending = false
2018-09-17 15:34:46,913 INFO [NiFi Web Server-141] o.a.n.c.s.StandardProcessScheduler Enabling JMSConnectionFactoryProvider[id=e8c4c703-0165-1000-06b9-36aec9db3d1f]
2018-09-17 15:34:46,914 INFO [Timer-Driven Process Thread-5] o.a.n.j.cf.JMSConnectionFactoryProvider Configuring JMSConnectionFactoryProvider for 'com.sun.messaging.ConnectionFactory' to be connected to 'mqtcp://192.168.16.171 30001'

Yet, when I configure the ConsumeJMS processor it attempts to connect instead to localhost:7676

2018-09-17 15:34:53,754 ERROR [Timer-Driven Process Thread-8] o.apache.nifi.jms.processors.ConsumeJMS ConsumeJMS[id=e8c3f354-0165-1000-fbd7-f5f3f3a678d0] ConsumeJMS[id=e8c3f354-0165-1000-fbd7-f5f3f3a678d0] failed to process session due to org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is com.sun.messaging.jms.JMSException: [C4003]: Error occurred on connection creation [localhost:7676]. - cause: java.net.ConnectException: Connection refused (Connection refused); Processor Administratively Yielded for 1 sec: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is com.sun.messaging.jms.JMSException: [C4003]: Error occurred on connection creation [localhost:7676]. - cause: java.net.ConnectException: Connection refused (Connection refused)


I've tried many variants on the Broker URI with and without mqtcp, with and without tcp (as seen in attached). So despite the fact that I've configured the URI to a remote ip address and port 30001 nifi insists on connecting to localhost and 7676.. I've reinstalled NIFI, and configured just a single ConsumeJMS processor along with the requisite controller service.. I've tried many things but have not been able to figure out why this is happening.

The callstack at the exception

2018-09-18 10:11:35,458 WARN [Timer-Driven Process Thread-2] o.a.n.controller.tasks.ConnectableTask Administratively Yielding ConsumeJMS[id=e8c3f354-0165-1000-fbd7-f5f3f3a678d0] due to uncaught Exception: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is com.sun.messaging.jms.JMSException: [C4003]: Error occurred on connection creation [localhost:7676]. - cause: java.net.ConnectException: Connection refused (Connection refused)
org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is com.sun.messaging.jms.JMSException: [C4003]: Error occurred on connection creation [localhost:7676]. - cause: java.net.ConnectException: Connection refused (Connection refused)
 at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)
 at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169)
 at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:497)
 at org.apache.nifi.jms.processors.JMSConsumer.consume(JMSConsumer.java:85)
 at org.apache.nifi.jms.processors.ConsumeJMS.rendezvousWithJms(ConsumeJMS.java:182)
 at org.apache.nifi.jms.processors.ConsumeJMS.rendezvousWithJms(ConsumeJMS.java:60)
 at org.apache.nifi.jms.processors.AbstractJMSProcessor.onTrigger(AbstractJMSProcessor.java:158)
 at org.apache.nifi.jms.processors.ConsumeJMS.onTrigger(ConsumeJMS.java:60)
 at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
 at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1165)
 at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:203)
 at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
 at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
 at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
 at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 at java.lang.Thread.run(Thread.java:748)
Caused by: com.sun.messaging.jms.JMSException: [C4003]: Error occurred on connection creation [localhost:7676]. - cause: java.net.ConnectException: Connection refused (Connection refused)
 at com.sun.messaging.jmq.jmsclient.ExceptionHandler.throwConnectionException(ExceptionHandler.java:280)
 at com.sun.messaging.jmq.jmsclient.ExceptionHandler.handleConnectException(ExceptionHandler.java:226)
 at com.sun.messaging.jmq.jmsclient.PortMapperClient.readBrokerPorts(PortMapperClient.java:245)
 at com.sun.messaging.jmq.jmsclient.PortMapperClient.init(PortMapperClient.java:156)
 at com.sun.messaging.jmq.jmsclient.PortMapperClient.<init>(PortMapperClient.java:90)
 at com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPConnectionHandler.<init>(TCPConnectionHandler.java:126)
 at com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler.openConnection(TCPStreamHandler.java:136)
 at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.openConnection(ConnectionInitiator.java:419)
 at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnectionOld(ConnectionInitiator.java:369)
 at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(ConnectionInitiator.java:216)
 at com.sun.messaging.jmq.jmsclient.ConnectionInitiator.createConnection(ConnectionInitiator.java:164)
 at com.sun.messaging.jmq.jmsclient.ProtocolHandler.init(ProtocolHandler.java:843)
 at com.sun.messaging.jmq.jmsclient.ProtocolHandler.<init>(ProtocolHandler.java:1562)
 at com.sun.messaging.jmq.jmsclient.ConnectionImpl.openConnection(ConnectionImpl.java:2413)
 at com.sun.messaging.jmq.jmsclient.ConnectionImpl.init(ConnectionImpl.java:1094)
 at com.sun.messaging.jmq.jmsclient.ConnectionImpl.<init>(ConnectionImpl.java:454)
 at com.sun.messaging.jmq.jmsclient.UnifiedConnectionImpl.<init>(UnifiedConnectionImpl.java:66)
 at com.sun.messaging.BasicConnectionFactory.createConnection(BasicConnectionFactory.java:153)
 at org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter.doCreateConnection(UserCredentialsConnectionFactoryAdapter.java:178)
 at org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter.createConnection(UserCredentialsConnectionFactoryAdapter.java:152)
 at org.springframework.jms.connection.SingleConnectionFactory.doCreateConnection(SingleConnectionFactory.java:365)
 at org.springframework.jms.connection.SingleConnectionFactory.initConnection(SingleConnectionFactory.java:305)
 at org.springframework.jms.connection.SingleConnectionFactory.getConnection(SingleConnectionFactory.java:283)
 at org.springframework.jms.connection.SingleConnectionFactory.createConnection(SingleConnectionFactory.java:224)
 at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180)
 at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:484)
 ... 16 common frames omitted
Caused by: java.net.ConnectException: Connection refused (Connection refused)
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
 at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
 at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
 at java.net.Socket.connect(Socket.java:589)
 at java.net.Socket.connect(Socket.java:538)
 at java.net.Socket.<init>(Socket.java:434)
 at java.net.Socket.<init>(Socket.java:211)
 at com.sun.messaging.jmq.jmsclient.PortMapperClient.makeSocketWithTimeout(PortMapperClient.java:272)
 at com.sun.messaging.jmq.jmsclient.PortMapperClient.readBrokerPorts(PortMapperClient.java:224)
 ... 39 common frames omitted


As a point of reference: https://docs.oracle.com/cd/E19830-01/819-4712/ablkn/index.html

The flow configuration in XML

[dsargrad@guam conf]$ zcat flow.xml.gz 
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flowController encoding-version="1.3">
  <maxTimerDrivenThreadCount>10</maxTimerDrivenThreadCount>
  <maxEventDrivenThreadCount>5</maxEventDrivenThreadCount>
  <registries/>
  <rootGroup>
    <id>e8be3d82-0165-1000-9a8a-1b095ae55a54</id>
    <name>NiFi Flow</name>
    <position x="0.0" y="0.0"/>
    <comment/>
    <processor>
      <id>e8c3f354-0165-1000-fbd7-f5f3f3a678d0</id>
      <name>ConsumeJMS Yo</name>
      <position x="211.38682556152344" y="68.59428405761719"/>
      <styles/>
      <comment/>
      <class>org.apache.nifi.jms.processors.ConsumeJMS</class>
      <bundle>
        <group>org.apache.nifi</group>
        <artifact>nifi-jms-processors-nar</artifact>
        <version>1.7.1</version>
      </bundle>
      <maxConcurrentTasks>1</maxConcurrentTasks>
      <schedulingPeriod>0 sec</schedulingPeriod>
      <penalizationPeriod>30 sec</penalizationPeriod>
      <yieldPeriod>1 sec</yieldPeriod>
      <bulletinLevel>DEBUG</bulletinLevel>
      <lossTolerant>false</lossTolerant>
      <scheduledState>STOPPED</scheduledState>
      <schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
      <executionNode>ALL</executionNode>
      <runDurationNanos>0</runDurationNanos>
      <property>
        <name>Connection Factory Service</name>
        <value>e8c4c703-0165-1000-06b9-36aec9db3d1f</value>
      </property>
      <property>
        <name>Destination Name</name>
        <value>nasdi.ATL</value>
      </property>
      <property>
        <name>Destination Type</name>
        <value>TOPIC</value>
      </property>
      <property>
        <name>User Name</name>
        <value>admin</value>
      </property>
      <property>
        <name>Password</name>
        <value>enc{bdbdf8d1ab1e74b29ec21767915a1baff8d8e7fa2832fda475e50e72de232b42}</value>
      </property>
      <property>
        <name>Connection Client ID</name>
      </property>
      <property>
        <name>Session Cache size</name>
        <value>1</value>
      </property>
      <property>
        <name>character-set</name>
        <value>UTF-8</value>
      </property>
      <property>
        <name>Acknowledgement Mode</name>
        <value>2</value>
      </property>
      <property>
        <name>Durable subscription</name>
        <value>false</value>
      </property>
      <property>
        <name>Shared subscription</name>
        <value>false</value>
      </property>
      <property>
        <name>Subscription Name</name>
      </property>
      <autoTerminatedRelationship>success</autoTerminatedRelationship>
    </processor>
    <controllerService>
      <id>e8c4c703-0165-1000-06b9-36aec9db3d1f</id>
      <name>JMSConnectionFactoryProvider</name>
      <comment/>
      <class>org.apache.nifi.jms.cf.JMSConnectionFactoryProvider</class>
      <bundle>
        <group>org.apache.nifi</group>
        <artifact>nifi-jms-processors-nar</artifact>
        <version>1.7.1</version>
      </bundle>
      <enabled>false</enabled>
      <property>
        <name>cf</name>
        <value>com.sun.messaging.ConnectionFactory</value>
      </property>
      <property>
        <name>cflib</name>
        <value>/home/data/mq</value>
      </property>
      <property>
        <name>broker</name>
        <value>mqtcp://192.168.16.171 30001</value>
      </property>
      <property>
        <name>SSL Context Service</name>
      </property>
    </controllerService>
  </rootGroup>
  <controllerServices/>
  <reportingTasks/>
</flowController>

91485-bbbbb.png

91484-bbbb.png

91483-bbb.png


b.jpg