Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error creating a bean

 
santosh goud
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 607
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't this explain the issue?

java.lang.NoSuchMethodException: Couldn't find an init method named 'start' on bean with name 'honda'
 
santosh goud
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 607
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic