今天我们开始在生产中收到这个未知错误
2012 02 06 08:19:39,270 ERROR GWTSpringRequestFactoryServlet$CustomExceptionHandler:34 – Server error
com.google.web.bindery.requestfactory.server.ReportableException: The requested type is not default-instantiable
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.report(ServiceLayerDecorator.java:255)
at com.google.web.bindery.requestfactory.server.ReflectiveServiceLayer.createDomainObject(ReflectiveServiceLayer.java:94)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.createDomainObject(ServiceLayerDecorator.java:51)
at com.google.web.bindery.requestfactory.server.LocatorServiceLayer.createDomainObject(LocatorServiceLayer.java:41)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.createDomainObject(ServiceLayerDecorator.java:51)
at com.google.web.bindery.requestfactory.server.RequestState.getBeansForIds(RequestState.java:238)
at com.google.web.bindery.requestfactory.server.RequestState.getBeansForPayload(RequestState.java:147)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.processOperationMessages(SimpleRequestProcessor.java:501)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:210)
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.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:662)
我们正在使用GWT 2.4,不确定我们在部署中运行的是什么JRE。
我发现此错误的唯一结果是实际的源代码:
调查错误的源代码,我们发现第74行的createDomainObject()表示它尝试为某个对象启动构造函数但是失败,因为NoSuchMethodException引发(第82行)和然后使用此输出调用report方法。可能是改变了类/ jar文件的东西。
这里的问题是它不具有确定性,有时它可以正常运行而其他时候运行相同的代码(通过客户端数据网格的调用启动)。
答案 0 :(得分:6)
问题在于我们使用的代理之一DoubleRangeProxy。这是Apache的DoubleRange类的代理。
该类没有默认构造函数,我们在编译时就被警告过:
/home/gal/gwtapp/proxy/DoubleRangeProxy.java:18: warning: The domain type DoubleRange has no default constructor. Calling RequestContext.create(DoubleRangeProxy.class) will cause a server error.
所以我们用自己的类替换了类,并添加了一个默认的构造函数。
课程一如既往,阅读(不要忽略)编译时警告。
答案 1 :(得分:1)
如果您删除了无参数构造函数或向类中添加了无参数构造函数,则可能会发生这种情况。 RF将使用的每个类都必须定义一个无参数构造函数(或无构造函数)。
答案 2 :(得分:1)
通过将no-arg构造函数公开来确保它是可见的。