aspose file tools*
The moose likes Spring and the fly likes ClassCastException: Error in the WAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "ClassCastException: Error in the WAR" Watch "ClassCastException: Error in the WAR" New topic
Author

ClassCastException: Error in the WAR

Kshitiz Agarwal
Ranch Hand

Joined: Dec 15, 2011
Posts: 36
Hi, I am facing a problem while retrieving objects from a list obtained from another package.



This is the code of my com.infosys.ingreen.middleware.service.DeviceService class:



And this is middleware-dao.xml:



Now I know the problem is because of different class loaders. Now the thing is all the classes are in the same WAR, so same classloader should be used. What I assume is may be Spring is using its own class loader SimpleLoadTimeWeaver to load DeviceDao class. If that is the issue, then how can I resolve it? Otherwise what can be the problem??
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Why do you even have the loadTimeWeaverBean? It isn't needed.

Anyway, is the domain object on two different JVMs? Maybe each has a different compiled version.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Kshitiz Agarwal
Ranch Hand

Joined: Dec 15, 2011
Posts: 36
Mark Spritzler wrote:Why do you even have the loadTimeWeaverBean? It isn't needed.

Anyway, is the domain object on two different JVMs? Maybe each has a different compiled version.

Mark


Thanks for the reply....If I remove loadTimeWeaver..then this error comes...



And also, the whole project is in one workspace, in one machine. The domain object is in different package though.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ClassCastException: Error in the WAR