aspose file tools
The moose likes Spring and the fly likes getting $Proxy0 cannot be cast exception Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Spring
Reply Bookmark "getting $Proxy0 cannot be cast exception" Watch "getting $Proxy0 cannot be cast exception" New topic
Author

getting $Proxy0 cannot be cast exception

sirisha mullapudi
Greenhorn

Joined: Mar 05, 2008
Posts: 8
Hi,
I have implemented BeanNameAware Interface and i am trying to access the bean using ApplicationContext.There i am getting exception $Proxy0 cannot be cast to net.springtest.SimpleBean. I am new to Spring framework.I have read that applicationcontext provides all the features that bean factory has.But here i am able to load the bean using BeanFactory but not ApplicationContext. Can you please describe what exactly proxy meant here and in what situations we should use bean factory and applicationContext. Appreciate your Help.

Regards,
Sireesha
Ankit Garg
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9189
    
    2

You must be using some sort of AOP I think so you are getting a proxy object. Can you show us your spring configuration file...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
sirisha mullapudi
Greenhorn

Joined: Mar 05, 2008
Posts: 8
hi,please find the xml below :

Thanks,
Sireesha
Ankit Garg
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9189
    
    2

Yes indeed you are using AOP. In that case you'll have to create a base interface of SimpleBean class and use that interface as reference when you get the simpleBean from ApplicationContext...
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: getting $Proxy0 cannot be cast exception
 
Similar Threads
Error while calling EJB with client code
Some help required for understanding spring lifecycle
JMS implementation using JNDI in spring application
How do I know if transaction is configured successfully?
Session closed exception