Sunday, 11 August 2013

How to retrieve object state from serialized Java objects without class file(s)

How to retrieve object state from serialized Java objects without class
file(s)

I have a binary file that contains Java Serialized objects (which are
value objects), but I do not have access to the Class that was serialized
to create those objects. Without the class file, JVM does not allow me to
read the objects with objectInputStreamInstance.readObject() and
rightfully throws the java.lang.ClassNotFoundException.
Is there a library that can help be extract the data in XML or other
standarized format? For example, if the Person class below is serialized
and stored in a file, I would like to extract data from it:
Class Definition
class Person implements Serializable {
int age;
String name;
public Person(int age, int name) {
this.age = age;
this.name = name;
}
}
Required Extraction Format (without access to the class file)
<Person>
<age>10</age>
<name>Name</name>
</Person>
I have also checked the following but did not get what I was looking for:
Xstream (http://xstream.codehaus.org/) needs access to the a Java object
in order to create XML from that object. However, I am unable create
objects for want of class file.
Serialysis appears to be very old
https://weblogs.java.net/blog/emcmanus/archive/2007/06/disassembling_s.html
Thank you for your help.
Regards, Gursev

No comments:

Post a Comment