Logstash not working with ActiveMQ

I am trying to consume a message from an ActiveMQ with the following configuration;

input
{
	jms
	{
        broker_url => 'failover:(ssl://b-d5bc797b-sjd8-41d2-dfjh7-127ba48c6238-1.mq.eu-west-1.amazonaws.com:61617)?initialReconnectDelay=100'		
        destination => 'activemq-log4j2-configuration' 
        factory => 'org.apache.activemq.ActiveMQConnectionFactory' 
        pub_sub => false 
        use_jms_timestamp => false
        # JMS provider credentials if needed 
        username => 'user'
        password => 'pass'
        # Parts of the JMS message to be included 
        include_header => false
        include_properties => false
        include_body => true
        factory_settings => { exclusive_consumer => true }
        # Jar Files to include
        require_jars => ['C:\Users\M1045583\Desktop\activemq-all-5.15.12.jar'] 
	}
}
output
{
	#stdout { codec => line { format => "%{message}"} }
	stdout { codec => "rubydebug" }
}

The error i am facing is;

C:\Program Files\logstash-6.3.2-windows-x86_64\bin>logstash -f "C:\Users\M1045583\Desktop\activemq_consume.conf"
Sending Logstash's logs to C:/Program Files/logstash-6.3.2-windows-x86_64/logs which is now configured via log4j2.properties
[2020-10-14T14:03:27,167][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2020-10-14T14:03:27,872][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"6.3.2"}
[2020-10-14T14:03:33,065][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
[2020-10-14T14:03:33,397][INFO ][logstash.pipeline        ] Pipeline started successfully {:pipeline_id=>"main", :thread=>"#<Thread:0x219ba705 run>"}
[2020-10-14T14:03:33,550][INFO ][logstash.agent           ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[2020-10-14T14:03:34,051][WARN ][logstash.inputs.jms      ] JMS Consumer Died {:exception=>"TypeError", :exception_message=>"cannot convert instance of class org.jruby.RubyString to boolean", :backtrace=>["C:/Program Files/logstash-6.3.2-windows-x86_64/vendor/bundle/jruby/2.3.0/gems/jruby-jms-1.3.0-java/lib/jms/connection.rb:193:in `block in initialize'", "org/jruby/RubyHash.java:1343:in `each'", "C:/Program Files/logstash-6.3.2-windows-x86_64/vendor/bundle/jruby/2.3.0/gems/jruby-jms-1.3.0-java/lib/jms/connection.rb:188:in `initialize'", "C:/Program Files/logstash-6.3.2-windows-x86_64/vendor/bundle/jruby/2.3.0/gems/logstash-input-jms-3.1.2-java/lib/logstash/inputs/jms.rb:225:in `run'", "C:/Program Files/logstash-6.3.2-windows-x86_64/logstash-core/lib/logstash/pipeline.rb:512:in `inputworker'", "C:/Program Files/logstash-6.3.2-windows-x86_64/logstash-core/lib/logstash/pipeline.rb:505:in `block in start_input'"]}
[2020-10-14T14:03:34,105][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
[2020-10-14T14:03:36,360][WARN ][logstash.runner          ] SIGINT received. Shutting down.
[2020-10-14T14:03:39,086][WARN ][logstash.inputs.jms      ] JMS Consumer Died {:exception=>"TypeError", :exception_message=>"cannot convert instance of class org.jruby.RubyString to boolean", :backtrace=>["C:/Program Files/logstash-6.3.2-windows-x86_64/vendor/bundle/jruby/2.3.0/gems/jruby-jms-1.3.0-java/lib/jms/connection.rb:193:in `block in initialize'", "org/jruby/RubyHash.java:1343:in `each'", "C:/Program Files/logstash-6.3.2-windows-x86_64/vendor/bundle/jruby/2.3.0/gems/jruby-jms-1.3.0-java/lib/jms/connection.rb:188:in `initialize'", "C:/Program Files/logstash-6.3.2-windows-x86_64/vendor/bundle/jruby/2.3.0/gems/logstash-input-jms-3.1.2-java/lib/logstash/inputs/jms.rb:225:in `run'", "C:/Program Files/logstash-6.3.2-windows-x86_64/logstash-core/lib/logstash/pipeline.rb:512:in `inputworker'", "C:/Program Files/logstash-6.3.2-windows-x86_64/logstash-core/lib/logstash/pipeline.rb:505:in `block in start_input'"]}
[2020-10-14T14:03:39,275][INFO ][logstash.pipeline        ] Pipeline has terminated {:pipeline_id=>"main", :thread=>"#<Thread:0x219ba705 run>"}
Terminate batch job (Y/N)? Y

I have only a simple message as Hello World in the ActiveMQ that created manually from Send option of ActiveMQ instance only

Any help please?

Can you try commenting out the factory_settings option of the input?

Worked like a charm. :slight_smile: What was the hint for you to understand the issue? I am intrigued to know the approach used :wink:

That backtrace points at this line of code, which appears to be tweaking settings on the connection factory, so getting rid of the factory_settings looked like it might avoid going through that code path.

1 Like

Hi all,

I have a similar issue trying to set the watchTopicAdvisories parameter to false in the factory_settings. Unfortunately, commenting this section out is not an option as I need this parameter set. The exact configuration line in the jms input plug-in section which is causing the problem is:

factory_settings => { watchTopicAdvisories => false }

Any suggestions on what I am doing wrong or alternate ways of setting this parameter?

[edit] I am currently using Logstash version 7.7.0.

Thanks!
Chris

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.