Classloader issue with MyBatis CDI and TomEE redeployments

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Classloader issue with MyBatis CDI and TomEE redeployments

Christian Kalkhoff-2
Hi,

I use MyBatis with MyBatis CDI in my project. It works fine most of the
time but I stumpled upon a bug that makes my developer life quite hard.

Whenever I change something in the code, Netbeans IDE redeploys the
application which is the expected behaviour. But after the redeployment,
every attempt to retrieve a mapped class from the Mapper (annotated with
@org.mybatis.cdi.Mapper) I get a ClassCastException while trying to Cast
com.example.Foobar to com.example.Foobar.

I investigated the problem in the debugger and found out, that the class
instanciated by MyBatis is loaded from the web application classloader
of the first deployment and then is tried to cast to the same class
loaded by the class loader of the second deployment. From this I figure,
that somehow the classes are cached in the CDI extension provided by
MyBatis and not properly evicted on redeployment or something similar. I
searched the web already but was not able to find anything related.

Can you please tell me if the problem also happens in other application
servers or if a workaround exist?

Best,

Christian


--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.