Jruby 1.6.8 tomcat部署问题(org.jruby.rack.rails.RailsS​​ervletContextListener)

时间:2016-07-09 20:04:16

标签: java tomcat7 jruby jrubyonrails warbler

我尝试将使用warbler-0.9.14构建的war文件部署到一个JoR应用程序到Tomcat 7.然而,当我尝试启动应用程序时,我收到以下错误

  

Jul 09,2016 3:48:13 PM org.apache.catalina.core.StandardContext listenerStop   SEVERE:异常将上下文销毁事件发送到类org.jruby.rack.rails.RailsS​​ervletContextListener的侦听器实例   显示java.lang.NullPointerException       在org.jruby.rack.SharedRackApplicationFactory.destroy(SharedRackApplicationFactory.java:58)       在org.jruby.rack.RackServletContextListener.contextDestroyed(RackServletContextListener.java:50)       at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5146)       at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5810)       在org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224)       在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159)       在org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1312)       在org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:690)       在org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:216)       在javax.servlet.http.HttpServlet.service(HttpServlet.java:650)       在javax.servlet.http.HttpServlet.service(HttpServlet.java:731)       在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)       在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)       在org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:136)       在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)       在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)       在org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)       在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)       在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)       在org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)       在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)       在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)       在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)       在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)       在org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:614)       在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)       在org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)       在org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)       在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)       在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)       在org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)       at org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:623)       at org.apache.tomcat.util.net.JIoEndpoint $ SocketProcessor.run(JIoEndpoint.java:318)       在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)       at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)       at org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)       在java.lang.Thread.run(Thread.java:745)

我对Java / jruby知之甚少,不知道我错过了什么。任何对任何文档的帮助或参考都将非常感激。代码库非常陈旧,没有文档。我已经确定它使用的是jruby-1.6.8和rails 2.3.5。

这是web.xml



<!DOCTYPE web-app PUBLIC
  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>

  <context-param>
    <param-name>rails.env</param-name>
    <param-value>development</param-value>
  </context-param>

  <context-param>
    <param-name>public.root</param-name>
    <param-value>/</param-value>
  </context-param>

  <context-param>
    <param-name>jruby.min.runtimes</param-name>
    <param-value>2</param-value>
  </context-param>

  <context-param>
    <param-name>jruby.max.runtimes</param-name>
    <param-value>4</param-value>
  </context-param>

  <listener>
    <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
  </listener>

  <servlet>
    <servlet-name>Rails</servlet-name>
    <servlet-class>org.jruby.rack.RackServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>Rails</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>


  <servlet>
      <servlet-name>ImageServlet</servlet-name>
      <servlet-class>net.sf.jasperreports.j2ee.servlets.ImageServlet</servlet-class>
  </servlet>

  <servlet-mapping>
      <servlet-name>ImageServlet</servlet-name>
      <url-pattern>/servlets/image</url-pattern>
  </servlet-mapping>

  <security-constraint>
      <web-resource-collection>
          <web-resource-name>Forbidden</web-resource-name>
          <url-pattern>/*</url-pattern>
          <http-method>DELETE</http-method>
          <http-method>TRACE</http-method>
          <http-method>OPTIONS</http-method>
      </web-resource-collection>
      <auth-constraint />
  </security-constraint>

</web-app>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

看起来jruby-rack是问题所在。我使用的鸣鸟的版本真的很旧,所以我最终升级到1.4.9,将jruby-rack升级到jruby-rack-1.1.20.jar。