Skip to main content

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 19:13 Go to next message
Mauro Flores is currently offline Mauro FloresFriend
Messages: 84
Registered: September 2009
Location: Brasil
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 19:04 Go to previous message
James Sutherland is currently offline James SutherlandFriend
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: Wed Apr 01 12:40:41 GMT 2020

Powered by FUDForum. Page generated in 0.01722 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top