All Apps and Add-ons

Why am I getting this error message when configuring ActiveMQ to work with JMS Messaging Modular Input Add-on?

michaeltay
Path Finder

Hi all, I am relatively new to ActiveMQ and JMS.

I have tried reading all the documentation (http://activemq.apache.org/jndi-support.html) and support forums, but I am still unable to figure out what went wrong.

I am trying to poll from a queue using JMS Messaging Modular Input.

The following was done:
1) Created jndi.properties and placed it (a) as a jar file in $SPLUNK_HOME\etc\apps\jms_ta\bin\lib\ (jndi.properties is in the root) and (b) at apache-activemq-5.13.3\conf

java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
java.naming.provider.url = tcp://192.168.99.2:61616
connectionFactoryNames = connectionFactory
queue.MyQueue = foo.bar

2) Included activemq-all-5.13.3.jar in $SPLUNK_HOME\etc\apps\jms_ta\bin\lib\
3) Configured inputs.conf in launcher app

[jms://queue/:MyQueue]
browse_frequency = -1
browse_mode = all
browse_queue_only = 1
durable = 0
hec_batch_mode = 0
hec_https = 0
host = 192.168.99.2
index = main
index_message_header = 1
index_message_properties = 1
init_mode = jndi
jms_connection_factory_name = connectionFactory
jndi_initialcontext_factory = org.apache.activemq.jndi.ActiveMQInitialContextFactory
jndi_provider_url = tcp://192.168.99.2:61616
output_type = stdout
sourcetype = jms
strip_newlines = 1

4) Rebooted Splunk service.

However, I am getting the following error from the logs.

09-14-2016 00:41:25.009 +0800 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\jms_ta\bin\jms.py"" Stanza jms://queue/:MyQueue : Error connecting : javax.naming.NameNotFoundException: connectionFactory
09-14-2016 00:41:25.009 +0800 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\jms_ta\bin\jms.py""  at org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:235)
09-14-2016 00:41:25.009 +0800 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\jms_ta\bin\jms.py""  at javax.naming.InitialContext.lookup(Unknown Source)
09-14-2016 00:41:25.009 +0800 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\jms_ta\bin\jms.py""  at com.splunk.modinput.jms.JMSModularInput$MessageReceiver.connect(Unknown Source)
09-14-2016 00:41:25.009 +0800 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\jms_ta\bin\jms.py""  at com.splunk.modinput.jms.JMSModularInput$MessageReceiver.run(Unknown Source)

Can anyone advise me on what went wrong? Thank you!

0 Karma

jsamuelsen
New Member

I was having the same issue and just wanted to pass along the solution in case anyone comes across it again. The solution was to create a jar file with the jndi.properties file, this allowed the properties to be read. And in the case of ActiveMQ 15.5.0 the property for connectionFactoryNames was added as shown below:
//-----
java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
java.naming.provider.url = tcp://localhost:61616
queue.MyQueue = EVENTS.Q
//-----

0 Karma

Damien_Dallimor
Ultra Champion

You are not supposed to use a jndi.properties file
You are supposed to properly define your jndi properties in your inputs.conf stanza
At least thats what I do when setting up connections to ActiveMQ successfully

0 Karma

Damien_Dallimor
Ultra Champion

According to your logs this is wrong :

jms_connection_factory_name = connectionFactory

So look in your ActiveMQ config for the correct JNDI name of your connection factory. Perhaps Uppercase ? ConnectionFactory ?

Also , you don't need a jndi.properties file on the classpath.

0 Karma

michaeltay
Path Finder

Hi Damien,

Thanks for your reply.

In my ActiveMQ config, I have a jndi.properties file that states the connection factory name as connectionFactory.

Where can I look in ActiveMQ config for the correct connection factory name?

0 Karma

Damien_Dallimor
Ultra Champion

I'm going to guess there is a management console ?

Docs : http://activemq.apache.org/web-console.html

0 Karma

michaeltay
Path Finder

Hi Damien,

Yes there is an ActiveMQ management console, but I could not find any connection factory name to be configured on the management console.

0 Karma

Damien_Dallimor
Ultra Champion

This example code in the ActiveMQ docs uses "ConnectionFactory" , note the casing.

http://activemq.apache.org/jndi-support.html

0 Karma

michaeltay
Path Finder

Hi Damien,

I changed inputs.conf to reflect "ConnectionFactory", but now it is giving another error:

Stanza jms://queue/:MyQueue : Error connecting : javax.naming.NameNotFoundException: MyQueue

I do have a queue in ActiveMQ named MyQueue.

0 Karma

Damien_Dallimor
Ultra Champion

Perhaps you are using a dynamicQueue.

So again, as per the docs that I'm just reading back to you here, perhaps the queue jndi name is dynamicQueues/MyQueue :

http://activemq.apache.org/jndi-support.html

Searching answers for already answered questions is also helpful :

https://answers.splunk.com/answers/345026/how-to-configure-jms-modular-input-on-a-heavy-forw.html#an...

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...