I am trying to deploy a web app developed in play framework in Tomcat. The first few times I tried, I got the following message in the Tomcat console,
INFO: validateJarFile(C:\Tomcat7\webapps\sandbox.war\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
So I manually removed the geronimo-servlet_2.5_spec-1.2.jar from the play war file. And once that is done, I see the following success message,
13:56:43,571 INFO ~ Starting C:\Tomcat7\webapps\sandbox.war\WEB-INF\application
13:56:43,618 INFO ~ Application is precompiled
13:56:44,149 INFO ~ Connected to jdbc:mysql://localhost/db?useUnicode=yes&ch aracterEncoding=UTF-8&connectionCollation=utf8_general_ci
13:56:44,899 INFO ~ Application 'play-sandbox' is now started !
When I try to access the application from IE using the url http://localhost:8080/play-sandbox I am getting a 404 that says "The requested resource (/play-sandbox/) is not available".
I am running this in Tomcat 7 and the tomcat logs are clear. I use
play war play-sandbox -o sandbox.war
to generate the war
The questions are,
- How do I prevent the geronimo-servlet_2.5_spec-1.2.jar conflict?
Why am I unable to view the app via browser in Tomcat deployment? Where as play run {app name} works all fine.
The same war file seems working perfectly fine in glassfish server as well. I believe this has something to do with the context path of the playframework application or isolation of the application. Any help would be appreciated.
Thanks, Abi
First I had the same problem like you when I deployed a play webapp to Tomcat 7, but then I got it running:
Have you tried an earlier version of Tomact? According to the deployment matrix, Play does not 'officially' support Tomact 7, so that may be part of the problem. See here http://www.playframework.org/documentation/1.2.1/deployment
As for why the application works when you do
play run appname
and not when you deploy through tomcat, is that the deploment is completely different. Play is not a Java EE compliant framework. It chose not to go down the Servlet spec route, as it felt it was too complicated, bloated and restricted where they wanted to take Play. This is why you don't have things like the Session and other Java EE core functions.Therefore, to get Play to work in a Servlet container, it is required to wrap the Play application in a wrapper that exposes the application as a Servlet compliant application, and move it all into a WAR file. You do however lose some of the features of a standard Play application.
The Play Devs, and I for that matter, would recommend always using the Play application server to get the most out of your application and to ease the deployment, if possible!