开发者

Problems with deploying GWT with RPC to tomcat (web.xml problem probably)

My gwt app that uses mysql database runs normaly in eclipse when debugging. When i run it on tomcat, it displays correctly but when i click on a b开发者_JAVA技巧utton that makes a RPC (executes servlet and contacts the database) i get an error. I checked my tomcat log and i see 404 error when clicking on a button:

0:0:0:0:0:0:0:1 - - [22/Jul/2010:10:32:39 +0200] "GET /Bazica/war/Bazica.html HTTP/1.1" 304 -
0:0:0:0:0:0:0:1 - - [22/Jul/2010:10:32:39 +0200] "GET /Bazica/war/Bazica.css HTTP/1.1" 304 -
0:0:0:0:0:0:0:1 - - [22/Jul/2010:10:32:39 +0200] "GET /Bazica/war/bazica/bazica.nocache.js HTTP/1.1" 304 -
0:0:0:0:0:0:0:1 - - [22/Jul/2010:10:32:39 +0200] "GET /Bazica/war/bazica/    F0C186B415ADBD43522C686552368517.cache.html HTTP/1.1" 304 -
0:0:0:0:0:0:0:1 - - [22/Jul/2010:10:32:39 +0200] "GET /Bazica/war/bazica/gwt/standard/images/hborder.png    HTTP/1.1" 304 -
0:0:0:0:0:0:0:1 - - [22/Jul/2010:10:33:29 +0200] "POST /Bazica/war/bazica/greet HTTP/1.1" 404 1024

I guess this is a problem with web.xml file and url-pattern. I guess i don't understand this url-pattern, where should it point to?

Web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

 <!-- Servlets -->
 <servlet>
 <servlet-name>greetServlet</servlet-name>
 <servlet-class>com.test.baze.server.GreetingServiceImpl</servlet-class>
 </servlet>

 <servlet-mapping>
 <servlet-name>greetServlet</servlet-name>
 <url-pattern>/bazica/greet</url-pattern>
 </servlet-mapping>

 <!-- Default page to serve -->
 <welcome-file-list>
 <welcome-file>Bazica.html</welcome-file>
 </welcome-file-list>

 </web-app>

My interface has an annotation RemoteServiceRelativePath("greet"), i think it's relevant:

package com.test.baze.client;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
* The client side stub for the RPC service.
*/
@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService {
String greetServer(String name) throws IllegalArgumentException;
}

I tried changing url-pattern to the folder of my service implementation /WEB-INF/classes/com/test/baze/server but my app hangs with no message. Could you please help me change my web.xml or sth. else to get my app working on a Tomcat. Tnx.


If you take a look at the docs, your URL pattern should be:

<url-pattern>/module_name/greet</url-pattern>

But in your web.xml, you've set the module name to "bazica". Are you renaming the module in your GWT module file (.gwt.xml file) to bazica? If you're not, you'll either have to rename it or use the full path to the GWT module file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜