2011-09-28 137 views
0

我正在升級我在Jruby 1.4上運行的應用程序& rails 2.3 到Rails 3.1.0和jruby 1.6。我遵循了Jeremy的 Rails 3升級手冊,並使用插件rails_upgrade,但是當我啓動服務器 時出現錯誤。像Rails 3中的路由錯誤

Routing Error 
cannot load Java class com.mysentry.persistence.HibernateUtil 

有人請幫助我。這是錯誤日誌

Started GET "/admin/login/en/sentry" for 127.0.0.1 at Wed Sep 28 13:13:56 -0400 
2011 

ActionController::RoutingError (cannot load Java class com.mysentry.persistence. 
HibernateUtil): 
org/jruby/javasupport/JavaClass.java:1204:in `for_name' 
org/jruby/javasupport/JavaUtilities.java:34:in `get_proxy_class' 
C:/upgrade/jruby-1.6.4/lib/ruby/site_ruby/shared/builtin/javasupport/core_ext/ 
object.rb:46:in `java_import' 
C:/upgrade/jruby-1.6.4/lib/ruby/site_ruby/shared/builtin/javasupport/core_ext/ 
object.rb:26:in `include_class' 
lib/sentry/interceptor/transaction_interceptor.rb:5:in `Interceptor' 
lib/sentry/interceptor/transaction_interceptor.rb:2:in `Sentry' 
lib/sentry/interceptor/transaction_interceptor.rb:1:in `(root)' 
org/jruby/RubyKernel.java:1038:in `require' 
polyglot (0.3.2) lib/polyglot.rb:63:in `require' 
activesupport (3.1.0) lib/active_support/dependencies.rb:240:in `require' 
activesupport (3.1.0) lib/active_support/dependencies.rb:223:in `load_dependen 
cy' 
activesupport (3.1.0) lib/active_support/dependencies.rb:640:in `new_constants 
_in' 
activesupport (3.1.0) lib/active_support/dependencies.rb:639:in `new_constants 
_in' 
activesupport (3.1.0) lib/active_support/dependencies.rb:223:in `load_dependen 
cy' 
activesupport (3.1.0) lib/active_support/dependencies.rb:240:in `require' 
lib/sentry/interceptor/transaction_interceptor.rb:7:in `Dispatcher' 
lib/sentry/dispatcher/application_dispatcher.rb:3:in `Sentry' 
lib/sentry/dispatcher/application_dispatcher.rb:2:in `(root)' 
org/jruby/RubyKernel.java:1038:in `require' 
polyglot (0.3.2) lib/polyglot.rb:63:in `require' 
+0

你可以顯示你的lib/interceptor.rb腳本嗎? – Rob

+0

模塊哨兵 模塊攔截 需要的Java「 include_class代碼「com.mysentry.persistence.HibernateUtil」類TransactionInterceptor – Jens

+0

你能放進了問題所以它的可讀性? – Rob

回答

0

最後我找到了解決方案,在windows中我們需要先加載類,然後加載jar文件。

一樣(這真是奇怪!)

set CLASSPATH = %<project_name>%\classes;%<project_name>%\lib\java\ant-antlr-1.6.5.jar;.... 

除了我們需要包括類

include_class '<your class>.persistence.HibernateUtil' 

感謝所有幫助。