我正在将我的 Rails 3 应用程序部署到 Tomcat 6 服务器。我一直在使用warble
将我的项目打包成一个war
文件,到目前为止还没有遇到任何麻烦,直到现在。我刚刚cache_sweeper
在我的应用程序中添加了一个。当我尝试点击应用程序时,我收到了标准的 500 错误页面。
查看我的日志,我看到了这个:
org.jruby.rack.RackInitializationException: undefined method `cache_sweeper' for ApplicationController:Class
找不到cache_sweeper
方法?这不是 Rails 的一部分吗?
在开发模式下不会发生这种情况,尽管在开发中我使用的是 MRI ruby 并使用 rails 服务器。
有人有想法么?!
完整错误:
SEVERE: Application Error
org.jruby.rack.RackInitializationException: undefined method `cache_sweeper' for ApplicationController:Class
from C:/bin/apache-tomcat-6.0.29/webapps/rails3app/WEB-INF/app/controllers/application_controller.rb:239:in `require'
from C:/bin/apache-tomcat-6.0.29/webapps/rails3app/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from C:/bin/apache-tomcat-6.0.29/webapps/rails3app/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:227:in `load_dependency'
from C:/bin/apache-tomcat-6.0.29/webapps/rails3app/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from C:/bin/apache-tomcat-6.0.29/webapps/rails3app/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:346:in `require_or_load'
from C:/bin/apache-tomcat-6.0.29/webapps/rails3app/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:491:in `load_missing_constant'
from C:/bin/apache-tomcat-6.0.29/webapps/rails3app/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:183:in `const_missing'
from C:/bin/apache-tomcat-6.0.29/webapps/rails3app/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:181:in `each'
... 39 levels...
from file:/C:/bin/apache-tomcat-6.0.29/webapps/rails3app/WEB-INF/lib/jruby-rack-1.0.3.jar!/vendor/rack-1.2.1/rack/builder.rb:46:in `initialize'
from <script>:2:in `new'
from <script>:2
at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:184)
at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:59)
at org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplicationFactory.java:94)
at org.jruby.rack.servlet.DefaultServletDispatcher.process(DefaultServletDispatcher.java:36)
at org.jruby.rack.RackFilter.doFilter(RackFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
at java.lang.Thread.run(Thread.java:619)