Playframework + Tomcat部署问题 [英] Playframework + Tomcat Deployment issue

查看:116
本文介绍了Playframework + Tomcat部署问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Tomcat中部署在play框架中开发的Web应用程序.尝试的前几次,我在Tomcat控制台中收到以下消息,

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

因此,我从play war文件中手动删除了geronimo-servlet_2.5_spec-1.2.jar.完成后,我会看到以下成功消息,

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 !

当我尝试使用url http://localhost:8080/play-sandbox <>从IE访问应用程序时/a>我收到一个404,上面写着请求的资源(/play-sandbox/)不可用".

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

我正在Tomcat 7中运行此程序,并且tomcat日志已清除.我用

I am running this in Tomcat 7 and the tomcat logs are clear. I use

 play war play-sandbox -o sandbox.war

发动战争

问题是

  1. 如何防止geronimo-servlet_2.5_spec-1.2.jar冲突?
  2. 为什么在Tomcat部署中无法通过浏览器查看应用程序?在运行时{app name}可以正常运行.

  1. How do I prevent the geronimo-servlet_2.5_spec-1.2.jar conflict?
  2. Why am I unable to view the app via browser in Tomcat deployment? Where as play run {app name} works all fine.

相同的war文件在glassfish服务器中似乎也可以正常工作.我认为这与playframework应用程序的上下文路径或应用程序隔离有关.任何帮助将不胜感激.

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.

谢谢, 阿比

推荐答案

您是否尝试过Tomact的早期版本?根据部署矩阵,Play不正式"支持Tomact 7,因此这可能是问题的一部分.参见 http://www.playframework.org/documentation/1.2.1/deployment

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

对于为什么当您执行play run appname时应用程序能够工作而不是通过tomcat进行部署的原因,原因是部署完全不同. Play不是Java EE兼容框架.它选择不沿用Servlet规范路线,因为它感觉太复杂,肿胀并且受他们想要玩Play的限制.这就是为什么您没有Session和其他Java EE核心功能之类的原因.

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.

因此,要使Play在Servlet容器中工作,需要将Play应用程序包装在将应用程序公开为Servlet兼容应用程序的包装器中,然后将其全部移动到WAR文件中.但是,您确实会丢失标准Play应用程序的某些功能.

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.

我会建议Play开发人员(如果可能的话)始终使用Play应用程序服务器,以充分利用您的应用程序并简化部署!

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!

这篇关于Playframework + Tomcat部署问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆