Servlet.service() for servlet jsp threw exception 和No bean named 'sessionFactory

Servlet.service() for servlet jsp threw exception 和No bean named sessionFactory is defined配置SS

Servlet.service() for servlet jsp threw exception 和No bean named 'sessionFactory' is defined
配置SSH时候遇到的,准备做个登陆!!
————————
这是配置的applicationContext

Java code
 
<bean id="Mysql" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://127.0.0.1:3306/dating">
</property>
<property name="username" value="root"> </property>
<property name="password" value="root"> </property>
</bean>


<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="Mysql" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
<prop key="hibernate.show_sql">true </prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>cn/studclub/vo/User.hbm.xml </value>
</list>
</property>
</bean>

<bean id="userDao" class="cn.studclub.impl.UserDaoImpl" >
<property name="sessionFactory" ref="sessionFactory" />
</bean>

web.xml

Java code
<?xml version="1.0" encoding="UTF-8"?><web-app version="2.4"     xmlns="http://java.sun.com/xml/ns/j2ee"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee     http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">  <welcome-file-list>    <welcome-file>index.jsp</welcome-file>  </welcome-file-list>    <servlet>    <servlet-name>action</servlet-name>    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>    <init-param>      <param-name>config</param-name>      <param-value>/WEB-INF/struts-config.xml</param-value>    </init-param>    <init-param>      <param-name>debug</param-name>      <param-value>2</param-value>    </init-param>    <init-param>      <param-name>detail</param-name>      <param-value>2</param-value>    </init-param>    <load-on-startup>2</load-on-startup>  </servlet>  <!-- Standard Action Servlet Mapping -->  <servlet-mapping>    <servlet-name>action</servlet-name>    <url-pattern>*.do</url-pattern>  </servlet-mapping>      <context-param>      <param-name>contextConfigLocation</param-name>      <param-value>classpath*:applicationContext.xml</param-value>  </context-param>      <listener>        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>   </listener>     <filter>    <filter-name>Spring character encoding filter</filter-name>    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>    <init-param>        <param-name>encoding</param-name>        <param-value>GBK</param-value>    </init-param>  </filter>  <filter-mapping>    <filter-name>Spring character encoding filter</filter-name>    <url-pattern>/*</url-pattern>  </filter-mapping>    <filter>    <filter-name>hibernateFilter</filter-name>    <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>  </filter> <filter-mapping>    <filter-name>hibernateFilter</filter-name>    <url-pattern>/*</url-pattern>  </filter-mapping> </web-app> 



运行的时候就出现

信息: Detected AnnotationXWorkConverter, initializing it...
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: \WEB-INF\petstore.log (系统找不到指定的路径。)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)


和,信息: Jk running ID=0 time=0/63 config=null
2008-12-8 20:36:38 org.apache.catalina.startup.Catalina start
信息: Server startup in 18690 ms
2008-12-8 20:37:19 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sessionFactory' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:353)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:916)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:243)


at java.lang.Thread.run(Unknown Source)
2008-12-8 20:38:35 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sessionFactory' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:353)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:916)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:243)



——————————————————————————————————
各位帮帮忙,怎么个解决法,搞了一下午了~~~~~~~



[解决办法]
不懂了,你的log4j应该没什么问题,实际上它你的系统并没有用log4j记录日志,只是把日志打印到后台了。

petstore.log 这个文件有印象吗?做什么的?
我的异常网推荐解决方案:Servlet.service() for servlet default threw exception,http://www.myexception.cn/eclipse/181756.html