Hi, I keep getting the serialization exception and causing the rpc failed. Can someone tell me what's going on? com.google.gwt.user.client.rpc.SerializationException: Type 'com.jobscout.frontpage.client.Category$$EnhancerByCGLIB$$424f9bbb' 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 = com.jobscout.frontpage.client.Category@9cdbbc I use hibernate to extract the records, put the result in the ArrayList. To test the serialization, I dropped the hibernate part and built the ArrayList of the type in the Impl and it works. So, I am not sure how the hibernate return the arraylist<type> causes the serialization exception. The following are extracted from my code that is relevent. public class Job implements Serializable { private long oid; private long acctOid; private String subject; private String description; private Category category; //Serializable private SubCat1 subcat1; //Serializable private Mesgtype mesgtype; //Serializable This part is the testing and it works. I create the Arraylist instead of using hibernate to extract records and return an Arraylist. public ArrayList<Job> getJobAryLstTest(){ ArrayList<Job> jobarylst = new ArrayList<Job>(); Category catparttime = new Category(0,"Parttime"); SubCat1 painter = new SubCat1(0, catparttime,"Partime Painter"); Mesgtype postjobmesgtype = new Mesgtype(0, "Post Job"); Job job1 = new Job(0,"subject1","descruotuib1",catparttime, painter,postjobmesgtype); Job job2 = new Job(0,"subject2","descruotuib2",catparttime, painter,postjobmesgtype); jobarylst.add(job1); jobarylst.add(job2); return jobarylst; This part call the hibernate dao and cause serialization exception public ArrayList<Job> getAllJobAryLst() { JobDAO jobdao=new JobDAO(); ArrayList<Job> rtnJobList; rtnJobList = jobdao.getAllJob(); return rtnJobList; } This part is the DAO public ArrayList<Job> getAllJob() { ArrayList<Job> rtnAryList=new ArrayList<Job>(); try { if(!session.isOpen()) { session = HibernateUtil.getSessionFactory().openSession(); } session.beginTransaction(); String hql="from Job job"; rtnAryList = (ArrayList<Job>)session.createQuery(hql).list(); return rtnAryList; } catch(Exception e) { System.out.println(e.toString()); return null; } } Thanks a lot
|