Warbler 和 tomcat 未正确设置上下文
我正在尝试使用 Warbler 生成的 war 文件将 Rails 应用程序部署到 Tomcat。 war 文件部署到 /myproject-rails-gui 没有任何问题,但是,当我尝试访问应用程序上的页面时,我得到:
ArgumentError: wrong number of arguments (1 for 0)
send at org/jruby/RubyKernel.java:2097
Railtie at /home/myproject/apache-tomcat-7.0.22/webapps/myproject-rails-gui/WEB-INF/gems/gems/actionpack-3.0.10/lib/action_controller/railtie.rb:54
尝试设置relative_url_root 时失败。还有其他 Stack Overflow 文章(正确地)指出relative_url_root 已弃用,您应该设置 RAILS_RELATIVE_URL_ROOT 环境变量。
module ActionController
class Base
# Deprecated methods. Wrap them in a module so they can be overwritten by plugins
# (like the verify method.)
module DeprecatedBehavior #:nodoc:
def relative_url_root
ActiveSupport::Deprecation.warn "ActionController::Base.relative_url_root is ineffective. " <<
"Please stop using it.", caller
end
def relative_url_root=
ActiveSupport::Deprecation.warn "ActionController::Base.relative_url_root= is ineffective. " <<
"Please stop using it.", caller
end
不过,我还没有弄清楚如何使用 Warbler 和 Tomcat 来做到这一点。有什么建议吗?就其价值而言,当我在根上下文中运行该应用程序时,它运行良好。
我的环境:
- Warbler 1.3.2
- Tomcat 7.0.22
- JRuby 1.6.5
- Rails 3.0.10
I'm trying to deploy a Rails app to Tomcat with a war file generated by Warbler. The war file deploys to /myproject-rails-gui without any problems but, when I try to access a page on the app, I'm getting:
ArgumentError: wrong number of arguments (1 for 0)
send at org/jruby/RubyKernel.java:2097
Railtie at /home/myproject/apache-tomcat-7.0.22/webapps/myproject-rails-gui/WEB-INF/gems/gems/actionpack-3.0.10/lib/action_controller/railtie.rb:54
It's failing when it tries to set relative_url_root. There are other Stack Overflow articles that (correctly) point out that relative_url_root is deprecated and you should set the RAILS_RELATIVE_URL_ROOT environment variable instead.
From the Rails project on GitHub
module ActionController
class Base
# Deprecated methods. Wrap them in a module so they can be overwritten by plugins
# (like the verify method.)
module DeprecatedBehavior #:nodoc:
def relative_url_root
ActiveSupport::Deprecation.warn "ActionController::Base.relative_url_root is ineffective. " <<
"Please stop using it.", caller
end
def relative_url_root=
ActiveSupport::Deprecation.warn "ActionController::Base.relative_url_root= is ineffective. " <<
"Please stop using it.", caller
end
I haven't had any luck figuring out how to do that using Warbler and Tomcat, though. Any suggestions? For what it's worth, the app works fine when I run it in the root context.
My environment:
- Warbler 1.3.2
- Tomcat 7.0.22
- JRuby 1.6.5
- Rails 3.0.10
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论