将GWT部署到Tomcat(servlet未运行) [英] Deploy GWT to Tomcat (servlet not running)

查看:124
本文介绍了将GWT部署到Tomcat(servlet未运行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将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,但现在肯定知道它在哪里)。

所以你有两个选择:


  1. 告诉客户端在'/ mygwtapp / mygwtapp / *'处调用servlet(我认为,在使用@RemoteServiceRelativePath注解时,这已经自动处理了)

  2. 调整Web应用程序的上下文路径在Tomcat中,如 http://tomcat.apache.org/tomcat -6.0-doc / config / context.html


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:

  1. Tell the client side to call the servlets at '/mygwtapp/mygwtapp/*' (I think, this is already taken care of automatically when using the @RemoteServiceRelativePath annotation)
  2. Adjust the Context path of the web application in Tomcat, as explained in http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

这篇关于将GWT部署到Tomcat(servlet未运行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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