MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » 这个有关问题好奇怪

这个有关问题好奇怪(2)

www.MyException.Cn  网友分享于:2013-12-16  浏览:175次

</list>
</property>
</bean>
<bean   id= "userInfoDAO "   class= "com.togv.dao.UserInfoDAO ">
<property   name= "sessionFactory ">
<ref   local= "sessionfactory "   />
</property>
</bean>
<bean   id= "userService "   class= "com.togv.struts.action.UserService ">
<property   name= "userInfoDAO ">
<ref   local= "userInfoDAO "/>
</property>
</bean>
</beans>
但是   错误提示确是:

org.springframework.beans.factory.NoSuchBeanDefinitionException:   No   bean   named   'sessionFactory '   is   defined
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:360)
org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:686)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:219)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:149)
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:541)
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:223)
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:207)
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:146)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:75)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
  我调用到sessionFactory这个BEAN啊(我调用的是sessionfactory)怎么会提示这样的错误       郁闷

我在web.xml里也配置了  
    <context-param>  
<param-name> contextConfigLocation </param-name>  
<param-value> /WEB-INF/applicationContext.xml </param-value>  
    </context-param>

------解决方案--------------------
把这个类的代码贴出来看看

com.togv.dao.UserInfoDAO
------解决方案--------------------
名字不一样,当然有错。
定义时:用的sessionfactory
<bean id= "sessionfactory " class= "org.springframework.orm.hibernate3.LocalSessionFactoryBean ">
调用时:用的sessionFactory
<bean id= "userInfoDAO " class= "com.togv.dao.UserInfoDAO ">
<property name= "sessionFactory ">
<ref local= "sessionfactory " />
</property>
</bean>
------解决方案--------------------
兄弟要会看错误啊
------解决方案--------------------
我想看看你com.togv.dao.UserInfoDAO里定义的sessionFactory的变量名是什么?你是不是写错了?两个怎么不一样啊?
------解决方案--------------------
'sessionFactory '

一眼就能看得出来...

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有