使用Torquebox和RubyMine进行调试

时间:2013-02-02 14:59:12

标签: ruby debugging rubymine torquebox

我有RubyMine 4.5(我还有带Ruby插件的Idea 12)和Torquebox 2.3。似乎RubyMine没有对Torquebox的原生支持,就像它对乘客,特立尼达等一样。

我无法弄清楚如何使用RubyMine在Torquebox服务器上调试应用程序。有什么想法吗?

同时

我尝试过RubyMine 5 EAP,似乎开箱即用。

我收到以下错误:

exception:
javax.servlet.ServletException: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- ruby/debug/ide

root cause:
org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- ruby/debug/ide

但是安装了'ruby-debug-ide'gem。

不知道RubyMine或Torquebox中的问题。

同时 通过将以下字符串添加到Gemfile

,我能够解决上一个问题
gem 'ruby-debug-base'
gem 'ruby-debug-ide'

似乎调试器附加到Torquebox服务器进程,但现在当应用程序到达断点时,调试器进程只是默默地死掉:

Process finished with exit code 143

然而,Torquebox仍然有效,但是给了我一个运行时错误:

@last_breakpoint supposed to be nil. is #<Debugger::Breakpoint:0x1adad4f>

使用以下stacktrace:

ruby-debug-ide (0.4.17.beta16) lib/ruby-debug-ide/event_processor.rb:18:in `at_breakpoint'
ruby-debug-base-0.10.4 (java) lib/ruby-debug-base.rb:43:in `at_breakpoint'
app/controllers/orders_controller.rb:5:in `index'
org/jruby/RubyBasicObject.java:1659:in `__send__'
org/jruby/RubyKernel.java:2086:in `send'
actionpack (3.2.11) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.11) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.11) lib/abstract_controller/callbacks.rb:18:in `process_action'
activesupport (3.2.11) lib/active_support/callbacks.rb:417:in `_run__837017838__process_action__370397448__callbacks'
org/jruby/RubyBasicObject.java:1659:in `__send__'
org/jruby/RubyKernel.java:2086:in `send'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.11) lib/active_support/callbacks.rb:390:in `_run_process_action_callbacks'
org/jruby/RubyBasicObject.java:1665:in `__send__'
org/jruby/RubyKernel.java:2090:in `send'
activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.11) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.2.11) lib/active_support/notifications.rb:123:in `instrument'
activesupport (3.2.11) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.11) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.11) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.11) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.11) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.11) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.11) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.11) lib/action_controller/metal.rb:246:in `action'
org/jruby/RubyProc.java:261:in `call'
org/jruby/RubyProc.java:249:in `call'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `call'
org/jruby/RubyArray.java:1613:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:601:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.4) lib/rack/etag.rb:23:in `call'
rack (1.4.4) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/flash.rb:242:in `call'
torquebox-web-2.3.0 (java) lib/torquebox/session/servlet_store.rb:31:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.11) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
activesupport (3.2.11) lib/active_support/callbacks.rb:408:in `_run__521886712__call__4409452__callbacks'
org/jruby/RubyBasicObject.java:1659:in `__send__'
org/jruby/RubyKernel.java:2086:in `send'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.11) lib/active_support/callbacks.rb:390:in `_run_call_callbacks'
org/jruby/RubyBasicObject.java:1659:in `__send__'
org/jruby/RubyKernel.java:2086:in `send'
activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.11) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.11) lib/rails/rack/logger.rb:16:in `call'
activesupport (3.2.11) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.11) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.4) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.4) lib/rack/runtime.rb:17:in `call'
rack (1.4.4) lib/rack/lock.rb:15:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.11) lib/rails/engine.rb:479:in `call'
railties (3.2.11) lib/rails/application.rb:223:in `call'
org/jruby/RubyBasicObject.java:1665:in `__send__'
org/jruby/RubyKernel.java:2090:in `send'
railties (3.2.11) lib/rails/railtie/configurable.rb:30:in `method_missing'

Withal我收到了与jruby相关的数百个IDE错误。

修改:

使用适当版本的gems修复Gemfile后:

gem 'ruby-debug-base', '>= 0.10.5.rc3'
gem 'ruby-debug-ide', '>= 0.4.17.beta14'

调试器似乎正在工作,但是当我在我的应用程序中遇到异常时,调试器崩溃了:进程死了,我得到了以下内容:

@last_breakpoint supposed to be nil. is #<Debugger::Breakpoint:0x1d91ad6>

我想我最好等待RubyMine 5 RC。

2 个答案:

答案 0 :(得分:1)

根据this comment它已经实现,将在RubyMine 5.0和下一个IDEA插件中提供。

您已经可以在RubyMine 5.0 EAP中尝试。

答案 1 :(得分:0)

请检查文件夹的名称。您的项目名称应该是正常的。一旦我在OSX系统下使用“jim项目”作为项目文件夹名称,就会出现上述错误。改为“jims项目”后,一切都很好。