报错。 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [amigo/sshmemo/dao/User.hbm.xm] cannot be opened because it does not exist Caused by: java.io.FileNotFoundException: class path resource [amigo/sshmemo/dao/User.hbm.xm] cannot be opened because it does not exist这2个错
<%@ taglib uri="/struts-tags" prefix="s"%>这句话肯定有撒,不然之前怎么能正常使用。
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [amigo/sshmemo/dao/User.hbm.xm] cannot be opened because it does not exist
Caused by: java.io.FileNotFoundException: class path resource [amigo/sshmemo/dao/User.hbm.xm] cannot be opened because it does not exist这2个错
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
<bean id="testImp" class="util.TestImp">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="testAction" class="action.TestAction">
<property name="testFace" ref="testImp">
</property>
</bean>
<bean id="userDao" class="dao.UserDao"><property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="loginAction" class="action.LoginAction">
<property name="loginFace" ref="userDao"></property>
</bean>
</beans>说实话 我是不懂这个东东哪有问题么。。
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://localhost:3306/sshmemo">
</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="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>amigo/sshmemo/dao/User.hbm.xm</value>
<value>amigo/sshmemo/dao/Memo.hbm.xm</value>
<value>amigo/sshmemo/dao/memoType.hbm.xm</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="show_sql">true</prop>
<prop key="hibernate.jdbc.batch_size">20</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="transactionInterceptor"/>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="login*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<bean id="beanNameAutoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<!-- 需要自动创建事务代理的bean -->
<value>*Dao</value>
</list>
<!-- 此处可增加其他需要自动创建食物代理的bean -->
</property>
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
</list>
</property>
</bean>
<bean id="baseDao" class="amigo.sshmemo.dao.BaseDaoImpl">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="userManager" class="amigo.sshmemo.service.user.UserManagerImpl">
<property name="dao">
<ref bean="baseDao"/>
</property>
</bean>
<bean id="userAction" class="amigo.sshmemo.service.user.UserAction">
<property name="userManager">
<ref bean="userManager"/>
</property>
</bean>
</beans>
在里面啊
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.custom.i18n.resources" value="validationMessages"/>
<constant name="struts.locale" value="zh_CN"/>
<constant name="struts.i18n.encoding" value="utf-8"/> <include file="struts-default.xml"/>
<package name="amigo" extends="struts-default">
<action name="*UserAction" class="userAction" method="{1}">
<result name="list">/user/userList.jsp</result>
<result name="update">/user/updateUser.jsp</result>
<result name="main">/user/main.jsp</result>
<result name="login">/user/login.jsp</result>
<result name="success">/success.jsp</result>
<result name="error">/errot.jsp</result>
</action>
</package></struts>
这个应该也没问题啊applicationContext.xml里面要怎么配置啊