Search code examples
apache-nifisolace

Solace NIFI JMSConnectionFactoryProvider


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?


Solution

  • ----- 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.