1

I am trying to configure a Flume (1.6 from Cloudera CDH-5.11.0) agent to use an IBM WebSphere MQ 9.1.1.0 as Source.

As there's no official documentation, I followed these resources (despite they comes from older versions):

I proceeded this way:

  1. Installed MQ 9.1.1.0 client and configured the JMSAdmin.conf

    • INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory PROVIDER_URL=file:/C:/temp/jmsbindings SECURITY_AUTHENTICATION=none
  2. Created the .bindings file:

    • DEF CF(flumeConnectionFactory) QMGR(myQueueManager) HOSTNAME(myHostName) PORT(1414) CHANNEL(myChannelName) TRANSPORT(CLIENT)
  3. Extracted the java client (it is both available as groups of jars from the Windows client or as a single uberjar from IBM Support Portal). I tried both paths, however, right now I extracted these single jars:
    • com.ibm.mq.jar
    • com.ibm.mq.headers.jar
    • com.ibm.mq.jmqi.jar
    • com.ibm.mq.pcf.jar
    • com.ibm.mq.mqjms.jar
    • fcontext.jar
    • jms.jar
    • providerutil.jar
  4. Loaded jars and .bindings file on my flume host
  5. Prepared this source configuration:

test_IBM_MQ.sources.amq_ibm.type = jms test_IBM_MQ.sources.amq_ibm.initialContextFactory = com.sun.jndi.fscontext.RefFSContextFactory test_IBM_MQ.sources.amq_ibm.connectionFactory=flumeConnectionFactory test_IBM_MQ.sources.amq_ibm.providerURL = file:///etc/flume/conf test_IBM_MQ.sources.amq_ibm.destinationName = myDestination test_IBM_MQ.sources.amq_ibm.destinationType = QUEUE

When I finally start my Flume agent, I get this error:

java.lang.ClassCastException: javax.naming.Reference cannot be cast to javax.jms.ConnectionFactory

Followed by this little Stacktrace

Source amq_ibm has been removed due to an error during configuration java.lang.ClassCastException: javax.naming.Reference cannot be cast to javax.jms.ConnectionFactory at org.apache.flume.source.jms.JMSSource.doConfigure(JMSSource.java:231) at org.apache.flume.source.BasicSourceSemantics.configure(BasicSourceSemantics.java:65) at org.apache.flume.source.AbstractPollableSource.configure(AbstractPollableSource.java:65) at org.apache.flume.conf.Configurables.configure(Configurables.java:41) at org.apache.flume.node.AbstractConfigurationProvider.loadSources(AbstractConfigurationProvider.java:326) at org.apache.flume.node.AbstractConfigurationProvider.getConfiguration(AbstractConfigurationProvider.java:101) at org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable.run(PollingPropertiesFileConfigurationProvider.java:141) 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:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

Inspecting the Flume source, the exploding line is the following

connectionFactory = (ConnectionFactory) initialContext.lookup(connectionFactoryName);

I tried to follow this old related question

However, some of the jars the suggest to load do not exist anymore, since the upgrade to jms2.0 from IBM mq v8:

I am starting to suspect that's there is something which Flume 1.6 which doesn't like JMS2.0

Any help? Thanks

1 Answers1

0

I'm not an expert but:

test_IBM_MQ.sources.amq_ibm.connectionFactory=flumeConnectionFactory 

I believe that parameter is expecting a QueueConnectionFactory (QCF).

Delete the "CF" and add a QCF to your MQ JDNI:

DEF QCF(flumeConnectionFactory) QMGR(myQueueManager) HOSTNAME(myHostName) PORT(1414) CHANNEL(myChannelName) TRANSPORT(CLIENT)

Also, is this location where the MQ JNDI (".bindings") file is?

test_IBM_MQ.sources.amq_ibm.providerURL = file:///etc/flume/conf 

Based on your above mentioned "PROVIDER_URL" parameter, I think it should be:

test_IBM_MQ.sources.amq_ibm.providerURL = file:/C:/temp/jmsbindings
Roger
  • 7,062
  • 13
  • 20
  • Hello Roger, thanks for the tips. I'll try the QCF instead of CF in the connection factory definition. As per the other suggestion, I have to add further details to the question, because the client which I used to generate the bindings file is on a Windows PC, but the Flume agend is on a CentOS server. Thanks again! – Alessandro D'Armiento Mar 21 '19 at 08:09