My favorites | Sign in
Project Home Downloads Issues Source
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 530: Improved SerializedCache compatibility with frameworks that use custom classloaders - patch provided
2 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  eduardo.macarron
Closed:  Mar 2012

Sign in to add a comment
Reported by, Feb 27, 2012
What version of the MyBatis are you using?

Please describe the problem.  Unit tests are best!

I was having some issues integrating mybatis with playframework. 

Because play is using a custom classloader to do it's class reload "magic", during the cache deserialization ObjectInputStream was locating the required class using the default Launcher.AppClassLoader classloader, thus resulting in a ClassCastException when casting to the actual object:

- upon serialization the play classloader was being used - expected
- upon deserialization the Launcher.AppClassLoader was used, resulting in a ClassCastException

The proposed solution is to extend ObjectInputStream and override resolveClass method and force the use of the Thread.currentThread().getContextClassLoader().

I have attached a patch with these changes - I hope I got it right, cause it's the first time I'm creating a patch :)

Anyway, if you don't foresee any unpleasant side effects it would be great if you could include this in a future release.

2.8 KB   View   Download
Mar 17, 2012
Project Member #3 eduardo.macarron
you are doing a great job with MyBatisPlay. Do not hesitate to ask us for help or changes if you need them.

May be fixed in r4940. I will uplodad a 3.1.1 snapshot in a short, please give it a try and let me know.
Mar 17, 2012
Project Member #4 eduardo.macarron
(No comment was entered for this change.)
Status: Fixed
Mar 19, 2012
I have just tested the latest commit and it works fine. When you'll release the next version to maven repositories I'll remove MyBatis source from the module and just add a dependency to the latest stable release.

Sign in to add a comment

Powered by Google Project Hosting