0

好的 - 新玩!框架。我的项目在内置 Play 服务器上运行良好。我正在尝试将相同的项目部署到运行 Tomcat 7 的服务器上,但在 catalina.out 日志中出现以下错误:

@6fn1ak9n6
Application.index action not found

Action not found
Action Application.index could not be found. Error raised is Controller controllers.Application not found

play.exceptions.ActionNotFoundException: Action Application.index not found
        at play.mvc.ActionInvoker.getActionMethod(ActionInvoker.java:599)
        at play.mvc.ActionInvoker.resolve(ActionInvoker.java:85)
        at play.server.ServletWrapper$ServletInvocation.getInvocationContext(ServletWrapper.java:567)
        at play.Invoker$Invocation.init(Invoker.java:205)
        at play.Invoker$DirectInvocation.init(Invoker.java:305)
        at play.server.ServletWrapper$ServletInvocation.init(ServletWrapper.java:535)
        at play.Invoker$Invocation.run(Invoker.java:276)
        at play.server.ServletWrapper$ServletInvocation.run(ServletWrapper.java:552)
        at play.Invoker.invokeInThread(Invoker.java:68)
        at play.server.ServletWrapper.service(ServletWrapper.java:143)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.Exception: Controller controllers.Application not found
        ... 27 more
13:17:13,090 WARN  ~ 404 -> GET /tradjenta/ (Application.index action not found)
13:17:13,093 ERROR ~

@6fn1ak9n9
Internal Server Error (500)

No route found (In /app/views/errors/404.html around line 5)
No route able to invoke action Application.index was found.

play.exceptions.NoRouteFoundException: No route found
        at play.templates.BaseTemplate.throwException(BaseTemplate.java:82)
        at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:257)
        at play.templates.Template.render(Template.java:26)
        at play.templates.GroovyTemplate.render(GroovyTemplate.java:202)
        at play.server.ServletWrapper.serve404(ServletWrapper.java:373)
        at play.server.ServletWrapper$ServletInvocation.init(ServletWrapper.java:537)
        at play.Invoker$Invocation.run(Invoker.java:276)
        at play.server.ServletWrapper$ServletInvocation.run(ServletWrapper.java:552)
        at play.Invoker.invokeInThread(Invoker.java:68)
        at play.server.ServletWrapper.service(ServletWrapper.java:143)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:679)

我的 web.xml 文件如下所示:

<?xml version="1.0" ?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
        version="2.4">

  <display-name>Play! (MyApp)</display-name>

  <context-param>
    <param-name>play.id</param-name>
    <param-value>war</param-value>
  </context-param>

  <listener>
      <listener-class>play.server.ServletWrapper</listener-class>
  </listener>

  <servlet>
    <servlet-name>play</servlet-name>
    <servlet-class>play.server.ServletWrapper</servlet-class>   
  </servlet>

  <servlet-mapping>
    <servlet-name>play</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

</web-app>

为什么路由在 Play Server 中可以正常工作,但在 Tomcat 中却不行?我需要在 web.xml 文件中声明 conf/routes 文件吗?

4

0 回答 0