Maven-generated GWT Servlet not Responding
I used the GWT Maven plug-in (version 2.3.0) to generate a GWT project. The nice thing about that is that the Maven plug-in takes care of generating the async part of the service. Everything appears to work but the servlet is not responding both when running in hosted mode (running in Jetty) and when deploying the resulting WAR to Tomcat.
My problem is now that the servlet is simply not responding. The onSuccess()
callback is invoked but all I get are null
values. I pretty much copied the tutorial from the GWT homepage, so my service is created in the this way:
final StatusServiceAsync statusService = GWT.create(StatusService.class);
Here is my service interface:
@RemoteServiceRelativePath("status")
public interface StatusService extends RemoteService
{
String getStatus(String someInput);
}
As already mentioned, the async counterpart is generated by the Maven plug-in. The web.xml looks like this:
<servlet>
<servlet-name>statusServlet</servlet-name>
<servlet-class>my.package.StatusServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>statusServlet</servlet-name>
<url-pattern>/StatusBoard/status</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>StatusBoard.html</welcome-file>
</welcome-file-list>
At first, I thought the configuration is totally wrong so I played around with it a little bit. When I changed the <servlet-class>
value, the servlet container logged an ClassNotFoundException
. Then I changed the @RemoteServiceRelativePath
I also got an error. So the configuration can't be totally wrong.
Here is the server-side code (I stripped it down to see that nothing else could go wrong):
public class StatusServiceImpl extends RemoteServiceServlet implements StatusService
{
private static final long serialVersionUID = 3317511632727461036L;
@Override
p开发者_JAVA技巧ublic String getStatus(final String someInput)
{
return someInput;
}
}
Sorry that I forgot that detail but sometimes, the debugger doesn't recognize the breakpoint in the servlet. But even when it does, the returned value is still null
.
Any ideas are much appreciated!
By default, your GWT app has a base URL from the module name. If you have used the "rename-to" attribute in your gwt.xml file, then that value will be your base URL. In this case, looking at your web.xml entries, your module should be named "StatusBoard." Or change your URL to your "rename-to" value.
精彩评论