Announcement Announcement Module
Collapse
No announcement yet.
context initialised failed Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • context initialised failed

    hey guys,

    i am just a beginner in spring and doing it as part of my uni research assignment.

    the link below points to a simple application using spring mvc

    http://www.netbeans.org/kb/61/web/qu...ps-spring.html

    doing the example - i get the following error:

    Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.web.servlet.mvc.support.Contr ollerClassNameHandlerMapping#0' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'controller.HelloController#0' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean 'HelloService' while setting bean property 'helloService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'HelloService' is defined
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:547)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:485)
    at java.security.AccessController.doPrivileged(Native Method)
    at .......

    um badly stuck ...

    how can i fix it any suggestions... the code is given on the above url to check what exactly um doing...

    please help

    regards

  • #2
    Have you declared you 'helloService' bean as
    Code:
    <bean name="HelloService" class="service.HelloService" />
    instead of (case of helloService)
    Code:
    <bean name="helloService" class="service.HelloService" />
    ?

    Comment


    • #3
      Just to make this really clear for you ..........
      Well it seems to me that you have something like this
      <bean id="HelloController" class="com....HelloController">
      ......
      <property name ="helloService" ref="HelloService"/>
      ....
      </bean>
      So your controller gets invoked and fails at the line where this HelloService is reffered.
      Please check if a stament like this exists in your bean definition file :
      <bean id="HelloService" class="com....HelloService"/>
      I hope this should make it really clear to what you need to do to fix this issue.
      Cheers,
      Sushant

      Comment

      Working...
      X