我有一个GWT webapp,它使用了一个RequestFactory - 应用程序似乎启动得很好,但是一旦我尝试在浏览器中打开它,就会出现这种异常:
com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost
SEVERE: Unexpected error
java.lang.ClassCastException: class com.myapp.console.shared.MyAppRequestFactoryDeobfuscatorBuilder
at java.lang.Class.asSubclass(Class.java:3126)
at com.google.web.bindery.requestfactory.vm.impl.Deobfuscator$Builder.load(Deobfuscator.java:52)
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 com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveRequestFactory(ServiceLayerDecorator.java:172)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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)
....
MyAppRequestFactoryDeobfuscatorBuilder类是自动生成的(我的类是MyAppRequestFactory),因此它很难调试。几周前,当我上次使用此应用程序时,这种情况不常发生。导致此错误的原因是什么?如何解决?我不是GWT专家,所以我会很感激小词和可理解的解释!
答案 0 :(得分:0)
这可能是一个类加载器问题,Deobfuscator.Builder
是从MyAppRequestFactoryDeobfuscatorBuilder
的不同(和兄弟或子,而不是父)类加载器加载的,因此Deobfuscator.Builder
父类{{1}与尝试加载它的MyAppRequestFactoryDeobfuscatorBuilder
类不同。
你在现在和现在之间做了什么改变吗?
(注意:GWT 2.6.0's DevMode has a classloader issue,所以如果您更新到GWT 2.6.0并且没有严格遵循预期的项目布局 - 您的Deobfuscator.Builder
和/或编译后的类中缺少一些库在WEB-INF/lib
- 然后你可以运行这样的问题)