Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Error while Proxying DAO Classes

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You proxy both Dao and Service, and also inject (proxy)Dao to Service so TypeMismatchException happens.
 
Vivek Kr Singh
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the answer. Is there any way AOP can be applied on the DAO classes ?
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!