aspose file tools
The moose likes Spring and the fly likes ClassCastException: Error in the WAR Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Reply 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: 17225
    
    1

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.

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: ClassCastException: Error in the WAR
 
Similar Threads
XML name space error in Spring data JPA hibernate applicationContext.xml
org.springframework.beans.factory.BeanCreationException
Cannot find the declaration of element 'beans' -- application context invalid?
The matching wildcard is strict, but no declaration can be found for element 'context:annotation'
unable to call AOP method