GeeCON Prague 2014*
The moose likes Spring and the fly likes Error while Proxying DAO Classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Error while Proxying DAO Classes" Watch "Error while Proxying DAO Classes" New topic
Author

Error while Proxying DAO Classes

Vivek Kr Singh
Ranch Hand

Joined: Oct 12, 2007
Posts: 56
I am pasting this after searching the forum and not finding a suitable answer for this. I am using spring-2.5.6 and implementing AOP in my application.

Below is my Spring Config:


On container init the following error is generated:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeesService' defined in class path resource [springConfig.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy10 implementing org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.vivek.spring.employee.jdbc.dao.EmployeeDAO] for property 'employeeDAO'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy10 implementing org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.vivek.spring.employee.jdbc.dao.EmployeeDAO] for property 'employeeDAO': no matching editors or conversion strategy found

This error is not generated when i am proxying only the Service classes using "*Service".

Snippet of Service Class


It would be great if spring guru's can point out the mistake in configuration.

Mod's it is a long message i have posted. Please let me know if this need to be split into 2-3 posts.


SCJP 1.4
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
You proxy both Dao and Service, and also inject (proxy)Dao to Service so TypeMismatchException happens.


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Vivek Kr Singh
Ranch Hand

Joined: Oct 12, 2007
Posts: 56
Thanks for the answer. Is there any way AOP can be applied on the DAO classes ?
 
GeeCON Prague 2014
 
subject: Error while Proxying DAO Classes