aspose file tools
The moose likes Spring and the fly likes Error creating a bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Error creating a bean" Watch "Error creating a bean" New topic
Author

Error creating a bean

santosh goud
Greenhorn

Joined: Dec 10, 2011
Posts: 6
I am trying out some simple spring programs as i am new to it and got the following error. Can any one help me out with this....??

Dec 10, 2011 4:50:31 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [C:\WorkSpace2\Spring2\mybeans.xml]
Dec 10, 2011 4:50:31 PM org.springframework.beans.factory.support.AbstractBeanFactory getBean
INFO: Creating shared instance of singleton bean 'columbusAuto'
Dec 10, 2011 4:50:32 PM org.springframework.core.CollectionFactory <clinit>
INFO: Commons Collections 3.x available
Dec 10, 2011 4:50:32 PM org.springframework.beans.factory.support.AbstractBeanFactory getBean
INFO: Creating shared instance of singleton bean 'stardealer'
Dec 10, 2011 4:50:32 PM org.springframework.beans.factory.support.AbstractBeanFactory getBean
INFO: Creating shared instance of singleton bean 'honda'
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'columbusAuto' defined in file [C:\WorkSpace2\Spring2\mybeans.xml]: Can't resolve reference to bean 'stardealer' while setting property 'dealer'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stardealer' defined in file [C:\WorkSpace2\Spring2\mybeans.xml]: Can't resolve reference to bean 'honda' while setting property 'honda'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'honda' defined in file [C:\WorkSpace2\Spring2\mybeans.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodException: Couldn't find an init method named 'start' on bean with name 'honda'
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stardealer' defined in file [C:\WorkSpace2\Spring2\mybeans.xml]: Can't resolve reference to bean 'honda' while setting property 'honda'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'honda' defined in file [C:\WorkSpace2\Spring2\mybeans.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodException: Couldn't find an init method named 'start' on bean with name 'honda'
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'honda' defined in file [C:\WorkSpace2\Spring2\mybeans.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodException: Couldn't find an init method named 'start' on bean with name 'honda'
java.lang.NoSuchMethodException: Couldn't find an init method named 'start' on bean with name 'honda'
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:993)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:970)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:358)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:176)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:920)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:731)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:340)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:176)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:920)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:731)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:340)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at spring.example2.TestClient.main(TestClient.java:13)


and this my bean defination......



Thanks.
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 606

Doesn't this explain the issue?

java.lang.NoSuchMethodException: Couldn't find an init method named 'start' on bean with name 'honda'


Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
santosh goud
Greenhorn

Joined: Dec 10, 2011
Posts: 6
Thanks....! It worked I just removed "init-method="start" " statement from xml file and then it executed. Can you explain me the mistake i did with this.
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 606

The class spring.example2.Honda doesn't contain a method called start. Considering that you are probably directly running samples I guess its just a Bug in the samples.
Could you point to the location you got the sample from and how you were running it?
 
Don't get me started about those stupid light bulbs.
 
subject: Error creating a bean