No Bean named ' sessionfactory ' is defined__no

Source: Internet
Author: User

Today, when configuring Opensessioninview, Tomcat starts without an error, but sends an error when sending a request, as follows:

Org.springframework.beans.factory.NoSuchBeanDefinitionException:No Bean named ' sessionfactory ' is defined Org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition (
	defaultlistablebeanfactory.java:387) Org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition ( abstractbeanfactory.java:971) Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean ( abstractbeanfactory.java:246) Org.springframework.beans.factory.support.AbstractBeanFactory.getBean ( abstractbeanfactory.java:185) Org.springframework.beans.factory.support.AbstractBeanFactory.getBean ( abstractbeanfactory.java:168) Org.springframework.context.support.AbstractApplicationContext.getBean (
	abstractapplicationcontext.java:884) Org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory (
	opensessioninviewfilter.java:243) Org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory (Opensessioninviewfilter.java:227) org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal ( opensessioninviewfilter.java:171) Org.springframework.web.filter.OncePerRequestFilter.doFilter ( onceperrequestfilter.java:76)

Also do not know how, unconsciously I go to the Web.xml configuration file with a little configuration, the problem is resolved, as follows:

<init-param>
  <param-name>sessionFactoryBeanName</param-name>
  <param-value> ID of the mysessionfactory</param-value>//sessionfactory bean
</init-param>

Why is this so I do not know, but also hope to consult

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.