java ClassNotFoundException thrown during deserialization of Generics following refactoring -


i refactored (moved) bunch of classes , getting classnotfoundexception while trying deserialize session. classic.

i created custome deserializer sessiondeserializer extends objectinputstream works fine classes except generic class result<t>.

the generic class in hasn't moved, guessing issue lies t object class has been moved.

now issue stacktrace doesn't specify t class:

java.lang.classnotfoundexception: com.mysite.shared.beans.result @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1714) ... 

do know way work around problem: either finding t class contained inside result<t> object , adjusting sessiondeserializer, or skipping deserialization of result<t> object alltogether?

edit

added result class below:

public class result<t> implements serializable{ private static final long serialversionuid=1l; protected t t=null; protected boolean success=false; protected map<string,string> errors=new hashmap<string,string>(); protected string message=null;  public void setdata(t t){     this.t=t; }  public t getdata(){     return t; }  public boolean issuccess(){     return success; }  public map<string,string> geterrors(){     return errors; }  public void setsuccess(boolean success){     this.success=success; }  public void seterrors(map<string,string> errors){     this.errors=errors; }  protected void adderror(string field, string msg){     errors.put(field,msg); }  public string getmessage(){     return message; }  public void setmessage(string message){     this.message=message; } } 

now issue stacktrace doesn't specify t class.

that's because not t class problem here. problem result class. trust exception message.

i can't tell why classloader cannot find result class, possible explanations are:

  • the result class not on webapps classloader's classpath, or
  • this class depends on other class missing, or
  • this class has initialization dependency on other class initialization has failed.

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -