我有一个将数据转换为 JSON 格式的 java 程序。我能够成功地将程序构建到 jar 文件中,并在独立程序中成功使用 jar 的功能。
我为调用此 jar 的 Logstash 创建了一个 jruby 插件。运行 Logstash 时:
gem build logstash-filter-example.gemspec &&
../../logstash-5.6.7.freshinstall/bin/logstash-plugin install logstash-filter-example-0.1.1.gem &&
../../logstash-5.6.7.freshinstall/bin/logstash -e 'input { stdin{} } filter { example {} } output {stdout { codec => rubydebug }}'
我收到以下错误:
/dataservice/DataServiceClient.java:156:in `parseQueryRowEntry': java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.node.JsonNodeFactory.numberNode(Ljava/math/BigDecimal;)Lcom/fasterxml/jackson/databind/node/NumericNode;
from com/mike/dataservice/DataServiceClient.java:93:in `toJsonObject'
from com/mike/dataservice/DataServiceClient.java:66:in `getData'
from java/lang/reflect/Method.java:498:in `invoke'
from /Users/michael.dobrin/compilationsFromSource/logstash-5.6.7/logstash-5.6.7.freshinstall/vendor/local_gems/ecdbfdf7/logstash-filter-example-0.1.1/lib/logstash/filters/example.rb:49:in `filter'
from /Users/michael.dobrin/compilationsFromSource/logstash-5.6.7/logstash-5.6.7.freshinstall/logstash-core/lib/logstash/filters/base.rb:145:in `do_filter'
from /Users/michael.dobrin/compilationsFromSource/logstash-5.6.7/logstash-5.6.7.freshinstall/logstash-core/lib/logstash/filters/base.rb:164:in `multi_filter'
from /Users/michael.dobrin/compilationsFromSource/logstash-5.6.7/logstash-5.6.7.freshinstall/logstash-core/lib/logstash/filters/base.rb:164:in `multi_filter'
from org/jruby/RubyArray.java:1613:in `each'
由于某种原因,无法识别 numberNode() 方法。但是,使用独立的 jruby 程序运行我的 jar 时没有问题,即使使用 Logstash 的本地安装的 jruby 实例也是如此。此外,该程序成功地使用了我的 jar 文件中的一些方法...... numberNode(Ljava/math/BigDecimal;) 是唯一无法识别的方法。为什么 Logstash 看不到这个?
长风秋雁
相关分类