ssh2整合: No bean named 'sessionFactory' is defined(求大神指点)
Posted Mr_meng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ssh2整合: No bean named 'sessionFactory' is defined(求大神指点)相关的知识,希望对你有一定的参考价值。
applicationContext.xml 中已经配置
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">false</prop> </props> </property> <property name="mappingLocations"> <list> <value>classpath:com.ceshi.entry/*.hbm.xml</value> </list> </property> </bean>
web.xml中
<filter> <filter-name>openSessionInView</filter-name> <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> <init-param> <param-name>sessionFactoryBeanName</param-name> <param-value>sessionFactory</param-value> </init-param> </filter> <filter-mapping> <filter-name>openSessionInView</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
报错信息:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘sessionFactory‘ is defined org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:549) org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1096) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:278) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1121) org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:278) org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:263) org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:195) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
以上是关于ssh2整合: No bean named 'sessionFactory' is defined(求大神指点)的主要内容,如果未能解决你的问题,请参考以下文章
ssm整合activiti是报错No bean named 'dataSource' is defined,求大神解决
No bean named 'cxf' is defined
ssh2项目整合 struts2.1+hibernate3.3+spring3 基于hibernate注解和struts2注解