8
votes

In my GWT project running in glassfishv3, everything is worked properly, but when I change my servlet url patterns mapping from web.xml to @WebServlet annotation inside servlet classes, GWT rpc cand find the servlet!

note that, other usual servlets work with this annotation(WebServlet) and just GWT RPC doesnt work.

what is the reason?

RGDS

2
please note that other usual Servlets work properly with this annotation and just GWT RPC have problemNav
Did you ever get an answer on this?icfantv

2 Answers

6
votes

Did you set the version number of web-app in the web.xml to the correct servlet version, because this feature is available only since 3.0:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      version="3.0"> 
4
votes

Ok, I finally got this working but with some caveats. I was able to get it working in Tomcat within Intellij and as a deployed WAR to a Tomcat 7 container.

I was NOT able to get it working in dev-mode without using -noserver. I believe this is because the built-in Jetty server is not JSR315 compatible but have no evidence of this as I've not tried to determine what version of jetty is in the gwt-dev jar.

The trick is you need to fully qualify the path in WebServlet. So if your remote service interface has the relative path of "bar" and your module name (rename-to in gwt.xml) is "foo" then the path you need to set the path of "/foo/bar" in WebServlet and it will work.