[英]Play Framework + tomcat
I need to run the play framework application on tomcat.我需要在 tomcat 上运行播放框架应用程序。 i just made
我刚做了
./play war ganshla-ganshla -o ROOT.war --%production
then i add META-INF folder (because i tryed whithout it and got 404) i put context.xml into META_INF然后我添加 META-INF 文件夹(因为我尝试了它并得到 404)我将 context.xml 放入 META_INF
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/ROOT"/>
So now i have an error on the page:所以现在我在页面上有一个错误:
Application.index action not found未找到 Application.index 操作
in the server log i have:在服务器日志中我有:
play.exceptions.ActionNotFoundException: Action Application.index not found
at play.mvc.ActionInvoker.getActionMethod(ActionInvoker.java:582)
at play.mvc.ActionInvoker.resolve(ActionInvoker.java:84)
at play.server.ServletWrapper$ServletInvocation.getInvocationContext(ServletWrapper.java:540)
at play.Invoker$Invocation.init(Invoker.java:193)
at play.Invoker$DirectInvocation.init(Invoker.java:292)
at play.server.ServletWrapper$ServletInvocation.init(ServletWrapper.java:508)
at play.Invoker$Invocation.run(Invoker.java:263)
at play.server.ServletWrapper$ServletInvocation.run(ServletWrapper.java:525)
at play.Invoker.invokeInThread(Invoker.java:67)
at play.server.ServletWrapper.service(ServletWrapper.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
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:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
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:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.Exception: Controller controllers.Application not found
... 23 more
04:07:37,225 WARN ~ 404 -> GET / (Application.index action not found)
UPDATE:更新:
tryed to make as discribed here how to use "war.context" in Configuration file of Play Framework?尝试按照此处的说明制作如何在 Play Framework 的配置文件中使用“war.context”? and now i have empty page and this entry in log
现在我有空页和日志中的这个条目
INFO: Deploying web application archive ROOT.war
Jun 1, 2011 4:33:29 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/ganshla2/jvm/apache-tomcat-6.0.14/domains/ganshla-ganshla.com/ROOT/WEB-INF/lib/geronimo-servlet_2.5_spec-1.2.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
04:33:36,470 INFO ~ Starting /home/ganshla2/jvm/apache-tomcat-6.0.14/domains/ganshla-ganshla.com/ROOT/WEB-INF/application
04:33:37,265 INFO ~ Application is precompiled
I am not sure that you need to worry about the Play context, as you are running your application as the ROOT.我不确定您是否需要担心 Play 上下文,因为您将应用程序作为 ROOT 运行。 I tried this myself on one of my applications and it seemed to work fine, however the deployment options I used was slightly different.
我自己在我的一个应用程序上尝试了这个,它似乎工作正常,但是我使用的部署选项略有不同。
The steps I took are我采取的步骤是
play new wartest
I then edited the index.html
to show that something 'real' was getting deployed.然后我编辑了
index.html
以显示正在部署一些“真实”的东西。 So I just added a few lines of code, below.所以我只是在下面添加了几行代码。
#{extends 'main.html' /}
#{set title:'Home' /}
Welcome to my first tomcat-play application.
Finally I created the file to deploy.最后我创建了要部署的文件。
play war wartest -o ROOT
This creates an exploded WAR file, and allows me to simply drop it into the Tomtact Webapps directory.这将创建一个展开的 WAR 文件,并允许我将其简单地放入 Tomtact Webapps 目录中。
I did not need to use context, or META-INF.我不需要使用上下文或 META-INF。 This was a simple test just to see it working, but as your app is not even showing the index page, I doubt you are even getting as far as my simple test has.
这是一个简单的测试,只是为了看看它是否有效,但由于您的应用程序甚至没有显示索引页面,我怀疑您是否已经达到了我的简单测试所达到的程度。
I tested this using我测试了这个
I suspect that your issue is with the naming of your ROOT.war file.我怀疑您的问题与您的 ROOT.war 文件的命名有关。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.