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 $SPLUNKHOME\etc\apps\jmsta\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 $SPLUNKHOME\etc\apps\jmsta\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!
According to your logs this is wrong :
jmsconnectionfactory_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.
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?
Yes there is an ActiveMQ management console, but I could not find any connection factory name to be configured on the management console.
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.
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
Searching answers for already answered questions is also helpful :
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
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