Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » SerializationHelper.desserialize ClassNotFound
SerializationHelper.desserialize ClassNotFound [message #659277] Fri, 11 March 2011 14:13 Go to next message
Mauro Flores is currently offline Mauro Flores
Messages: 83
Registered: September 2009
Location: Brasil
Member
Does any body now why the method SerializationHelper.desserialize is throwing a ClassNotFoundException in JEE environment(Weblogic 10.3.2)?

The following code throws java.lang.ClassNotFoundException: example.ejb.MyEntity at last line, but the same class was found at previous lines
      MyEntity foo= new MyEntity();
      byte[] serialize = SerializationHelper.serialize(foo);
      Object obj = SerializationHelper.deserialize(serialize);


Thanks. Mauro.
Re: SerializationHelper.desserialize ClassNotFound [message #660823 is a reply to message #659277] Mon, 21 March 2011 15:04 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

I think Java serialization uses a thread base class loader. So depending on the calling codes class loader/context, it could be getting a different class loader.

In EclipseLink we generally resolve this by using a CustomObjectInputStream that uses the desired class loader to resolve classes.


James : Wiki : Book : Blog : Twitter
Previous Topic:Changing container policy for toOne relationships
Next Topic:Be wary of transient nested inner class members
Goto Forum:
  


Current Time: Thu Apr 17 00:00:46 EDT 2014

Powered by FUDForum. Page generated in 0.03933 seconds