Debugging under JRuby in Rubymine 2.0 beta or lower

We're trying to debug jruby in rubymine, but receiving this error:

Cannot connect to the debugged process at port 55969 in 10s:

Error Output:
/Users/serguei/.rvm/jruby-1.4.0RC1/lib/ruby/site_ruby/1.8/rubygems.rb:827:in `report_activate_error': Could not find RubyGem ruby-debug-ide (>= 0) (Gem::LoadError)


from /Users/serguei/.rvm/jruby-1.4.0RC1/lib/ruby/site_ruby/1.8/rubygems.rb:261:in `activate'
from /Users/serguei/.rvm/jruby-1.4.0RC1/lib/ruby/site_ruby/1.8/rubygems.rb:68:in `gem'
from /Users/serguei/.rvm/gems/jruby/1.4.0RC1/bin/rdebug-ide:18
from /Users/serguei/.rvm/gems/jruby/1.4.0RC1/bin/rdebug-ide:1:in `load'
from -e:1



even though gem list shows the following:

[jruby:1.4.0RC1] laptop:~ serguei$ jruby -S gem list | grep ruby
json-jruby (1.1.7)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3.1)
ruby-debug-ide (0.4.9)



The file we're are debugging is very small and consists of:

require 'iconv'
require 'stringio'
non_utf8 = "\xa4"
puts non_utf8
utf8 = Iconv.conv('UTF-8//IGNORE', 'UTF-8', non_utf8)
puts utf8 == non_utf8 # returns true, which is wrong




Debugging on the command-line works, but not in Rubymine.

What is the right way to get debugging of jruby to work in RubyMine?
6 comments
Comment actions Permalink


[jruby:1.4.0RC1] laptop:~ serguei$ jruby -S gem list | grep ruby
json-jruby (1.1.7)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3.1)
ruby-debug-ide (0.4.9)

May be jruby points on other JRuby interpreter. Please invoke



[jruby:1.4.0RC1] laptop:~ serguei$ which jruby

Also which Language level do you use for your JRuby SDK in RubyMine (1.9 or 1.8) ?

0
Comment actions Permalink

$which jruby returns

/Users/pivotal/.rvm/jruby-1.4.0RC1/bin/jruby

In RubyMine the ruby language level is set to 1.8

0
Comment actions Permalink

I have the same problem with jruby debug not working under Rubymine, but I get a different error:

/Users/pivotal/.rvm/jruby-1.4.0RC1/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:442:in `load_missing_constant': uninitialized constant Debugger::CommandProcessor (NameError)

I followed the instructions here to set up the jruby debugger:

http://kenai.com/projects/jruby/pages/UsingTheJRubyDebugger

0
Comment actions Permalink

I installed jruby via rvm on a new box and setup rubymine using instructions at

http://kenai.com/projects/jruby/pages/UsingTheJRubyDebugger

too. I'm now getting the same error as Chad

/Users/pivotal/.rvm/jruby-1.4.0RC1/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:442:in `load_missing_constant': uninitialized constant Debugger::CommandProcessor (NameError)
 from /Users/pivotal/.rvm/jruby-1.4.0RC1/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:77:in `const_missing_with_dependencies'
 from /Users/pivotal/.rvm/jruby-1.4.0RC1/lib/ruby/gems/1.8/gems/ruby-debug-0.10.3/cli/ruby-debug.rb:9
 from /Users/pivotal/.rvm/jruby-1.4.0RC1/lib/ruby/gems/1.8/gems/ruby-debug-0.10.3/cli/ruby-debug.rb:36:in `require'
 from /Users/pivotal/.rvm/jruby-1.4.0RC1/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
 from /Users/pivotal/.rvm/jruby-1.4.0RC1/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:155:in `require'
 from /Users/pivotal/.rvm/jruby-1.4.0RC1/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/requires.rb:7:in `require_library_or_gem'
 from /Users/pivotal/.rvm/jruby-1.4.0RC1/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
 from /Users/pivotal/.rvm/jruby-1.4.0RC1/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/requires.rb:5:in `require_library_or_gem'
  ... 23 levels...
 from /Users/pivotal/.rvm/gems/jruby/1.4.0RC1/bin/rdebug-ide:19
 from /Users/pivotal/.rvm/gems/jruby/1.4.0RC1/bin/rdebug-ide:1:in `load'
 from -e:1

0
Comment actions Permalink

Debug works for me.

I'm on MacOS 10.6.1

0. I've downloaded JRuby 1.4.0RC1 from http://dist.codehaus.org/jruby/1.4.0RC1/
1. RubyMine 2.0 Beta
2. I created new sdk for JRuby 1.4.0RC1
3. Created project with file

puts "start"
require 'iconv'
require 'stringio'
non_utf8 = "\xa4"
puts non_utf8
utf8 = Iconv.conv('UTF-8//IGNORE', 'UTF-8', non_utf8)
puts utf8 == non_utf8 # returns true, which is wrong



4. Chose "Debug" from contex menu
5. RM suggested to install necessary debug gems. Then it showed progress dialog.
    RM installed

ruby-debug-base 0.10.3.1
ruby-debug-ide 0.4.9


6. Debugger started and stopped on breakpoint
Screen shot 2009-10-08 at 14.15.05.png

Later I'll try rvm. But probably bug is in rvm gem.

0
Comment actions Permalink

Serguei,

Most likely problem is related to PATH env variable, see similar post related rvm - http://www.jetbrains.net/devnet/message/5246881#5246881

0

Please sign in to leave a comment.