Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Weblogic classloader issue

436348Aug 8 2012 — edited Aug 9 2012
Hi,

I'm trying to resolve a "cannot be cast" error on Oracle JDeveloper 11.1.2.2.0. My application is using eclipselink JPA provider, which works fine on a fresh start WLS. However, when I redeployed my application without restarting the WLS, I got a very strange runtime error:

gov.noaa.gcld.model.jpa.User cannot be cast to gov.noaa.gcld.model.jpa.User

The code is:

List<User> users = dao.findByUserLdapId(userId);

The compile has no error. I checked the classloader of the User object returned by the entityManager. This is what I've found:

1) When I did a fresh start of the WLS,

The classloader of User object in my application: weblogic.utils.classloaders.ChangeAwareClassLoader@1bf353c
The classloader of User object returned from the entity manager: weblogic.utils.classloaders.ChangeAwareClassLoader@1bf353c

The application is working fine at this time.

2) When I redeployed my application without restarting the WLS,

The classloader of User object in my application: weblogic.utils.classloaders.ChangeAwareClassLoader@14e4ae9
The classloader of User object returned from the entity manager: weblogic.utils.classloaders.ChangeAwareClassLoader@1bf353c

Now I got the "gov.noaa.gcld.model.jpa.User cannot be cast to gov.noaa.gcld.model.jpa.User" error.

It looks the WLS is using a new classloader when I redeploy my application but still using the old classoloader for eclipselink entity manager, even after I undeployed my application completely, and there's no other applications using the same persistence unit.

Does anybody know how to force the WLS to reload the eclipselink entity manager using the same classloader as the application? Our server admin will not restart the WLS when we redeploy our applications.

Thanks very much for your help!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 6 2012
Added on Aug 8 2012
1 comment
387 views