Support Questions
Find answers, ask questions, and share your expertise

Does NiFi ConsumeJMS Processor supports OpenJMS?

New Contributor

Hi All,

I am trying to read messages from openjms-0.7.7 using the ConsumeJMS Processor but getting following exception:

2016-11-01 14:28:19,540 ERROR [Timer-Driven Process Thread-9] o.apache.nifi.jms.processors.ConsumeJMS ConsumeJMS - JMSConsumer[destination:queue1; pub-sub:false;] ConsumeJMS - JMSConsumer[destination:queue1; pub-sub:false;] failed to process session due to org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Failed to create proxy: java.lang.NullPointerException: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Failed to create proxy: java.lang.NullPointerException 2016-11-01 14:28:19,543 ERROR [Timer-Driven Process Thread-9] o.apache.nifi.jms.processors.ConsumeJMS org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Failed to create proxy: java.lang.NullPointerException at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316) ~[na:na] at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169) ~[na:na] at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:497) ~[na:na] at org.springframework.jms.core.JmsTemplate.receiveSelected(JmsTemplate.java:764) ~[na:na] at org.springframework.jms.core.JmsTemplate.receive(JmsTemplate.java:738) ~[na:na] at org.springframework.jms.core.JmsTemplate.receive(JmsTemplate.java:727) ~[na:na] at org.apache.nifi.jms.processors.JMSConsumer.consume(JMSConsumer.java:65) ~[na:na] at org.apache.nifi.jms.processors.ConsumeJMS.rendezvousWithJms(ConsumeJMS.java:79) ~[na:na] at org.apache.nifi.jms.processors.AbstractJMSProcessor.onTrigger(AbstractJMSProcessor.java:136) ~[na:na] at org.apache.nifi.jms.processors.ConsumeJMS.onTrigger(ConsumeJMS.java:50) ~[na:na] at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) ~[nifi-api-1.0.0.jar:1.0.0] at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1064) ~[nifi-framework-core-1.0.0.jar:1.0.0] at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:136) [nifi-framework-core-1.0.0.jar:1.0.0] at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47) [nifi-framework-core-1.0.0.jar:1.0.0] at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132) [nifi-framework-core-1.0.0.jar:1.0.0] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_45] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_45] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_45] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45] Caused by: javax.jms.JMSException: Failed to create proxy: java.lang.NullPointerException at org.exolab.jms.client.JmsConnectionFactory.getProxy(JmsConnectionFactory.java:169) ~[na:na] at org.exolab.jms.client.JmsConnection.<init>(JmsConnection.java:174) ~[na:na] at org.exolab.jms.client.JmsConnectionFactory.createConnection(JmsConnectionFactory.java:284) ~[na:na] at org.exolab.jms.client.JmsConnectionFactory.createConnection(JmsConnectionFactory.java:266) ~[na:na] at org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter.doCreateConnection(UserCredentialsConnectionFactoryAdapter.java:181) ~[na:na] at org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter.createConnection(UserCredentialsConnectionFactoryAdapter.java:152) ~[na:na] at org.springframework.jms.connection.SingleConnectionFactory.doCreateConnection(SingleConnectionFactory.java:365) ~[na:na] at org.springframework.jms.connection.SingleConnectionFactory.initConnection(SingleConnectionFactory.java:305) ~[na:na] at org.springframework.jms.connection.SingleConnectionFactory.getConnection(SingleConnectionFactory.java:283) ~[na:na] at org.springframework.jms.connection.SingleConnectionFactory.createConnection(SingleConnectionFactory.java:224) ~[na:na] at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180) ~[na:na] at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:484) ~[na:na] ... 19 common frames omitted

9027-consumejms.png

I have configured the JMSConnectionFactoryProvider with the following properties:

MQ ConnectionFactory Implementationorg.exolab.jms.client.JmsConnectionFactoryActual
MQ Client Libraries path (i.e., /usr/jms/lib)/user/nirmal/OpenJMS/openjms-0.7.7/libThe lib directory for OpenJMS

I also tried org.exolab.jms.client.JmsXAConnectionFactory in the above #1 property but again the same exception logs.

Not sure if somebody tested the ConsumeJMS / PublishJMS processors with OpenJMS?

Thanks,

-Nirmal

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Does NiFi ConsumeJMS Processor supports OpenJMS?

Nirmal

Just to close the loop here in HCC, i'll summarize from the Apache NiFi mailng-list response I've posted a few minutes ago

The NPE is due to the fact that we are invoking a default constructor for whatever connection factory class is provided (i.e., ‘org.exolab.jms.client.JmsConnectionFactory’). And that works for most major JMS providers (ActiveMQ, IBM, Tibco, Weblogic etc.). However for OpenJMS after looking at the code it is rather clear that the default constructor was not exposed to be actually used by the developers, rather internal serialization use.

/**

* Default constructor required for serialization

*/

public JmsConnectionFactory() {

}

Not sure why it was done this way . . ., but the NPE is due to the fact that the server proxy class is null so when it attempts to do Class.forName(proxyClassName) in getProxy() method it fails with NPE.

One other thing I noticed is that all OpenJMS examples are based on obtaining ConnectionFactory from JNDI for which we currently do not have support.

Please raise the JIRA if you believe that it’s important to add such feature.

Cheers

Oleg

View solution in original post

1 REPLY 1

Re: Does NiFi ConsumeJMS Processor supports OpenJMS?

Nirmal

Just to close the loop here in HCC, i'll summarize from the Apache NiFi mailng-list response I've posted a few minutes ago

The NPE is due to the fact that we are invoking a default constructor for whatever connection factory class is provided (i.e., ‘org.exolab.jms.client.JmsConnectionFactory’). And that works for most major JMS providers (ActiveMQ, IBM, Tibco, Weblogic etc.). However for OpenJMS after looking at the code it is rather clear that the default constructor was not exposed to be actually used by the developers, rather internal serialization use.

/**

* Default constructor required for serialization

*/

public JmsConnectionFactory() {

}

Not sure why it was done this way . . ., but the NPE is due to the fact that the server proxy class is null so when it attempts to do Class.forName(proxyClassName) in getProxy() method it fails with NPE.

One other thing I noticed is that all OpenJMS examples are based on obtaining ConnectionFactory from JNDI for which we currently do not have support.

Please raise the JIRA if you believe that it’s important to add such feature.

Cheers

Oleg

View solution in original post