我正在尝试使用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来解决这个问题。有什么建议?对于它的价值,当我在根上下文中运行它时,该应用程序正常工作。
我的环境:
答案 0 :(得分:0)
经过大量挖掘后,看起来这个特殊异常是由Rails v3.0.10中 ActionController :: DeprecatedBehavior.relative_url_root = 中缺少的参数引起的。 Miguel,您的问题可能是相关的,但是,如果您在Rails v3.1.1中看到它,那么它会略有不同。我必须修改以修复它的文件在v3.1.1中不存在。
我在Github上的Rails项目中提交了issue 3645,将其修改为一个fork,并向他们发出了一个pull请求。希望这将在Rails 3.0的新版本中修复。
与此同时,如果您想使用我的固定版本,可以在https://github.com/mhuffnagle/rails/tree/3-0-stable处找到。