GWT Tomcat问题到RPC调用 [英] GWT Tomcat problem to RPC call

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

问题描述

当我将war文件部署到TOMCAT(tomcat / webapps / ROOT / war)时,GWT RPC调用似乎不起作用。

它给我一个错误:


请求的资源
(/ war / myproject / call)不是
可用。


如果我改变目录结构,然后直接部署war内容(不是war目录本身),比如(tomcat / webapps / ROOT / project.html,project.css,project等),那么它就可以工作。

继续?



我认为可能有问题:

  < servlet的> 
< servlet-name> callServlet< / servlet-name>
< servlet-class> com.myproject.server.dao.Call< / servlet-class>
< / servlet>

< servlet-mapping>
< servlet-name> callServlet< / servlet-name>
< url-pattern> / myproject / call< / url-pattern>
< / servlet-mapping>


解决方案

事情是,单个Tomcat服务器可以有多个部署的应用程序,每个应用程序都位于其所谓的上下文中。应用程序部署在 webapps 文件夹中,每个文件夹映射到一个 context ,而 ROOT 文件夹是默认的(无上下文)。

要访问Tomcat上的应用程序,您需要在URL后面指定 context 。例如,如果您在 webapps / Test 文件夹中有一个应用程序(上下文) Test ,您可以像这样访问它:

  http:// localhost:8080 / Test 

但是 ROOT 文件夹中的应用程序没有上下文,只需转到 localhost:8080 。这是你的情况。 Tomcat直接在 ROOT 文件夹中查找应用程序,但是您的应用程序位于 ROOT / war 文件夹中。换句话说,RPC调用期望 myproject 文件夹位于 ROOT 文件夹下,而不在<$ c下$ c> ROOT / war 文件夹。这就是为什么它不起作用。



如果你仍然希望在 war 文件夹> ROOT 文件夹,您必须将 url-pattern 更改为 / war / myProject / call


GWT RPC call don't seems to work when i deploy my war file to TOMCAT (tomcat/webapps/ROOT/war).

It gives me an error:

The requested resource (/war/myproject/call) is not available.

If i change the directory structure and then deploy directly war contents (not war directory itself), like (tomcat/webapps/ROOT/project.html, project.css, project, etc...) then it works.

Can someone please explain me whats going on?

I think there might a problem at:

<servlet>
<servlet-name>callServlet</servlet-name>
<servlet-class>com.myproject.server.dao.Call</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>callServlet</servlet-name>
<url-pattern>/myproject/call</url-pattern>
</servlet-mapping>

解决方案

The thing is that a single Tomcat server can have multiple applications deployed, each in its so-called context. The applications are deployed in the webapps folder and each folder is mapped to one context, while the ROOT folder is the default (no-context).

To access an application on Tomcat, you specify the context after the URL. For example if you had an application (context) Test in webapps/Test folder, you would access it like this:

http://localhost:8080/Test

But applications in the ROOT folder have no context and are accessed by simply going to localhost:8080. And this is your case. Tomcat is looking for you application directly in the ROOT folder but you have your app in the ROOT/war folder. In other words, the RPC call expects the myproject folder to be under the ROOT folder and not under the ROOT/war folder. That's why it's not working.

If you still wanted to have your war folder within the ROOT folder, you would have to change the url-pattern to /war/myProject/call.

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

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