I’m trying to integrate google-api-client Ruby gem into a project that
runs
in JRuby 1.7.4 (logstash). When I run this code on Ruby in an RVM
environment (JRuby 1.7.4) directly, the code works just fine. However,
when
I create the jar file (make jar) and try to run it on the JVM, it fails
with the error below:
The error reported is:
superclass mismatch for class Request
Debugging with DEBUG=require shows that the offending class (request.rb)
is
loaded only once before I actually hit the error. Also, when I look at
gem
that hits the problem, only one file (connection.rb) actually requires
“request” (through their require_libs method), so it doesn’t seem to be
the
case that multiple code paths load the same class.
Would you have any tips on how to investigate this further? (More
details
can be found at the end of the email).
Thanks,
Rodrigo
Detailed error:
sudo DEBUG=require /usr/lib/jvm/default-java/bin/java -Xms512m -Xmx512m
-jar /usr/share/logstash/logstash.jar agent -f
/etc/logstash/syslog-shipper.conf --log /var/log/logstash.log -vv
Sending all output to /var/log/logstash.log.
[…]
require(“etc”) => false (from:
jar:file:/usr/share/logstash/logstash.jar!/META-INF/jruby.home/lib/ruby/1.9/fileutils.rb:1084:in
FileUtils') require("fileutils") => true (from: file:/usr/share/logstash/logstash.jar!/logstash/outputs/gcs.rb:43:in
register’)
require(“timeout”) => true (from:
jar:file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday.rb:47:in
Faraday') require("cgi") => false (from: file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday/utils.rb:1:in
(root)‘)
require(“jar:file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday/utils”)
=> true (from:
jar:file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday.rb:17:in
require_libs') require("cgi") => false (from: file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday/connection.rb:1:in
(root)’)
require(“set”) => true (from:
file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday/connection.rb:2:in
(root)') require("forwardable") => true (from: file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday/connection.rb:3:in
(root)‘)
require(“uri”) => false (from:
file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday/connection.rb:4:in
(root)') require("jar:file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday/builder") => true (from: jar:file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday.rb:17:in
require_libs’)
±--------------------------------------------------------+
| An unexpected error occurred. This is probably a bug. |
| You can find help with this problem in a few places: |
| |
| * chat: #logstash IRC channel on freenode irc. |
| IRC via the web: http://goo.gl/TI4Ro |
| * email: [email protected] |
| * bug system: https://logstash.jira.com/ |
| |
±--------------------------------------------------------+
The error reported is:
superclass mismatch for class Request
file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday/request.rb:12:in
Faraday' file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday/request.rb:1:in
(root)’
org/jruby/RubyKernel.java:1054:in require' jar:file:/usr/share/logstash/logstash.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36:in
require’
file:/usr/share/logstash/logstash.jar!/logstash/JRUBY-6970.rb:13:in
require' jar:file:/usr/share/logstash/logstash.jar!/gems/polyglot-0.3.3/lib/polyglot.rb:63:in
require’
jar:file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday.rb:1:in
(root)' org/jruby/RubyArray.java:1617:in
each’
jar:file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday.rb:17:in
require_libs' jar:file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday.rb:15:in
require_libs’
org/jruby/RubyKernel.java:1054:in require' jar:file:/usr/share/logstash/logstash.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36:in
require’
file:/usr/share/logstash/logstash.jar!/logstash/JRUBY-6970.rb:13:in
require' jar:file:/usr/share/logstash/logstash.jar!/gems/polyglot-0.3.3/lib/polyglot.rb:63:in
require’
file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday/connection.rb:6:in
(root)' org/jruby/RubyArray.java:1617:in
each’
jar:file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday.rb:1:in
(root)' jar:file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday.rb:17:in
require_libs’
jar:file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday.rb:15:in
require_libs' org/jruby/RubyKernel.java:1054:in
require’
jar:file:/usr/share/logstash/logstash.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36:in
require' file:/usr/share/logstash/logstash.jar!/logstash/JRUBY-6970.rb:13:in
require’
jar:file:/usr/share/logstash/logstash.jar!/gems/polyglot-0.3.3/lib/polyglot.rb:63:in
require' jar:file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday.rb:130:in
Faraday’
org/jruby/RubyKernel.java:1054:in require' jar:file:/usr/share/logstash/logstash.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:60:in
require’
jar:file:/usr/share/logstash/logstash.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:55:in
require' file:/usr/share/logstash/logstash.jar!/logstash/JRUBY-6970.rb:13:in
require’
jar:file:/usr/share/logstash/logstash.jar!/gems/polyglot-0.3.3/lib/polyglot.rb:63:in
require' jar:file:/usr/share/logstash/logstash.jar!/gems/faraday-0.8.7/lib/faraday.rb:1:in
(root)’
org/jruby/RubyArray.java:1617:in each' jar:file:/usr/share/logstash/logstash.jar!/gems/google-api-client-0.6.4/lib/google/api_client.rb:1:in
(root)’
jar:file:/usr/share/logstash/logstash.jar!/gems/google-api-client-0.6.4/lib/google/api_client.rb:16:in
`(root)’