-1

I am trying to connect to Solace Queues on a VPN different then default using Appache NIFI ConsumeJMS Processor. When I try to enable the JMSConnectionFactoryProvider I get the following error:

JMSConnectionFactoryProvider Failed to invoke @OnEnabled method due to java.lang.IllegalStateException: java.lang.IllegalStateException: Failed to load and/or instantiate class 'com.solacesystems.jms.SolConnectionFactory'

The NIFI JMSConnectionFactoryProvider provides a generic service to create vendor specific javax.jms.ConnectionFactory implementations. ConnectionFactory can be served once this service is configured successfully.

Why is NIFI Unable to find the class within the Solace JMS API Jar files?

Russell Sim
  • 1,693
  • 2
  • 14
  • 22
ARM
  • 23
  • 4
  • There's not enough information in that single line to determine why Apache-NiFi cannot load Solace's JMS ConnectionFactory. Possible errors can range from the class not being found in your classpath, to an configuration error. The best way to determine the root cause is to enable Solace API logs, and provide more details. Details on how to enable the Solace API logs can be found over at http://docs.solace.com/Solace-JMS-API/Code-and-Compile-Guideli.htm – Russell Sim Feb 27 '17 at 01:01
  • Looking deeper into the NiFi Logs I see this: Caused by: java.lang.NoSuchMethodException: com.solacesystems.jms.SolConnectionFactory.() at java.lang.Class.getConstructor0(Class.java:3082) ~[na:1.8.0_121] at java.lang.Class.newInstance(Class.java:412) ~[na:1.8.0_121] ... 18 common frames omitted – ARM Mar 02 '17 at 06:51
  • There is no `com.solacesystems.jms.SolConnectionFactory.` method. Do you know how is the Solace JMS connection factory being created? – Russell Sim Mar 06 '17 at 06:47
  • Here is what I can find: https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProvider.java – ARM Mar 07 '17 at 12:07

2 Answers2

1

----- Update --------

Solace JMS API 10.1.0 now contains an zero argument default constructor, and integration with NiFi is now possible.

Here is an example configuration:

  1. Controller: Controller Configuration]

The MQ ConnectionFactory Implementation is set to com.solacesystems.jms.SolConnectionFactoryImpl.

  1. ConsumeJMS Processor: ConsumeJMS Processor

Username field can also take the form of "myUsername@myMessageVPN".

----- Original -------

The problem here is that Apache NiFi is not using a portable method of creating a ConnectionFactory. It is trying to create a ConnectionFactory by calling an zero argument default constructor, but there's no guarantee that one exists.

// From https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProvider.java
private void createConnectionFactoryInstance(ConfigurationContext context) {
    String connectionFactoryImplName = context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue();
    this.connectionFactory = Utils.newDefaultInstance(connectionFactoryImplName);
}

Note that there's an entry over at NiFi's JIRA https://issues.apache.org/jira/browse/NIFI-2701 to "Add JNDI Factory support for JMS ConnectionFactory service". (The initial description of that entry is a bit confusing, but the comments are clearer.)

At this point, Solace only supports the creation of the ConnectionFactory through the standard JNDI lookup - javax.naming.InitialContext.lookup() and through Solace's proprietary method - SolJmsUtility.createConnectionFactory().

Solace will investigate whether it is feasible to implement a zero argument default constructor for the ConnectionFactory.

Russell Sim
  • 1,693
  • 2
  • 14
  • 22
0

A JNDI connection provider is developed and published at http://dev.solace.com/integration-guides/nifi/. For people that are interested in this provider, it is worthwhile finding out.

wayne s
  • 11
  • 2
  • This is wonderful. Thank you, I had created the same thing but realized that the NIFI JMS Consumer is not a listener which fails to meet the requirements for us. I need to develop an entire new processor to provide a JMS Listener. – ARM Jul 03 '17 at 19:05