简体   繁体   中英

Play Framework + tomcat

I need to run the play framework application on 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

<?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

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? 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. 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. 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.

I did not need to use context, or 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

  • Tomcat 7
  • Java 6
  • and Windows 7.

I suspect that your issue is with the naming of your ROOT.war file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM