Rails 3 中的路由错误

发布于 2024-12-07 14:05:44 字数 1872 浏览 3 评论 0原文

我正在升级在 Jruby 1.4 和 1.4 上运行的应用程序导轨2.3 到 Rails 3.1.0 和 jruby 1.6。我按照 Rails 3 升级手册 Jeremy,并使用插件rails_upgrade,但是当我启动服务器时 我收到错误。就像

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'

I'm upgrading my application running on Jruby 1.4 & rails 2.3
to Rails 3.1.0 and jruby 1.6. I followed the Rails 3 upgrade Handbook by
Jeremy, and using the plugin rails_upgrade, but when I fire the server
I'm getting errors. like

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

Somebody please help me. This is the error log

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'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

超可爱的懒熊 2024-12-14 14:05:44

我怀疑您在 lib 或 Rails 2.3 自动加载的其他文件夹中有 jar 文件,包括 hibernate jar,

请查看

http://hemju.com/2010/09/22/rails-3-quicktip-autoload-lib-directory-include-all-subdirectories/

您可能仍然需要包含以下要求Jens 在他的评论中描述了这一点。

I suspect that you have jar files, including a hibernate jar, in lib or some other folder that was autoloaded by Rails 2.3

have a look at

http://hemju.com/2010/09/22/rails-3-quicktip-autoload-lib-directory-including-all-subdirectories/

You may still need to include the requires descibed by jens in his comment.

忆梦 2024-12-14 14:05:44

最后我找到了解决方案,在Windows中我们需要先加载类,然后加载jar文件。

就像(这真的很奇怪!)

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

除了我们需要包括课程之外,

   include_class '<your class>.persistence.HibernateUtil'

感谢您的所有帮助。

At last I found the solution, In windows we need to load the classes first then the jar files.

like (This is really strange!)

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

Apart from we need to include the class

   include_class '<your class>.persistence.HibernateUtil'

Thanks for all the help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文