GWT 错误:必须运行 RequestFactory ValidationTool
Posted
技术标签:
【中文标题】GWT 错误:必须运行 RequestFactory ValidationTool【英文标题】:GWT Error: RequestFactory ValidationTool must be run 【发布时间】:2013-04-28 17:45:40 【问题描述】:每次我启动我的应用程序时,即使未执行 listEmptyBoxes(),我也会收到“必须运行 RequestFactory 验证工具...”错误。我已经有关于注释处理的文件requestfactory-apt-2.5.0-rc1.jar
。
有什么想法吗?在我的代码下面。谢谢。
MyProject.java
private void listEmptyBoxes()
BoxRequest boxRequest = requestFactory.boxRequest();
boxRequest.listAllEmpty().fire(new Receiver<List<BoxProxy>>()
public void onSuccess(List<BoxProxy> response) // List all phantom boxes
Window.alert("Successful");
);
BoxRequest.java
@Service(value=BoxDao.class, locator=DaoServiceLocator.class)
public interface BoxRequest extends RequestContext
Request<List<BoxProxy>> listAllEmpty();
BoxDao.java
public class BoxDao extends ObjectifyDao<Box>
public List<Box> listAllEmpty()
Objectify ofy = ObjectifyService.begin();
Query<Box> q=ofy.query(Box.class).filter("title", null).filter("description", null);
List<Box> results = q.list();
return results;
错误
04-may-2013 12:29:18 com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost
GRAVE: Unexpected error
java.lang.RuntimeException: The RequestFactory ValidationTool must be run for the com.gw.myProject.shared.myProjectRequestFactory RequestFactory type
at com.google.web.bindery.requestfactory.vm.impl.Deobfuscator$Builder.load(Deobfuscator.java:57)
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.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115)
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:215)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:135)
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:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:66)
at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.DevAppServerServersFilter.doDirectRequest(DevAppServerServersFilter.java:369)
at com.google.appengine.tools.development.DevAppServerServersFilter.doDirectServerRequest(DevAppServerServersFilter.java:352)
at com.google.appengine.tools.development.DevAppServerServersFilter.doFilter(DevAppServerServersFilter.java:115)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:94)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:421)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
04-may-2013 12:29:19 com.google.appengine.api.datastore.dev.LocalDatastoreService init
【问题讨论】:
【参考方案1】:使用以下步骤-
-
右键单击项目
点击Java编译器
启用项目特定设置
选择注解处理
启用项目特定设置
选择工厂路径
添加Jar->添加requestfactory-apt.jar文件->确定->确定
完成
【讨论】:
您也必须将 requestfactory-apt.jar 添加到 WEB-INF\lib 目录中。【参考方案2】:从 GWT 2.4 开始,必须验证 RequestFactory 接口。那么,你认真关注instructions了吗?在那里您可以找到 Eclipse/IntelliJ 以及 Maven/Ant 命令行步骤(也可以在 cmets 中查看)。
验证工具的输出是一个名为"YourRequestFactoryName"DeobfuscatorBuilder.class
的类文件,它在WEB-INF/classes
目录中生成,旁边是"YourRequestFactoryName".class
。所以检查它的存在,你会确定验证工具已经运行(或删除它以确保它必须运行)。
【讨论】:
我尝试了所有这些,但仍然遇到同样的错误。完全陷入困境:( 我没有看到“YourRequestFactoryName”DeobfuscatorBuilder.class。【参考方案3】:instruction 现在看起来很老了。使用最新的maven-compiler-plugin
3.* 运行RequestFactory ValidationTool
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.web.bindery</groupId>
<artifactId>requestfactory-apt</artifactId>
<version>2.6.1</version>
</dependency>
</dependencies>
</plugin>
【讨论】:
以上是关于GWT 错误:必须运行 RequestFactory ValidationTool的主要内容,如果未能解决你的问题,请参考以下文章