简体   繁体   中英

Java Deserialization issue in SPring MVC Project using AOP

I am trying to deserialize an object, using simple code

ObjectInputStream ois = new ObjectInputStream(inputStream);
Object sss = ois.readObject();

ois.readObject is throwing classNotFound Exception, even i have all the classes

when i dig further , i found that the deserilizer is looking for a class like

com.xy.services.bank.trans.bean.SampleBean$$EnhancerBySpringCGLIB$$ee37d1aa

I have SampleBean in my project, but why the JVM is enahancing the bean, i am not able to figure out

can anyone give the clue what may be happening

Thank you

If you serialized anything that was Injected by Spring, you have to understand that Spring actually injects Proxies, not the real object which is what you are seeing there.

On a related note, not sure what you are trying to do, but I would stay clear of serialized objects unless absolutely necessary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM