wood burning stoves 2.0*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 17249
    
    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.

 
Consider Paul's rocket mass heater.
 
subject: ClassCastException: Error in the WAR
 
Similar Threads
XML name space error in Spring data JPA hibernate applicationContext.xml
The matching wildcard is strict, but no declaration can be found for element 'context:annotation'
org.springframework.beans.factory.BeanCreationException
Cannot find the declaration of element 'beans' -- application context invalid?
unable to call AOP method