# ArgumentError when consuming a message with the jms plugin

**URL:** <https://discuss.elastic.co/t/argumenterror-when-consuming-a-message-with-the-jms-plugin/217398>\
**Category:** Logstash\
**Created:** [January 31, 2020, 2:30pm UTC](https://discuss.elastic.co/t/argumenterror-when-consuming-a-message-with-the-jms-plugin/217398 "2020-01-31T14:30:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghost\_recon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ghost_recon/32/59919_2.png) [@ghost\_recon](https://discuss.elastic.co/u/ghost_recon)\
**Post date:** [January 31, 2020, 2:30pm UTC](https://discuss.elastic.co/t/argumenterror-when-consuming-a-message-with-the-jms-plugin/217398/1 "2020-01-31T14:30:07Z")

</div>

Hello everyone,

I'am new to logstash and i've been trying to establish using the jms plugin a connection to a jboss queue and it worked, but whenever a message is been consumed instead of displaying it logstash throws this error :

jms ERROR An exception occurred processing Appender plain\_console org.jruby.exceptions.ArgumentError: (ArgumentError) wrong number of arguments (given 0, expected 1)  
at home.user.logstash.vendor.bundle.jruby.$2\_dot\_5\_dot\_0.gems.jruby\_minus\_jms\_minus\_1\_dot\_3\_dot\_0\_minus\_java.lib.jms.message.inspect(/home/user/logstash/vendor/bundle/jruby/2.5.0/gems/jruby-jms-1.3.0-java/lib/jms/message.rb:131)  
at org.jruby.RubyHash.inspect(org/jruby/RubyHash.java:877)  
at org.jruby.RubyHash.to\_s(org/jruby/RubyHash.java:945)  
at org.logstash.log.LoggerExt.error(org/logstash/log/LoggerExt.java:103)  
at home.user.logstash.vendor.bundle.jruby.$2\_dot\_5\_dot\_0.gems.logstash\_minus\_input\_minus\_jms\_minus\_3\_dot\_1\_dot\_2\_minus\_java.lib.logstash.inputs.jms.queue\_event(/home/user/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jms-3.1.2-java/lib/logstash/inputs/jms.rb:298)  
at home.user.logstash.vendor.bundle.jruby.$2\_dot\_5\_dot\_0.gems.logstash\_minus\_input\_minus\_jms\_minus\_3\_dot\_1\_dot\_2\_minus\_java.lib.logstash.inputs.jms.run(/home/user/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jms-3.1.2-java/lib/logstash/inputs/jms.rb:235)  
at home.user.logstash.vendor.bundle.jruby.$2\_dot\_5\_dot\_0.gems.jruby\_minus\_jms\_minus\_1\_dot\_3\_dot\_0\_minus\_java.lib.jms.message\_consumer.each(/home/user/logstash/vendor/bundle/jruby/2.5.0/gems/jruby-jms-1.3.0-java/lib/jms/message\_consumer.rb:70)  
at home.user.logstash.vendor.bundle.jruby.$2\_dot\_5\_dot\_0.gems.logstash\_minus\_input\_minus\_jms\_minus\_3\_dot\_1\_dot\_2\_minus\_java.lib.logstash.inputs.jms.run(/home/user/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jms-3.1.2-java/lib/logstash/inputs/jms.rb:234)  
at home.user.logstash.logstash\_minus\_core.lib.logstash.java\_pipeline.inputworker(/home/user/logstash/logstash-core/lib/logstash/java\_pipeline.rb:322)  
at home.user.logstash.logstash\_minus\_core.lib.logstash.java\_pipeline.start\_input(/home/user/logstash/logstash-core/lib/logstash/java\_pipeline.rb:314)

i'm i doing something wrong here or is this a bug ?  
Thank you for your help.

---

<div class="post-metadata">

**Author:** ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)\
**Post date:** [February 4, 2020, 10:14pm UTC](https://discuss.elastic.co/t/argumenterror-when-consuming-a-message-with-the-jms-plugin/217398/2 "2020-02-04T22:14:11Z")

</div>

There is definitely a bug here. There is an exception being raised in the upstream `jruby-jms` library in `JMS::Message#inspect` ([link](https://github.com/reidmorrison/jruby-jms/blob/1680ef9737959da7794a1dc4d112afec14f7036a/lib/jms/message.rb#L131)), which means that when Logstash attempts to log an error message that includes the message, a failure happens.

It looks like the Implementation of `JMS::ObjectMessage` in that upstream library is broken, defining `data(val)` which _requires_ an argument, stomping on the existing definition of that method that accepted zero arguments:

> ```ruby
> # Interface javax.jms.ObjectMessage
> module JMS::ObjectMessage
> def data
> getObject
> end
> 
> def data(val)
> setObject(val)
> end
> end
> 
> ```
> 
> -- [reidmorrison/jruby-jms:lib/jms/object\_message.rb@1680ef973](https://github.com/reidmorrison/jruby-jms/blob/1680ef9737959da7794a1dc4d112afec14f7036a/lib/jms/object_message.rb)

Unfortunately, it looks like the maintainer of that project has archived it, and is not actively maintaining it so we will need to find another way around it in our plugin that depends on it.

---

<div class="post-metadata">

**Author:** ![RobBavey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robbavey/32/20421_2.png) [@RobBavey](https://discuss.elastic.co/u/RobBavey)\
**Post date:** [February 4, 2020, 10:24pm UTC](https://discuss.elastic.co/t/argumenterror-when-consuming-a-message-with-the-jms-plugin/217398/3 "2020-02-04T22:24:00Z")

</div>

@ghost_recon Are you trying to use `ObjectMessage`?

Per [the docs](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jms.html#plugins-inputs-jms-include_body), `ObjectMessage` is not supported in the JMS plugin at this time.

---

<div class="post-metadata">

**Author:** ![ghost\_recon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ghost_recon/32/59919_2.png) [@ghost\_recon](https://discuss.elastic.co/u/ghost_recon)\
**Post date:** [February 8, 2020, 12:23am UTC](https://discuss.elastic.co/t/argumenterror-when-consuming-a-message-with-the-jms-plugin/217398/4 "2020-02-08T00:23:30Z")

</div>

yes i'm using ObjectMessage thank you so all i have to do is switch to TextMessage or BytesMessage is that it ?

---

<div class="post-metadata">

**Author:** ![RobBavey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robbavey/32/20421_2.png) [@RobBavey](https://discuss.elastic.co/u/RobBavey)\
**Post date:** [February 10, 2020, 3:03pm UTC](https://discuss.elastic.co/t/argumenterror-when-consuming-a-message-with-the-jms-plugin/217398/5 "2020-02-10T15:03:49Z")

</div>

@ghost_recon - yes, you can use a TextMessage, BytesMessage or MapMessage

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 9, 2020, 3:03pm UTC](https://discuss.elastic.co/t/argumenterror-when-consuming-a-message-with-the-jms-plugin/217398/6 "2020-03-09T15:03:53Z")

</div>

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