Gal Bracha
Gal Bracha

Reputation: 20011

In Gwt's request factory, What is ReportableException: The requested type is not default-instantiable

Today we started getting this unknown error in production

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)

We are using GWT 2.4, Not sure what JRE we are running on the deployment.

The only result I've found for this error was the actual source code:

http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/requestfactory/server/ReflectiveServiceLayer.java?r=9271

Investigating the source code around the error, we've found that The createDomainObject() on line #74 indicates that it tries to initiate a constructor for some object but fails, as a NoSuchMethodException raises (line #82) and then a call to report method with this output. Could be something with changed class / jar file.

The problem here that it's not deterministic, sometimes it works while other times it fails, running the same code (Initiated by a call from a data grid on the client side).

Upvotes: 1

Views: 1036

Answers (3)

Gal Bracha
Gal Bracha

Reputation: 20011

The problem was with one of the proxy we used, DoubleRangeProxy. that was proxy for Apache's DoubleRange class.

The class didn't had a default constructor, and we we're warned about it in compile time:

/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.

So we replaced the class with our own class, and added a default constructor.

The lesson is as always, read (and don't ignore) compile time warnings.

Upvotes: 6

Navneeth G
Navneeth G

Reputation: 7305

Make sure the no-arg constructor is visible by making it public.

Upvotes: 1

Riley Lark
Riley Lark

Reputation: 20890

This might happen if you either removed a no-arg constructor or added a no-arg constructor to a class. Every class that RF will work with must have a no-arg constructor (or no constructor) defined.

Upvotes: 1

Related Questions