在GWT2.4中使用Locator和ServiceLocator时出现一些错误
无法验证此方法,因为返回类型 (XXXProxy) 的域映射无法解析为域类型添加 @SuppressWarnings("requestfactory") 以关闭。
从 GWT 2.4 开始,RequestFactory 接口必须先经过验证,然后才能由 RequestFactory 服务器代码或基于 JVM 的客户端使用。本文档解释了验证这些接口的机制。
根据 http://code.google.com/p/google-web -toolkit/wiki/RequestFactoryInterfaceValidation
我已经完成了,但在 Proxy 和 Request 类中出现了一些错误。 像这样:
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()。
帮助!我已经通过使用在实体类中实现服务 但无法通过Using Locator和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();
}
错误[调试使用服务器上的方法]
com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost 严重:意外错误 java.lang.RuntimeException:必须为 com.geogre.shared.DemoRfLocateRequestFactory RequestFactory 类型运行 RequestFactory ValidationTool 在 com.google.web.bindery.requestfactory.vm.impl.Deobfuscator$Builder.load(Deobfuscator.java:59) 在 com.google.web.bindery.requestfactory.server.ResolverServiceLayer.updateDeobfuscator(ResolverServiceLayer.java:43) 在com.google.web.bindery.requestfactory.server.ResolverServiceLayer.resolveRequestFactory(ResolverServiceLayer.java:176) 在com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172) 在com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172) 在com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法) 在 sun.reflect.NativeMethodAccessorImpl.invoke(来源未知) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(来源未知) 在 java.lang.reflect.Method.invoke(来源未知) 在 com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:233) 在com.google.web.bindery.requestfactory.server.ServiceLayerCache.resolveRequestFactory(ServiceLayerCache.java:198) 在 com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:207) 在 com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:127) 在 com.google.web.bindery.requestfactory.server.RequestFactoryServlet.doPost(RequestFactoryServlet.java:133) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:637) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 在 org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) 在 org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) 在 org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) 在 org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) 在 org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) 在 org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) 在 org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 在 org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) 在 org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 在 org.mortbay.jetty.Server.handle(Server.java:324) 在 org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) 在 org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843) 在 org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) 在 org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) 在 org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) 在 org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) 在 org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) 编译指示:无缓存 缓存控制:无缓存 响应标头 内容类型:text/html;字符集=iso-8859-1 内容长度:1420
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎在几个方面错误地使用了 @ServiceName 注释。如果您想提及类文字,请使用@Service 代替
如果您想使用@ServiceName,则需要完整的包名称
@ProxyFor 和@ProxyForName 也是如此,您似乎也使用了错误。
无论如何,您不能使 RequestContext 的服务指向代理 - 它可能应该指向 User,而不是 UserProxy。
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
If you want to use @ServiceName, you need the full package name
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.