Win a copy of Rust Web Development this week in the Other Languages 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Error creating a bean

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 607
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic