Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: cannot load Java class net.Protocol #3375

Closed
perlun opened this issue Oct 8, 2015 · 4 comments
Closed

NameError: cannot load Java class net.Protocol #3375

perlun opened this issue Oct 8, 2015 · 4 comments

Comments

@perlun
Copy link
Contributor

perlun commented Oct 8, 2015

Hi,

On a friend's machine (@afinne), with jruby-complete using the following command line:

java -jar workers/jruby/jruby-complete-9.0.1.0.jar -I . -r workers/gems/bundler/setup workers/m3_error_causes_to_elastic.rb

...we get the error below. workers/gems/bundler/setup is the result of running something like bundle --standalone --path workers/gems.

Unfortunately, I don't have a reproducible test case at hand. Also, it feels extremely odd that this error is occuring - I mean, line 26 in the protocol.rb declares a new class. How on earth does this cause JRuby to try to load a Java Protocol class? Or, is it just a matter of "something" having loaded a java.net class into the current environment?

I can debug this a bit more as needed, so just remind me me how to enable more Java class loading debug and we can paste more stack traces here. Thanks.

NameError: cannot load Java class net.Protocol
           <module:Net> at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/net/protocol.rb:26
                  <top> at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/net/protocol.rb:24
                require at org/jruby/RubyKernel.java:939
                require at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
                  <top> at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/net/http.rb:1
                require at org/jruby/RubyKernel.java:939
                require at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
                  <top> at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/net/http.rb:22
                require at org/jruby/RubyKernel.java:939
                require at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
                  <top> at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/net/https.rb:1
                require at org/jruby/RubyKernel.java:939
                require at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
        block in (root) at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/net/https.rb:21
                 (root) at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:1
                 (root) at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:2
                 (root) at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/faraday-0.9.2/lib/faraday.rb:1
        load_middleware at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/faraday-0.9.2/lib/faraday.rb:223
        mon_synchronize at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/monitor.rb:211
       middleware_mutex at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/faraday-0.9.2/lib/faraday.rb:197
        load_middleware at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/faraday-0.9.2/lib/faraday.rb:218
        block in lookup_middleware at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/faraday-0.9.2/lib/faraday.rb:188
             use_symbol at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:204
       block in adapter at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:100
                    map at org/jruby/RubyArray.java:2300
                adapter at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/forwardable.rb:183
             initialize at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/elasticsearch-transport-1.0.13/lib/elasticsearch/transport/client.rb:106
             initialize at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/faraday-0.9.2/lib/faraday/connection.rb:91
    __build_connections at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/elasticsearch-transport-1.0.13/lib/elasticsearch/transport/transport/http/faraday.rb:43
    __build_connections at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/elasticsearch-transport-1.0.13/lib/elasticsearch/transport/transport/http/faraday.rb:35
    block in initialize at /Users/afinne/Projects/ecraft.fieldopsapp/workers/gems/jruby/2.2.0/gems/elasticsearch-transport-1.0.13/lib/elasticsearch/transport/transport/base.rb:34
@headius
Copy link
Member

headius commented Oct 8, 2015

That's very strange! Investigating.

@headius
Copy link
Member

headius commented Oct 8, 2015

Ok, try a few things:

  • -w for verbose
  • -d for debug, which may show more stack traces for Java class loading.
  • -Xbacktrace.style=full which will show hidding Java frames in that Ruby backtrace.

I have no explanation for this. The code looks fine and obviously net/protocol loads properly in other scenarios.

@perlun
Copy link
Contributor Author

perlun commented Feb 17, 2016

We have seen this from time to time, very occasional, but I am yet to come up with more details unfortunately.

@kares
Copy link
Member

kares commented Aug 30, 2016

blaming on the Java proxy concurrency issues that there were previously. let us know if its still in 9.1.3.0

@kares kares closed this as completed Aug 30, 2016
@enebo enebo added this to the Invalid or Duplicate milestone Nov 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants