PDA

View Full Version : Type 'BasePagingLoadConfig' was not assignable to 'IsSerializable'



prakash.ray
18 Apr 2011, 4:06 AM
I'm getting the following exception when I am trying paging.


An IncompatibleRemoteServiceException was thrown while processing this call.
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: Type 'com.extjs.gxt.ui.client.data.BasePagingLoadConfig' was not assignable to 'com.google.gwt.user.client.rpc.IsSerializable' and did not have a custom field serializer. For security purposes, this type will not be deserialized.
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:315)
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:167)
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:124)
at com.healthcare.careweb.server.GWTController.processCall(GWTController.java:52)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at com.healthcare.careweb.server.GWTController.handleRequest(GWTController.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
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$CachedChain.doFilter(ServletHandler.java:1097)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
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:355)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
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)
Caused by: com.google.gwt.user.client.rpc.SerializationException: Type 'com.extjs.gxt.ui.client.data.BasePagingLoadConfig' was not assignable to 'com.google.gwt.user.client.rpc.IsSerializable' and did not have a custom field serializer. For security purposes, this type will not be deserialized.
at com.google.gwt.user.server.rpc.impl.LegacySerializationPolicy.validateDeserialize(LegacySerializationPolicy.java:127)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserialize(ServerSerializationStreamReader.java:549)
at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:119)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader$ValueReader$8.readValue(ServerSerializationStreamReader.java:137)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeValue(ServerSerializationStreamReader.java:384)
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:303)
... 65 more

paging.java


private final static UserServiceAsync userService = GWT.create(UserService.class);
// Content Panel for Overall layout of this Component.
ContentPanel cp = new ContentPanel();
cp.setScrollMode(Scroll.AUTOY);
cp.setHeaderVisible(false);
cp.setFrame(false);
cp.setLayout(new FitLayout());

// Column Configuration
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

ColumnConfig column = new ColumnConfig();
column.setId("id");
column.setHeader("User ID");
column.setHidden(true);
column.setWidth(200);
configs.add(column);

column = new ColumnConfig();
column.setId("username");
column.setHeader("User Name");
column.setWidth(100);
configs.add(column);

// column = new ColumnConfig();
// column.setId("status");
// column.setHeader("Status");
// column.setAlignment(HorizontalAlignment.CENTER);
// column.setRenderer(statusIconRenderer);
// column.setWidth(40);
// configs.add(column);

column = new ColumnConfig();
column.setId("firstName");
column.setHeader("First Name ");
column.setWidth(100);
configs.add(column);

column = new ColumnConfig();
column.setId("lastName");
column.setHeader("Last Name");
column.setWidth(100);
configs.add(column);

column = new ColumnConfig();
column.setId("email");
column.setHeader("Email");
column.setWidth(150);
configs.add(column);

column = new ColumnConfig();
column.setId("createdDate");
column.setHeader("Created On");
// column.setRenderer(dateFormatRenderer);
column.setDateTimeFormat(DateFormatUtils.getDateTimeFormatwithTime());
column.setWidth(120);
configs.add(column);

column = new ColumnConfig();
column.setId("userType");
column.setHeader("User Type");
column.setWidth(150);
column.setRenderer(userTypeRenderer);
configs.add(column);

column = new ColumnConfig();
column.setId("status");
column.setHeader("Status");
column.setWidth(100);
column.setRenderer(statusRenderer);
configs.add(column);

column = new ColumnConfig();
column.setId("roleNameDisplayText");
column.setHeader("Role Name");
column.setWidth(150);
configs.add(column);

column = new ColumnConfig();
column.setId("associatedToDisplayText");
column.setHeader("Associated To");
column.setWidth(150);
configs.add(column);

cm = new ColumnModel(configs);
//**********************************************************************//

RpcProxy<PagingLoadResult<User>> proxy = new RpcProxy<PagingLoadResult<User>>() {

@Override
protected void load(Object loadConfig,
AsyncCallback<PagingLoadResult<User>> callback) {
userService.getTestUsersforOrganizationAdminforOrganizationId(
(PagingLoadConfig)loadConfig, MasterLayoutContainer.getLoggedInUser().getOrganizationId(), callback);
}
};

final BasePagingLoader<PagingLoadResult<?>> loader =
new BasePagingLoader<PagingLoadResult<?>>(proxy, new BeanModelReader());
loader.setRemoteSort(true);

userStore = new ListStore<BeanModel>(loader);

PagingToolBar pagingToolBar = new PagingToolBar(5);
pagingToolBar.bind(loader);

loader.addLoadListener(new LoadListener());


//**********************************************************************//
userGrid = new Grid<BeanModel>(userStore, cm);
userGrid.addListener(Events.RowDoubleClick, new Listener<GridEvent<BeanModel>>() {

@Override
public void handleEvent(GridEvent<BeanModel> be) {

PagingLoadConfig pagingLoadConfig = new BasePagingLoadConfig();
pagingLoadConfig.setOffset(0);
pagingLoadConfig.setLimit(5);

Map<String, Object> state = userGrid.getState();
if (state.containsKey("offset")) {
int offset = (Integer)state.get("offset");
int limit = (Integer)state.get("limit");
pagingLoadConfig.setOffset(offset);
pagingLoadConfig.setLimit(limit);
}
if (state.containsKey("sortField")) {
pagingLoadConfig.setSortField((String)state.get("sortField"));
pagingLoadConfig.setSortDir(SortDir.valueOf((String)state.get("sortDir")));
}
loader.load(pagingLoadConfig);

// if (userGrid.getSelectionModel().getSelectedItems().size() > 0) {
//
// BeanModel selBeanModel = userGrid.getSelectionModel().getSelectedItem();
// final User selUser = selBeanModel.getBean();
//
// if (selUser != null) {
// // TODO: Edit User. Call by passing the User
// // parameter...
// CreateUser newUser = new CreateUser(selUser);
// setEditOrViewGrid(newUser);
//
// }
// }

}
});

userGrid.setStyleAttribute("borderTop", "none");
userGrid.getView().setForceFit(true);
userGrid.setAutoExpandColumn("username");
userGrid.setBorders(false);
userGrid.setStripeRows(true);
cp.add(userGrid);
cp.setBottomComponent(pagingToolBar);


controller.java


@RequestMapping(method = { RequestMethod.POST })
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
super.doPost(request, response);
return null;
}

/*
* (non-Javadoc)
*
* @see
* com.google.gwt.user.server.rpc.RemoteServiceServlet#processCall(java.
* lang.String)
*/
@Override
public String processCall(String payload) throws SerializationException {
try {

RPCRequest rpcRequest = RPC.decodeRequest(payload);
RemoteService service = ServiceLocatorFactory.getServiceLocator().getService(rpcRequest
.getMethod().getDeclaringClass());
// delegate work to the spring injected service
return RPC.invokeAndEncodeResponse(service, rpcRequest
.getMethod(), rpcRequest.getParameters());
} catch (IncompatibleRemoteServiceException ex) {
ex.printStackTrace();
getServletContext()
.log(
"An IncompatibleRemoteServiceException was thrown while processing this call.",
ex);
return RPC.encodeResponseForFailure(null, ex);
} catch (Throwable e) {
e.printStackTrace();
return RPC.encodeResponseForFailure(null, e);
}
}


my server service class
service.java

private List<User> serializedUserList;
private List<User> organizationUserList;

@Override
public PagingLoadResult<User> getTestUsersforOrganizationAdminforOrganizationId(
final PagingLoadConfig config, long organizationId) {
organizationUserList = persistDao.getAllUsers();
if (serializedUserList != null){
getSerializedUserList(organizationId);
}
if(config.getSortInfo().getSortField() != null){
final String sortField = config.getSortInfo().getSortField();
if(sortField != null){
Collections.sort(serializedUserList,
config.getSortInfo().getSortDir().comparator(new Comparator<User>() {

@Override
public int compare (User u1, User u2) {
if (sortField.equalsIgnoreCase("username")){
return u1.getUsername().compareToIgnoreCase(u2.getUsername());
} else if (sortField.equalsIgnoreCase("firstName")){
return u1.getFirstName().compareToIgnoreCase(u2.getFirstName());
} else if (sortField.equalsIgnoreCase("lastName")){
return u1.getLastName().compareToIgnoreCase(u2.getLastName());
} else if (sortField.equalsIgnoreCase("email")) {
return u1.getEmail().compareToIgnoreCase(u2.getEmail());
} else if (sortField.equalsIgnoreCase("createdDate")) {
return u1.getCreatedDate().compareTo(u2.getCreatedDate());
} else if (sortField.equalsIgnoreCase("userType")) {
return u1.getUserType().compareToIgnoreCase(u2.getUserType());
} else if (sortField.equalsIgnoreCase("status")) {
return u1.getStatus().compareToIgnoreCase(u2.getStatus());
} else if (sortField.equalsIgnoreCase("roleNameDisplayText")) {
return u1.getRoleNameDisplayText().compareToIgnoreCase(u2.getRoleNameDisplayText());
} else if (sortField.equalsIgnoreCase("associatedToDisplayText")) {
return u1.getAssociatedToDisplayText().compareToIgnoreCase(u2.getAssociatedToDisplayText());
}
return 0;
}
}));
}
}

ArrayList<User> subList = new ArrayList<User>();
int start = config.getOffset();
int limit = serializedUserList.size();

if (config.getLimit() > 0){
limit = Math.min(start + config.getLimit(), limit);
}

for (int index = config.getOffset(); index < limit; index++){
subList.add(serializedUserList.get(index));
}
return new BasePagingLoadResult<User>(subList, config.getOffset(), serializedUserList.size());
}

private void getSerializedUserList(long organizationId){

serializedUserList = new ArrayList<User>();
Person person;

if (organizationUserList != null && organizationUserList.size() > 0) {
for (User user : organizationUserList) {
if ((user.isStaff() || user.isOrganisationAdmin()) && user.getOrganizationId() == organizationId) {
Dao dao = (Dao) persistDao;
Organization organization = (Organization) dao.getEntity(Organization.class, organizationId);
user.setOrganizationName(organization.getName());
if (user.isStaff()) {
person = getPersonForPersonID(user.getPersonId());
if (person != null) {
StringBuffer buffer = new StringBuffer();
if (person.getFirstName() != null) {
buffer.append(person.getFirstName());

}
if (person.getLastName() != null) {
if (buffer.length() > 0) {
buffer.append(" ");
}
buffer.append(person.getLastName());
}

user.setAssociatedToDisplayText(buffer.toString());
}
UserRoles userRoles = getUserRoleforOrganizationId(organizationId, user.getId());
if (userRoles != null) {
user.setRoleNameDisplayText(userRoles.getRole().getRoleName());
}
}
serializedUserList.add(user);
} else if (user.isPhysician()) {
person = getPersonForPersonID(user.getPersonId());
if (person != null) {
user.setAssociatedToDisplayText(person.getFirstName() + " " + person.getLastName());
}
UserRoles userRoles = getUserRoleforOrganizationId(organizationId, user.getId());
if (userRoles != null) {
user.setRoleNameDisplayText(userRoles.getRole().getRoleName());
serializedUserList.add(user);
}
} else if (user.isPatient()) {
person = getPersonForPersonID(user.getPersonId());
if (person != null) {
user.setAssociatedToDisplayText(person.getFirstName() + " " + person.getLastName());
}
UserRoles userRoles = getUserRoleforOrganizationId(organizationId, user.getId());
if (userRoles != null) {
user.setRoleNameDisplayText(userRoles.getRole().getRoleName());
serializedUserList.add(user);
}
}
}
}
}


In case need any other thing please ask for it.

I'm newbie, and for the last two days i am trying to get ride of my error

Thanks in advance.
Looking forward for your reply.

Prakash

Ketuan
4 Oct 2011, 11:33 PM
I have one further question:
How do you handle exceptions from Spring Security? Are they wrapped inside an InvocationException and can be handled by the onFailure method?