将GWT部署到Tomcat(servlet未运行) [英] Deploy GWT to Tomcat (servlet not running)
问题描述
将GWT应用部署到Tomcat的正确方法是什么?我用服务器端代码(servlet)制作了一个GWT应用程序。它在托管模式下工作,但只有当我将WAR文件夹(在编译之后)复制到Tomcat webapp目录并正确地重命名war文件夹时。
我的GWT应用程序servlet位于URI / mygwtapp,所以我重命名了文件夹mygwtapp。应用程序正确加载servlet不运行的问题ie / mygwtapp / servlet不运行。
服务器端代码所需的所有库都位于WEB- INF / lib文件夹。这可能是什么原因?
谢谢。 默认情况下,Tomcat从上下文路径'/ mygwtapp'提供名为'mygwtapp'的应用程序。 (而GWT内置的jetty通过上下文路径提供服务)//.
您的servlet路径通常是'/ mygwtapp / *'。这意味着,结合上下文路径,您的servlet现在可以从'/ mygwtapp / mygwtapp / *'访问。 (试一试:只需在浏览器中输入完整的URL-- Servlet通常会抱怨缺少某些东西,或者它不支持GET,但现在肯定知道它在哪里)。 所以你有两个选择: What is the correct way to deploy a GWT app to Tomcat? I have made a GWT app with server side code (servlets). It works in Hosted mode but only when I copy the WAR folder (after compiling) to Tomcat webapp directory and rename the war folder correctly. My GWT app servlet is in URI /mygwtapp, so I renamed the folder mygwtapp. The app loads correctly with the problem that servlet do not run i.e. /mygwtapp/servlet does not run. All the libraries needed by the server side code are in the WEB-INF/lib folder. What could be the reason for this? Thanks. By default, Tomcat serves an app named 'mygwtapp' from the context path '/mygwtapp'. (Whereas the GWT built-in jetty serves it from the context path '/'.) Your servlet paths will usually be '/mygwtapp/*'. This means, that in conjunction with the context path, your servlets are now accessible from '/mygwtapp/mygwtapp/*'. (Try it: Simply enter the full URL in your browser - the Servlet will usually complain that something is missing, or that it doesn't support GET, but you'll know for sure now, where it lives.) So you have two options:
这篇关于将GWT部署到Tomcat(servlet未运行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!