-
May 4th, 2011, 01:40 PM
#1
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>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/app-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
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(AutowiredAnnotationBeanPostProcessor.java: 285)
...
Any thoughts?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules