Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 0.9.0
-
Fix Version/s: JRuby 0.9.1
-
Component/s: Core Classes/Modules
-
Labels:None
-
Number of attachments :
Description
I've been trying unsucessfully to get DRb working under JRuby. Here are my test server and client:
test_server.rb
#!/usr/bin/env jruby require 'drb/drb' URI="druby://localhost:9876" class TestServer def initialize puts "Server started." end def get_hello puts "Hello Server!" "Hello Client!" end end FRONT_OBJECT = TestServer.new $SAFE = 1 DRb.start_service(URI,FRONT_OBJECT) DRb.thread.join
test_client.rb
#!/usr/bin/env ruby
require 'drb/drb'
SERVER_URI="druby://localhost:9876"
DRb.start_service
test = DRbObject.new_with_uri(SERVER_URI)
puts test.get_hello
If you notice, the server runs under JRuby, but the client does not. This is by design, as the app I'm trying to build will require that setup. In this configuration, DRb 'half' works. The server runs just fine, and when I run the client, "Hello Server!" prints on the server console. But the client never seems to get a return value, and just hangs. Here's a table of what happens when I change either the server or client to use either ruby or jruby:
| Server | Client | Result |
|---|---|---|
| jruby | ruby | Server prints "Hello Server!", client hangs |
| jruby | jruby | Server prints nothing, client hangs |
| ruby | ruby | Server prints "Hello Server!", client prints "Hello Client!" and exits |
| ruby | jruby | Server prints nothing, client hangs |
I've tried this with both the blackdown 1.4.2 JVM and the Sun 1.5 JVM.
Forgot to mention, this is with jruby 0.9.0