1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    2
    Vote Rating
    0
    ahimsa is on a distinguished road

      0  

    Default SerializationException when using remote paging grid

    SerializationException when using remote paging grid


    need some help with the code. i make 2 remote paging grid in one page (remote paging grid like GXT demo). both of them have same code, the difference is only in model. there is no error in the first grid but i found this error in the second grid, error is in model for the second grid.

    Code:
    model for first grid :
    public class Contact extends BaseModel {
    	private static final long serialVersionUID = 1L;	
    	public Contact(int id, String name) {
    		set("id", id);
    		set("name", name);
    	}
    	
    	public Contact() {}
    	
    	public String getName() {
    		return (String) get("name");
    	}
    	public int getId() {
    		return (Integer) get("id");
    	}
    	
    	public void setId(int id){
    		set("id", id);
    	}
    	public void setName(String name){
    		set("name", name);
    	}
    	public String toString() {
    		return getName();
    	}
    }
    
    model for the second grid :
    public class Test extends BaseModel {
    	private static final long serialVersionUID = 1L;	
    	public Test(String id, String name) {
    		set("id", id);
    		set("name", name);
    	}	
    	public Test() {}	
    	public String getName() {
    		return (String) get("name");
    	}	
    	public String getId() {
    		return (String) get("id");
    	}
    	
    	public void setId(String id){
    		set("id", id);
    	}	
    	public void setName(String name){
    		set("name", name);
    	}
    	public String toString() {
    		return getName();
    	}
    }
    Code:
    error : 
    [WARN] Exception while dispatching incoming RPC call
    com.google.gwt.user.client.rpc.SerializationException: Type 'crudGridServer.client.model.Test' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = 0000000000111
    	at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:619)
    	at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:126)
    	at com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java:44)
    	at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java:39)
    	at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serializeInstance(ArrayList_CustomFieldSerializer.java:51)
    	at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serializeInstance(ArrayList_CustomFieldSerializer.java:28)
    	at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:740)
    	at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:621)
    	at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:126)
    	at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:153)
    	at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:539)
    	at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeClass(ServerSerializationStreamWriter.java:709)
    	at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:748)
    	at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeClass(ServerSerializationStreamWriter.java:721)
    	at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:748)
    	at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:621)
    	at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:126)
    	at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:153)
    	at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:539)
    	at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:616)
    	at com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:474)
    	at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:571)
    	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
    	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 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.handle(ServletHandler.java:362)
    	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:205)
    	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)
    i'm really need help to solve this.

    Thanks

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    2
    Vote Rating
    0
    ahimsa is on a distinguished road

      0  

    Default


    this is the code for the window :
    Code:
    public class ListFasilitas extends Window {
    	public EditorGrid<Test> grid;
    	public ListStore<Test> store;
    	private final GreetingServiceAsync service = GWT
    			.create(GreetingService.class);
    	private VerticalPanel vp;
    	public PagingLoader<PagingLoadResult<ModelData>> loader;
    	public ContentPanel panel;
    	
    	public ListFasilitas() {
    		setMinWidth(478);
    		setMinHeight(383);
    		setLayout(new RowLayout(Orientation.VERTICAL));
    		setResizable(false);
    		setMinimizable(true);
    		vp = new VerticalPanel();
    		vp.setSpacing(10);
    		RpcProxy<PagingLoadResult<Test>> proxy = new RpcProxy<PagingLoadResult<Test>>() {
    			@Override
    			public void load(Object loadConfig,
    					final AsyncCallback<PagingLoadResult<Test>> callback) {
    				service.getFasilitasList((FilterPagingLoadConfig) loadConfig,
    						callback);				 
    			}
    		};
    
    
    		loader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy) {
    			@Override
    			protected Object newLoadConfig() {
    				BasePagingLoadConfig config = new BaseFilterPagingLoadConfig();
    				return config;
    			}
    		};
    		loader.setRemoteSort(true);
    
    
    		store = new ListStore<Test>(loader);
    		final PagingToolBar toolBar = new PagingToolBar(10);
    
    
    		List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    
    
    		ColumnConfig column = new ColumnConfig();
    		column.setId("name");
    		column.setHeader("Name");
    		column.setWidth(100);
    		configs.add(column);
    
    
    		ColumnModel cm = new ColumnModel(configs);
    
    
    		StringFilter cifFilter = new StringFilter("name");
    		GridFilters filters = new GridFilters();
    		filters.addFilter(cifFilter);
    
    
    		grid = new EditorGrid<Test>(store, cm);
    		grid.addPlugin(expander);
    		grid.addListener(Events.Attach, new Listener() {
    			public void handleEvent(BaseEvent be) {
    				FilterPagingLoadConfig config = new BaseFilterPagingLoadConfig();
    				config.setOffset(0);
    				config.setLimit(10);
    				Map<String, Object> state = grid.getState();
    				if (state.containsKey("offset")) {
    					int offset = (Integer) state.get("offset");
    					int limit = (Integer) state.get("limit");
    					config.setOffset(offset);
    					config.setLimit(limit);
    				}
    				if (state.containsKey("sortField")) {
    					config.setSortField((String) state.get("sortField"));
    					config.setSortDir(SortDir.valueOf((String) state
    							.get("sortDir")));
    				}
    				loader.load(config);
    			}
    		});
    
    
    		grid.setBorders(true);
    		grid.getView().setForceFit(true);
    		grid.setStyleAttribute("borderTop", "none");
    		grid.setAutoExpandColumn("name");
    		grid.setStripeRows(true);
    		grid.setColumnLines(true);
    		grid.addPlugin(filters);
    
    
    		panel = new ContentPanel();
    		panel.setLayout(new FitLayout());
    		panel.add(grid);
    		grid.setWidth("444px");
    		panel.setSize(600, 300);
    		panel.setBottomComponent(toolBar);
    		vp.add(panel);
    		panel.setWidth("445px");
    
    
    		add(vp, new RowData(465.0, Style.DEFAULT, new Margins()));
    	}
    }
    this is the code for implementation server :
    Code:
    @SuppressWarnings("serial")
    public class GreetingServiceImpl extends RemoteServiceServlet implements
    		GreetingService {
    	private static ContactDAO contactDAO = new ContactDAO();
    
    @Override
    	public PagingLoadResult<Test> getFasilitasList(FilterPagingLoadConfig config)
    			throws IllegalArgumentException {
    		try {
    			List<Test> c = new ArrayList<Test>();
    			List<Test> newList = new ArrayList<Test>();
    			c = getFasilitasAll();
    			
    			List<FilterConfig> filters = config.getFilterConfigs();
    		    for (FilterConfig f : filters) {
    		      Object ov = f.getValue();
    		      String cc = f.getComparison();
    		      String type = f.getType();
    		      newList = new ArrayList<Test>();
    		      for (Test s : c) {
    		        Object value = s.get(f.getField());
    		        if(value instanceof Integer){
    		    		int v = (Integer) value;
    		    		value = (double) v;
    		    	}
    		        if (!f.isFiltered(s, ov, cc, value)) {
    		          newList.add(s);
    		        }
    		      }
    		      
    		      if(newList.size() > 0){
    		    		c = newList;
    		      }
    		    }			
    			ArrayList<Test> sublist = new ArrayList<Test>();
    			int start = config.getOffset();
    			int limit = c.size();GWT.log("====> Test : " + limit);
    			if (config.getLimit() > 0) {
    				limit = Math.min(start + config.getLimit(), limit);
    			}
    
    
    			for (int i = config.getOffset();i < limit;i++) {
    				sublist.add(c.get(i));
    			}
    
    
    			return new BasePagingLoadResult<Test>(sublist, config.getOffset(),
    					c.size());
    
    
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    		return null;
    	}
    }
    when i debug the code in GreetingServiceImpl class, i check that the list<Test> c is not empty. i'm totally confuse, with the same code, why just model Test that have an error. model Contact can retrieve and show the data successfully.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi