Announcement Announcement Module
No announcement yet.
NoSuchBeanDefinitionException: No matching bean of type [org.hibernate.SessionFactory Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • NoSuchBeanDefinitionException: No matching bean of type [org.hibernate.SessionFactory

    I'm experimenting with greenhouse by adding database connectivity via hibernate and getting a NoSuchBeanDefinitionException. I suspect this is due to contextConfigLocation never loading my app-config.xml because I can change the path to /WEB-INFO_BOGUS/app-config.xml and still get the error.

    Here is the web.xml snip where I added a link to app-config:

    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>

    In the app-config.xml I have a call to <import resource="db.xml" /> which has my bean.

    Here is the error:

    SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListe ner
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'testDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire method: public void com.springsource.greenhouse.grid.dao.TestDAO.setSe ssionFactory(org.hibernate.SessionFactory); nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [org.hibernate.SessionFactory] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
    at org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor.postProcessPropert yValues( 285)

    Any thoughts?