wood burning stoves 2.0*
The moose likes Spring and the fly likes Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationExcep Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationExcep" Watch "Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationExcep" New topic
Author

Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationExcep

peter tong
Ranch Hand

Joined: Mar 15, 2008
Posts: 240
it is a standalone application to test Ioc feature of spring, but I always got the following exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerService': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.cybelink.ioc.DataSource com.cybelink.ioc.CustomerService.dataSource; nested exception is java.lang.NoClassDefFoundError: org/apache/velocity/exception/VelocityException

the application has 3 class as follow (the customer class is not related and so not paste the source here):


Interface DataSource


Implementation class of interface DataSource

the applicationContext.xml is as follow

peter tong
Ranch Hand

Joined: Mar 15, 2008
Posts: 240
after change the CustomerService class as follow, the program can run


But now if I change the constructor of class RelationalDataSource to non-default, like the following:


then the following error prompted


so if the bean has no default constructor, then how to pass constructor args using autowire annotation?
 
 
subject: Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationExcep
 
Similar Threads
Execption in AOP Logging Program Issue
AOP Not working with Spring 3 MVC application
Spring AOP aspect not working.
AOP not getting invoked on my Target Bean Method --> Singer.perform() method
Get error in standalone AOP prog