[jboss-dev-forums] [Design of POJO Server] - Re: Serialization, NoSuchMethodException in ProfileServiceUn

alesj do-not-reply at jboss.com
Mon Dec 17 12:48:32 EST 2007


You're right. :-(
This test shows it:

  | public class Test
  | {
  |    public static void main(String[] args)
  |    {
  |       try
  |       {
  |          Configuration configuration = new PropertyConfiguration();
  |          BeanInfo beanInfo = configuration.getBeanInfo(ClassLoader.class);
  |          Set<MethodInfo> methods = beanInfo.getMethods();
  |          for(MethodInfo mi : methods)
  |          {
  |             byte[] bytes = serialize((Serializable)mi);
  |             Object o = deserialize(bytes);
  |             System.out.println("o = " + o);
  |          }
  |       }
  |       catch (Exception e)
  |       {
  |          e.printStackTrace();
  |       }
  |    }
  | 
  |    protected static byte[] serialize(Serializable object) throws Exception
  |    {
  |       ByteArrayOutputStream baos = new ByteArrayOutputStream();
  |       ObjectOutputStream oos = new ObjectOutputStream(baos);
  |       oos.writeObject(object);
  |       oos.close();
  |       return baos.toByteArray();
  |    }
  | 
  |    protected static Object deserialize(byte[] bytes) throws Exception
  |    {
  |       ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
  |       ObjectInputStream ois = new ObjectInputStream(bais);
  |       return ois.readObject();
  |    }
  | }
  | 

Any ideas?
I'll have a look at it.
Trying to fix it, and commit together with all the changes needed for Alexey.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113487#4113487

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113487



More information about the jboss-dev-forums mailing list