ZhouChang Xu
ZhouChang Xu

Reputation: 3

Some errors when Using Locator and ServiceLocator in GWT2.4

Cannot validate this method because the domain mapping for the return type (XXXProxy) could not be resolved to a domain type Add @SuppressWarnings("requestfactory") to dismiss.

Starting with GWT 2.4, RequestFactory interfaces must be validated before they can be used by the RequestFactory server code or JVM-based clients. This document explains the mechanisms for validating those interfaces.

according to http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation

I have done but came out some error in Proxy and Request class. like that:

Cannot validate this method because the domain mapping for the return   type (XXXProxy) could not be resolved to a domain type Add @SuppressWarnings("requestfactory") to dismiss.
Could not find domain method similar to java.lang.Integer countUsers()。

Help!I have passed for using Implementing a service in an entity class but can't pass Using Locator and ServiceLocator.

Mycode:

@ServiceName(value="UserProxy.class", locator="UserServiceLocator.class")
public interface UserServiceRequest extends RequestContext {

    Request<Integer> countUsers();
    Request<Void> generateUsers();
    Request<List<UserProxy>> findAllUsers();
    InstanceRequest<UserProxy, Void> persist();
    InstanceRequest<UserProxy, Void> remove();

}

@ProxyForName(value = "User.class", locator = "UserLocator.class")
public interface UserProxy extends EntityProxy {

    //...setter and getter

    EntityProxyId<UserProxy> stableId();

}

error [debug to use method on server]

com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost 严重: Unexpected error java.lang.RuntimeException: The RequestFactory ValidationTool must be run for the com.geogre.shared.DemoRfLocateRequestFactory RequestFactory type at com.google.web.bindery.requestfactory.vm.impl.Deobfuscator$Builder.load(Deobfuscator.java:59) at com.google.web.bindery.requestfactory.server.ResolverServiceLayer.updateDeobfuscator(ResolverServiceLayer.java:43) at com.google.web.bindery.requestfactory.server.ResolverServiceLayer.resolveRequestFactory(ResolverServiceLayer.java:176) at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172) at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172) at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:233) at com.google.web.bindery.requestfactory.server.ServiceLayerCache.resolveRequestFactory(ServiceLayerCache.java:198) at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:207) at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:127) at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.doPost(RequestFactoryServlet.java:133) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) Pragma: no-cache Cache-Control: no-cache Response headers Content-Type: text/html; charset=iso-8859-1 Content-Length: 1420

Upvotes: 0

Views: 2770

Answers (1)

Colin Alworth
Colin Alworth

Reputation: 18331

You seem to be using the @ServiceName annotation incorrectly, in a couple of ways. If you want to mention a class literal, use @Service instead

@Service(value=MyServiceType.class, locator=MyServiceLocator.class)

If you want to use @ServiceName, you need the full package name

@ServiceName(value="com.company.server.MyServiceType", locator="com.company.gwt.MyServiceLocator")

The same is true for @ProxyFor and @ProxyForName, which you also seem to be using incorrectly.

In any case, you can't make the RequestContext's service point to a proxy - it should probably point to User, not UserProxy.

Upvotes: 2

Related Questions