ssh中spring的配置文件如何配置属性可以在控制台输出hibernate的sql语句?

ssh中spring的配置文件如何配置属性可以在控制台输出hibernate的sql语句? 谢谢

class="org.apache.commons.dbcp.BasicDataSource">
value="com.mysql.jdbc.Driver">





class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">






org.hibernate.dialect.MySQLDialect





com/fff/dao/TZgxx.hbm.xml
com/fff/dao/TGrgzxx.hbm.xml

3个回答

[code="java"]


org.hibernate.dialect.MySQLDialect
true
true


[/code]
最好加上hibernate.format_sql格式化你的sql

那个是配在hibernate.cfg.xml里面的,

true

然后在applicationContext.xml中配:
[code="java"]


${hibernate.dialect}
${hibernate.show_sql}
${hibernate.jdbc.fetch_size}
${hibernate.jdbc.batch_size}
${hibernate.connection.release_mode}


[/code]

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
log4j 与ssh框架日志输出问题

log4j我知道是日志软件,但我现在想不明白的是项目中加了log4j,然后在log4j配置文件中写它的输出格式,我的项目是ssh框架,spring,struts2输出的日志是按照log4j的格式输出,为什么hibernate没有??还有我就是想问这三大框架的日志也是log4j输出的吗

项目启动了,但是请求发送过去,页面一直在加载,控制台也不打印日志信息?求助!求大神急救

信息: No Spring WebApplicationInitializer types detected on classpath 九月 30, 2017 12:54:54 上午 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 刚启动时打印的日志!在发送请求还是卡死,控制台没记录打印,之前是没有加载mapper.xml文件在pom文件配置了下,就这样,求解

myeclipse7.0 配置SSH问题?

myeclipse7.0 配置SSH问题: 在配置SPRING的配置文件时,用mappingLocations写 /*在控制台加载测试时会报找不到文件,而且把*换成文件名,就可以了,请问这是为什么啊?有知道的么?小弟是新手。 以下这样就不报错: <property name="mappingLocations"> <list> <value>classpath:config/hbm/TbPerson.hbm.xml</value> </list> </property> [color=red][color=red]报错: <property name="mappingLocations"> <list> <value>classpath:config/hbm/*</value> </list> </property>[/color][/color] spring2.0+hibernate3.1 [b]问题补充:[/b] <property name="mappingLocations"> <list> <value>classpath:config/hbm/*hbm.xml</value> </list> </property> 原来也加过了。。也不行。。不知道为什么。。谁遇到这样的问题呢。。 [b]问题补充:[/b] - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@30d82d: defining beans [dataSource,sessionFactory,personDaoImpl,personServImpl,/login]; root of factory hierarchy - Hibernate 3.1.3 - hibernate.properties not found - using CGLIB reflection optimizer - using JDK 1.4 java.sql.Timestamp handling Exception in thread "main" org.springframework.beans.factory.BeanCreationException: [color=red]Error creating bean with name 'sessionFactory' defined in class path resource [config/spring/applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [config/hbm/**.hbm.xml] cannot be opened because it does not exist Caused by: java.io.FileNotFoundException: class path resource [config/hbm/**.hbm.xml] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:135) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:656) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:134) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1203)[/color]- 报这个错。是不是MYECLIPSE7.0有问题啊。在5.5上就不报错。没事。而且TOMCAT启动也不报错

SSH中Struts2获取不到jsp页面中值,求大神指点

ssh框架整合,添加员工信息; 员工,Emp: ``` package com.blue.entity; public class Emp { //id,数据库中为标识列 private int empId; //姓名 private String empName; //年龄 private int empAge; //性别 private String empSex; public int getEmpId() { return empId; } public void setEmpId(int empId) { this.empId = empId; } public String getEmpName() { return empName; } public void setEmpName(String empName) { this.empName = empName; } public int getEmpAge() { return empAge; } public void setEmpAge(int empAge) { this.empAge = empAge; } public String getEmpSex() { return empSex; } public void setEmpSex(String empSex) { this.empSex = empSex; } } ``` jsp页面,form: ``` <form action="empLogin" method="post"> <table width="300px" height="150px" border="1px"> <tr> <td width="100px">姓名:</td> <td><input type="text" name="emp.empName"/></td> </tr> <tr> <td>年龄:</td> <td><input type="text" name="emp.empAge"/></td> </tr> <tr> <td>性别:</td> <td><input type="text" name="emp.empSex"/></td> </tr> <tr> <td colspan="2"><input type="submit" value="保存"></td> </tr> </table> </form> ``` action: ``` package com.blue.action; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.blue.entity.Emp; import com.blue.service.EmpService; import com.opensymphony.xwork2.ActionSupport; public class EmpAction extends ActionSupport{ public String result(){ ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml"); EmpService empService= (EmpService) context.getBean("empService"); Emp emp = (Emp) context.getBean("emp"); //测试 System.out.println("id:"+emp.getEmpId()+" name:"+emp.getEmpName()+" age:"+emp.getEmpAge()+" sex:"+emp.getEmpSex()); int num = empService.save(emp); if(num == -1){ //值为空 return "empty"; }else if(num > 0){ //添加成功 return SUCCESS; }else{ //失败 return ERROR; } } } 控制台输出: id:0 name:null age:0 sex:null ``` spring配置文件(beans.xml): ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd"> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="configLocation"> <value> classpath:hibernate.cfg.xml </value> </property> </bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <bean id="emp" class="com.blue.entity.Emp"></bean> <bean id="empDao" class="com.blue.dao.impl.EmpDaoImpl"> <property name="hibernateTemplate" ref="hibernateTemplate"></property> </bean> <bean id="empService" class="com.blue.service.impl.EmpServiceImpl"> <property name="empDao" ref="empDao"></property> </bean> <bean id="empAction" class="com.blue.action.EmpAction" scope="prototype"></bean> </beans> ``` struts.xml: ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <constant name="struts.objectFactory" value="spring"></constant> <package name="default" namespace="/" extends="struts-default"> <action name="empLogin" class="com.blue.action.EmpAction" method="result"> <result name="success">welcome.jsp</result> <result name="error">error.jsp</result> <!-- 空值 --> <result name="empty">empty.jsp</result> </action> </package> </struts> ``` 包结构: ![图片说明](https://img-ask.csdn.net/upload/201610/02/1475398814_503001.png) 取不到页面值,求大神指点

SSH搭建好了之后开始测试Struts的Action 转到自己写的404页面

按照李刚的struts讲义写的action 功能是输入用户名密码之后跳转到另外的jsp页面.但是每次都出来404页面.请问是哪边配置有问题? 如果另外ssh框架也没建好还请指正.以下是代码[code="web.xml"]<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>Archetype Created Web Application</display-name> <!-- 以下3项参数与log4j的配置相关 --> <listener> <listener-class> org.springframework.web.util.Log4jConfigListener </listener-class> </listener> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/log4j.properties</param-value> </context-param> <context-param> <param-name>log4jRefreshInterval</param-name> <param-value>60000</param-value> </context-param> <!-- 默认情况下,会加载WEB-INF/applicationContext.xml这个文件,我们可以通过配置 contextConfigLocation参数改变配置文件的路径 --> <!-- Spring ApplicationContext配置文件的路径,可使用通配符,多个路径用,号分隔 此参数用于后面的Spring-Context loader --> <!-- 使容器启动时,自动加载applicationContext配置,因为它实现了ServletContextListener这个接口,容器启动时会自动执行它实现的方法。 --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:*/ApplicationContext.xml,*/action-Servlet.xml</param-value> </context-param> <!-- 加载spring容器 --> <!-- 整合struts 加入中心拦截器 --> <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class> <init-param> <param-name>struts.action.extendion</param-name> <param-value>action</param-value> </init-param> </filter> <!-- <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>--> <!-- Struts --> <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.xml</param-value></init-param> <load-on-startup>2</load-on-startup> </servlet> <!-- session超时定义,单位为分钟 --> <session-config> <session-timeout>120</session-timeout> </session-config> <!-- 默认首页定义 --> <welcome-file-list> <welcome-file>login2.jsp</welcome-file> </welcome-file-list> <!-- Error Page定义 --> <error-page> <exception-type>java.lang.Throwable</exception-type> <location>/commons/error.jsp</location> </error-page> <error-page> <error-code>500</error-code> <location>/commons/error.jsp</location> </error-page> <error-page> <error-code>404</error-code> <location>/commons/404.jsp</location> </error-page> <error-page> <error-code>403</error-code> <location>/commons/403.jsp</location> </error-page> </web-app> [/code] [code="strut.xml"]<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.devMode" value="true"/> <constant name="struts.objectFactory" value="spring" ></constant> <package name="calvin" extends="struts-default"> <action name="login" class="/loginAction"> <result name="error">index.jsp</result> <result name="success">/pages/index.jsp</result> </action> </package> </struts>[/code] [code="ApplicationContext.xml"]<?xml version="1.0" encoding="UTF-8"?> <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-3.0.xsd"> <!-- Spring容器配置文件 --> <!-- 告诉spring hibernate文件的位置 然后加载 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/policemanagement?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf-8"/> <property name="username" value="root"/> <property name="password" value="rooot"/> <property name="maxActive" value="100"/> <property name="maxIdle" value="30"/> <property name="maxWait" value="1000"/> <property name="defaultAutoCommit" value="true"/> <property name="removeAbandoned" value="true"/> <property name="removeAbandonedTimeout" value="60"/> <property name="logAbandoned" value="true"/> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="mappingResources" > <list> <value>calvin/po/pojo/hbm/arrestedPerson.hbm.xml</value> <value>calvin/po/pojo/hbm/caseRegisted.hbm.xml</value> <value>calvin/po/pojo/hbm/caseThread.hbm.xml</value> <value>calvin/po/pojo/hbm/caseVictim.hbm.xml</value> <value>calvin/po/pojo/hbm/policeOfficer.hbm.xml</value> <value>calvin/po/pojo/hbm/victimOffice.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props><prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hbm2ddl.auto">create</prop> </props> </property> </bean> <!-- 为hibernte配置事务管理器 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- daoContext 配置原因 所以放在这边 --> <bean id="dao" class="calvin.dao.imp.BaseDAOHibernate"> <property name="sessionFactory" ref="sessionFactory" /></bean> <bean id="policeOfficerDAO" class="calvin.dao.imp.PoliceOfficerImp"> <property name="sessionFactory" ref="sessionFactory" /></bean> <bean id="arrestedPersonDAO" class="calvin.dao.imp.ArrestedPersonImp"> <property name="sessionFactory" ref="sessionFactory" /></bean> <bean id="caseRegisteredDAO" class="calvin.dao.imp.CaseRegisteredImp"> <property name="sessionFactory" ref="sessionFactory" /></bean> <bean id="caseThreadDAO" class="calvin.dao.imp.CaseThreadImp"> <property name="sessionFactory" ref="sessionFactory" /></bean> <bean id="caseVictimDAO" class="calvin.dao.imp.CaseVictimImp"> <property name="sessionFactory" ref="sessionFactory" /></bean> <bean id="victimOfficeDAO" class="calvin.dao.imp.VictimOfficeImp"> <property name="sessionFactory" ref="sessionFactory" /></bean> <!-- ENd --> <!-- IOC 注入机制 --> <!-- 定义事务模板类 --> <bean id="txProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <!-- 注入事务管理器 --> <property name="transactionManager" ref="transactionManager"/> <property name="transactionAttributes"> <props> <prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="remove*">PROPAGATION_REQUIRED</prop> <prop key="*">PROPAGATION_REQUIRED,readOnly</prop> </props> </property></bean> <!-- 配置具体业务逻辑层组件的事物代理 --> <bean id="manager" parent="txProxyTemplate"> <property name="target"> <bean class="calvin.service.BaseManager"> <property name="dao" ref="dao"/> </bean> </property> </bean> <!-- 配置具体的业务逻辑组件额事务代理 --> <!-- 配置业务逻辑组件的事务代理,使用了bean 的继承 --> <!-- 配置所需要的dao组件!!!即这里用的是dao的名字 --> <bean id="facadeManager" parent="txProxyTemplate"> <!-- 配置事务代理时,指定代理的目标,此处的目标是嵌套bean--> <property name="target"> <!-- 嵌套bean无须使用 id属性--> <bean class="calvin.service.imp.FacadeManagerImp"> <!-- 为业务逻辑组件注入DAO组件 --> <property name="victimOfficeDAO" ref="victimOfficeDAO"/> <property name="policeOfficerDAO" ref="policeOfficerDAO"/> <property name="caseVictimDAO" ref="caseVictimDAO"/> <property name="caseThreadDAO" ref="caseThreadDAO"/> <property name="caseRegisteredDAO" ref="caseRegisteredDAO"/> <property name="arrestedPersonDAO" ref="arrestedPersonDAO"/> </bean></property> </bean> <!-- action --> <bean id="myService" class="calvin.action.test.MyServiceImp"/> <bean name="/loginAction" class="calvin.action.LoginAction" scope="prototype"> <property name="ms" ref="myService"/> </bean> </beans>[/code] [code="LoginAction"]package calvin.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.junit.Test; import calvin.action.baseAction.BaseAction; import calvin.action.test.MyService; import calvin.po.pojo.PoliceOfficer; public class LoginAction extends BaseAction{ private String username; private String password; private MyService ms; public MyService getMs() { return ms; } public void setMs(MyService ms) { this.ms = ms; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Override public String execute() throws Exception{ System.out.println("AAA"); if(ms.valid(getUsername(),getPassword())){ return new String("success"); }else{ return "error";} } } [/code] [code="MyServiceImp"]package calvin.action.test; public class MyServiceImp implements MyService{ public boolean valid(String username,String pass){ return true; } } [/code] 首页配置就是一个很简单的登陆页面.

使用ssh框架做新增功能时无法将数据写入数据库

在spring配置文件中配置了事务管理 <!-- 配置事务管理器 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <!-- 开启事务注解 --> <tx:annotation-driven transaction-manager="transactionManager"/> <!-- 开启注解扫描 --> <context:component-scan base-package="com"></context:component-scan > 而且在类上面也开启了事务注解: import javax.transaction.Transactional; import com.dao.YongHuDao; import com.entity.YongHu; import com.service.YongHuService; @Transactional public class YongHuServiceImpl implements YongHuService { private YongHuDao yhdi; @Override public void add(YongHu t) { yhdi.add(t); } 控制台没有错误信息,只输出一条查询伪表id的sql语句: DEBUG - Found thread-bound Session for HibernateTemplate DEBUG - trace com.mchange.v2.resourcepool.BasicResourcePool@58aff4cd [managed: 3, unused: 2, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@49056629) Hibernate: select hibernate_sequence.nextval from dual DEBUG - Not closing pre-bound Hibernate Session after HibernateTemplate hahahhaah26hahahahhahha DEBUG - Entering nullPropertyValue [target=[com.entity.YongHu@2e81070, com.action.UserAction@3e625613, com.opensymphony.xwork2.DefaultTextProvider@17e36931], property=struts] DEBUG - Entering nullPropertyValue [target=[com.entity.YongHu@2e81070, com.action.UserAction@3e625613, com.opensymphony.xwork2.DefaultTextProvider@17e36931], property=org] DEBUG - after Locale=zh_CN 实在找不出哪里错了,求大神解答

SSH框架中的有关数据库的问题

我其他没有问题,就是连接数据库可能有问题,但是程序也能初始化成功,但在执行具体sql的时候,不能执行 [b]java.lang.NullPointerException at com.test.dao.BaseDaoImpl.loadObject(BaseDaoImpl.java:29) at com.test.service.impl.UserServiceImpl.selectUserByNumber(UserServiceImpl.java:38) at com.test.struts.action.UserAction.selectUserByNumber(UserAction.java:90) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.test.struts.interceptor.LoggerInterceptor.intercept(LoggerInterceptor.java:42) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.TimerInterceptor.invokeUnderTiming(TimerInterceptor.java:124) at com.opensymphony.xwork2.interceptor.TimerInterceptor.intercept(TimerInterceptor.java:111) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source)[/b] 这是我的其中spring和hibernate的配置文件 [code="java"] <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- 开启注解处理器 --> <context:annotation-config/> <!-- 定义使用C3P0连接池的数据源 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <!-- 指定连接数据库的JDBC驱动 --> <property name="driverClass"> <value>com.mysql.jdbc.Driver</value> </property> <!-- 连接数据库所用的URL --> <property name="jdbcUrl"> <value>jdbc:mysql://localhost:3306/softtest?useUnicode=true&amp;characterEncoding=utf-8</value> </property> <!-- 连接数据库的用户名 --> <property name="user"> <value>root</value> </property> <!-- 连接数据库的密码 --> <property name="password"> <value>root</value> </property> <!-- 设置数据库连接池的最大连接数 --> <property name="maxPoolSize"> <value>20</value> </property> <!-- 设置数据库连接池的最小连接数 --> <property name="minPoolSize"> <value>2</value> </property> <!-- 设置数据库连接池的初始化连接数 --> <property name="initialPoolSize"> <value>2</value> </property> <!-- 设置数据库连接池的连接的最大空闲时间,单位为秒 --> <property name="maxIdleTime"> <value>20</value> </property> </bean> <!-- 定义Hibernate的SessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <!-- 依赖注入上面定义的数据源dataSource --> <property name="dataSource" ref="dataSource"/> <!-- 注册Hibernate的ORM映射文件 --> <property name="mappingResources"> <list> <value>com/test/orm/FaultInfo.hbm.xml</value> <value>com/test/orm/ModelInfo.hbm.xml</value> <value>com/test/orm/ProjectInfo.hbm.xml</value> <value>com/test/orm/UserInfo.hbm.xml</value> <value>com/test/orm/UserModel.hbm.xml</value> <value>com/test/orm/UserFault.hbm.xml</value> <value>com/test/orm/UserProject.hbm.xml</value> <value>com/test/orm/FaultType.hbm.xml</value> <value>com/test/orm/Logger.hbm.xml</value> </list> </property> <!-- 设置Hibernate的相关属性 --> <property name="hibernateProperties"> <props> <!-- 设置Hibernate的数据库方言 --> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <!-- 设置Hibernate是否在控制台输出SQL语句,开发调试阶段通常设为true --> <prop key="show_sql">true</prop> <!-- 设置Hibernate一个提交批次中的最大SQL语句数 --> <prop key="hibernate.jdbc.batch_size">50</prop> </props> </property> </bean> <!--定义Hibernate的事务管理器HibernateTransactionManager --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <!-- 依赖注入上面定义的sessionFactory --> <property name="sessionFactory" ref="sessionFactory"/> </bean> <!-- 装配HibernateTemplate实例 --> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <constructor-arg ref="sessionFactory"/> </bean> </beans> [/code] 这是我的数据库操作代码 [code="java"] public Object loadObject(String hql) { final String hql1 = hql; Object obj = null; try { List list = hibernateTemplate.executeFind(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Query query = session.createQuery(hql1); return query.list(); } }); if (list.size() > 0) { obj = list.get(0); } } catch (Exception e) { e.printStackTrace(); } return obj; } [/code]

SSH框架的InvalidDataAccessApiUsageException问题

在SSH项目中,执行save方法时报错,求解答。 ``` org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition. ``` spring配置文件 ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- 配置spring创建容器时要扫描的包 --> <context:component-scan base-package="com.wzjpro"></context:component-scan> <!-- 配置hibernateTemplate --> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate5.HibernateTemplate"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <!-- 配置sessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"> <!-- 连接数据库,用连接池 --> <property name="dataSource" ref="dataSource"></property> <!-- hibernate的可选配置 --> <property name="hibernateProperties"> <props> <!-- 数据库的方言 --> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <!--是否显示hibernate生成的SQL语句 --> <prop key="hibernate.show_sql">true</prop> <!-- 是否使用格式化输出sql语句的控制台 --> <prop key="hibernate.format_sql">false</prop> <!-- 配置hibernate采用何种方式生成DDL语句 --> <prop key="hibernate.hbm2ddl.auto">update</prop> <!-- 把session和线程绑定,从而实现一个线程只有一个Session --> <prop key="hibernate.current_session_context_class">org.springframework.hibernate5.SpringSessionContext</prop> </props> </property> <!-- 指定映射文件的位置 --> <property name="packagesToScan"> <array> <value>com.wzjpro.domain</value> </array> </property> </bean> <!-- 配置dataSource --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="com.mysql.jdbc.Driver"></property> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/crm_ssh"></property> <property name="user" value="root"></property> <property name="password" value="123456"></property> </bean> <!-- 配置事务管理器 --> <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <!-- 开启spring对注解事务的支持 --> <tx:annotation-driven transaction-manager="transactionManager"/> <!-- 在业务层需要使用事务的地方使用@Transactional注解 --> </beans> ``` 业务层代码 ``` package com.wzjpro.service.impl; import java.util.List; import javax.annotation.Resource; import org.hibernate.criterion.DetachedCriteria; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import com.wzjpro.dao.ICustomerDao; import com.wzjpro.domain.Customer; import com.wzjpro.service.ICustomerService; /** * 客户的业务层实现类 * @author Administrator * */ @Service("customerService") @Transactional(readOnly=true,propagation=Propagation.SUPPORTS) public class CustomerServiceImpl implements ICustomerService { @Resource(name="customerDao") private ICustomerDao customerDao; @Override public List<Customer> findAllCustomer(DetachedCriteria dCriteria) { return customerDao.findAllCustomer(dCriteria); } @Override @Transactional(readOnly=false,propagation=Propagation.REQUIRED) public void saveCustomer(Customer customer) { customerDao.save(customer); } } ```

整合Spring+SpringMVC+Hibernate时,无法进入控制层

整合Spring+SpringMVC+Hibernate时,启动正常,可以打开登录页面,但是进行登录时,无法进入controller层,而且不报错,只输出三行日志。 DispatcherServlet with name 'springMVC' processing POST request for [/SSH/user/login.do] No mapping found for HTTP request with URI [/SSH/user/login.do] in DispatcherServlet with name 'springMVC' Successfully completed request 意思大概是找不到路径,但应该不是路径的问题,如果路径有问题,页面上message会显示有问题的路径,而不是什么都没有。 HTTP Status 404 - type Status report message description The requested resource is not available. Apache Tomcat/7.0.82 spring-context.xml配置是这样的 <!-- 自动扫描 --> <context:component-scan base-package="service,dao,entity,controller"/> <!-- 配置数据源 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" > <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" /> <property name="url" value="jdbc:sqlserver://localhost:1433;database=user_role" /> <property name="username" value="sa"/> <property name="password" value="123456"/> </bean> <!-- 配置SessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop> <!--指定数据库方言--> <prop key="hibernate.hbm2ddl.auto">update</prop> <!--hibernate根据实体自动生成数据库表--> <prop key="hibernate.show_sql">true</prop> <!--在控制台显示执行的数据库操作语句--> <prop key="hibernate.format_sql">true</prop> <!--在控制台显示执行的数据库操作语句(格式)--> </props> </property> <property name="annotatedClasses"> <list> <value>entity</value> </list> </property> </bean> <!-- <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <bean id="userDao" class ="dao.UserDao"> <property name="sessionFactory" ref="sessionFactory" /> <property name="hibernateTemplate" ref="hibernateTemplate" /> </bean> --> <!-- 开启注解事务 --> <tx:annotation-driven transaction-manager="transactionManager"/> <!-- 事物管理器配置 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 配置事务,使用代理的方式 --> <bean id="transactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true"> <property name="transactionManager" ref="transactionManager"></property> <property name="transactionAttributes"> <props> <prop key="add*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="modify*">PROPAGATION_REQUIRED,-myException</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> spring-mvc.xml配置 <!-- 开启注解 --> <mvc:annotation-driven /> <!-- 注解扫描包 --> <context:component-scan base-package="controller" /> <!-- 静态资源(js/image)的访问 --> <mvc:resources location="/js/" mapping="/js/**"/> <!-- 定义视图解析器 --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/jsp/"></property> <property name="suffix" value=".jsp"></property> </bean> web配置 <display-name>SSH</display-name> <welcome-file-list> <welcome-file>login.jsp</welcome-file> </welcome-file-list> <!-- 加载所有的配置文件 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:config/spring-context.xml</param-value> </context-param> <!-- 配置Spring监听 --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- 防止Spring内存溢出监听器 --> <listener> <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class> </listener> <!-- 配置SpringMVC --> <servlet> <servlet-name>springMVC</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:config/spring-mvc.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springMVC</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <!-- 配置字符集 --> <filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- 如果OpenSession加了*号,启动时会报错,找不到名为sessionFactory的bean --> <!-- 配置Session --> <filter> <filter-name>openSession</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>openSession</filter-name> <url-pattern>/</url-pattern> </filter-mapping>

SSH ACTION异常 很奇怪 麻烦大神看下

异常信息 There is no Action mapped for namespace [/dd] and action name [laladList] associated with context path [/baee]. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185) at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63) at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:501) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619) OrderAction.java public void lalad() throws Exception { System.out.println("lalad()被执行到了"); //return null; } applicationContext.xml <bean id="OrderActionBean" class="cn.baee.action.OrderAction" scope="prototype"> <property name="services" ref="GenericServiceImplBean"></property> </bean> struts.xml 文件位置:/WEB-INF/classes <!-- 加载国际资源文件 --> <constant name="struts.custom.i18n.resources" value="cn.baee.config.langResource"></constant> <!-- 将Action的创建交给spring来管理 --> <constant name="struts.objectFactory" value="spring" /> <!-- 去掉struts2请求后缀 --> <constant name="struts.action.extension" value=","></constant> <package name="dd" namespace="/dd" extends="struts-default"> <action name="*List?indexPage=*" method="{1}" class="OrderActionBean" > <param name="indexPage">{2}</param> <result name="success" type="redirectAction"> <param name="actionName">cc</param> </result> </action> </package> web.xml 文件位置:/WEB-INF/ <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> <init-param> <param-name>config</param-name> <param-value>struts-default.xml,struts-plugin.xml,struts.xml</param-value> </init-param> </filter> <filter-mapping> <filter-name>UrlRewriteFilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> 问题描述: (1)<s:action name="laladList?indexPage=1" executeResult="true" namespace="/dd"/> (2)http://localhost:8080/baee/dd/laladList?indexPage=1 执行(1)语句的时候没有任何问题,控制台输出了相应的东西,表示我的配置没有任何问题可以正常运行。 执行(2)直接在浏览器访问这个网址的时候却出现了上面的异常,控制台也没有输出,表示根本没有到Acion的这个方法里。 我要实现的效果是利用<a>标签访问Action我指定的这个方法并且可以动态传递参数给它,所有我直接编写了绝对路径去访问这个Action 但是不行,我就很疑惑了,百度了一圈还是解决不了。 附加:如果我没传递任何参数、类似于直接访问(http://localhost:8080/baee/dd/laladList)是可以正常运行的,但是我动态传递了参数进去 就是出现上面的404 找不到这个ACTION的异常。

spring2.5事务注解

用到的是spring2.5的注解方式配置事务。 在接口中加入@Transactional这个就会报错,否则正常。 配置文件。 [code="java"]<?xml version="1.0" encoding="UTF-8" ?> <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" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> <bean id="db-properties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" p:ignoreUnresolvablePlaceholders="true"> <property name="locations"> <list> <value>classpath:DataBase.properties </value> </list> </property> </bean> <tx:annotation-driven transaction-manager="transactionManager"/> <!-- 配置同一个数据源 --> <bean id="daoTemplate" abstract="true" lazy-init="true"> <property name="dataSource" ref="dataSource" /> </bean> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>${db.driver}</value> </property> <property name="url"> <value>${db.url}</value> </property> <property name="username"> <value>${db.username}</value> </property> <property name="password"> <value>${db.password}</value> </property> <property name="initialSize"> <value>${db.pool.initial}</value> </property> <property name="maxActive"> <value>${db.pool.max}</value> </property> <property name="defaultAutoCommit" value="false" /> </bean> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" p:dataSource-ref="dataSource" /> <bean id="threadPoolTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"> <property name="corePoolSize" value="2" /> <property name="keepAliveSeconds" value="200" /> <property name="maxPoolSize" value="10" /> <property name="queueCapacity" value="60" /> </bean> <bean id="transactionTemplate" class="org.springframework.transaction.support.TransactionTemplate"> <property name="transactionManager"> <ref bean="transactionManager" /> </property> </bean> </beans>[/code] 接口代码: [code="java"] import javax.jws.WebService; import javax.ws.rs.core.Response; import org.springframework.transaction.annotation.Transactional; import com.sns.bestv.entity.VisFclass; import com.sns.bestv.service.impl.VisFclassServiceImpl.Fclasses; @WebService @Transactional public interface VisFclassService { Response save(VisFclass fclass); Response delete(String app_key,int cid,String groupsids); Response update(VisFclass fclass); Fclasses get(String app_key,int cid); } [/code] 启动时候控制台错误信息: [code="java"] 2009-9-1 20:57:07 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: E:\java\jdk1.6.0_13\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;E:\java\jdk1.6.0_13\jre\bin;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Java\jdk1.6.0_13\BIN;C:\Program Files\Common Files\Adobe\AGL;;C:\Program Files\Common Files\Thunder Network\KanKan\Codecs;C:\Program Files\TortoiseSVN\bin;D:\;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;d:\Program Files\SSH Secure Shell;C:\Program Files\SSH Communications Security\SSH Secure Shell 2009-9-1 20:57:07 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8081 2009-9-1 20:57:07 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 763 ms 2009-9-1 20:57:07 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2009-9-1 20:57:07 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.18 log4j:ERROR Parsing error on line 30 and column 23 log4j:ERROR The content of element type "log4j:configuration" must match "(renderer*,appender*,(category|logger)*,root?,categoryFactory?)". 2009-9-1 20:57:08 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext 20:57:08,359 INFO org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189): Root WebApplicationContext: initialization started 20:57:08,437 INFO org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:411): Refreshing org.springframework.web.context.support.XmlWebApplicationContext@db95a1: display name [Root WebApplicationContext]; startup date [Tue Sep 01 20:57:08 CST 2009]; root of context hierarchy 20:57:08,609 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:323): Loading XML bean definitions from class path resource [applicationContext.xml] 20:57:08,937 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:323): Loading XML bean definitions from class path resource [serviceContext.xml] 20:57:09,000 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:323): Loading XML bean definitions from class path resource [META-INF/cxf/cxf.xml] 20:57:09,046 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:323): Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-soap.xml] 20:57:09,093 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:323): Loading XML bean definitions from class path resource [META-INF/cxf/cxf-servlet.xml] 20:57:09,187 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:323): Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-jaxrs-binding.xml] 20:57:09,296 INFO org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:426): Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@db95a1]: org.springframework.beans.factory.support.DefaultListableBeanFactory@138847d 20:57:09,671 INFO org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:178): Loading properties file from class path resource [DataBase.properties] 20:57:10,000 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:414): Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@138847d: defining beans [db-properties,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,daoTemplate,dataSource,transactionManager,userDao,customerDao,custUserDao,aipUsersDao,aipLogDao,postDao,friendDao,messageDao,fclassDao,userClassDao,customizeDao,threadPoolTaskExecutor,transactionTemplate,cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,org.apache.cxf.jaxrs.JAXRSBindingFactory,userServices,profileService,postService,friendService,messageService,groupService,custermerService,customizeService,userServices_wa]; root of factory hierarchy 20:57:10,500 INFO org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor.initialize(ThreadPoolTaskExecutor.java:250): Initializing ThreadPoolExecutor 'threadPoolTaskExecutor' 2009-9-1 20:57:12 org.apache.cxf.jaxrs.utils.InjectionUtils reportServerError 严重: Method setMessageContext injection failure 20:57:12,968 INFO org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:421): Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@138847d: defining beans [db-properties,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,daoTemplate,dataSource,transactionManager,userDao,customerDao,custUserDao,aipUsersDao,aipLogDao,postDao,friendDao,messageDao,fclassDao,userClassDao,customizeDao,threadPoolTaskExecutor,transactionTemplate,cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,org.apache.cxf.jaxrs.JAXRSBindingFactory,userServices,profileService,postService,friendService,messageService,groupService,custermerService,customizeService,userServices_wa]; root of factory hierarchy 20:57:12,984 INFO org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor.shutdown(ThreadPoolTaskExecutor.java:349): Shutting down ThreadPoolExecutor 'threadPoolTaskExecutor' 20:57:12,984 ERROR org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:215): Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServices_wa': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: org.apache.cxf.service.factory.ServiceConstructionException at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) ... 30 more Caused by: javax.ws.rs.WebApplicationException at org.apache.cxf.jaxrs.utils.InjectionUtils.reportServerError(InjectionUtils.java:277) at org.apache.cxf.jaxrs.utils.InjectionUtils.injectThroughMethod(InjectionUtils.java:190) at org.apache.cxf.jaxrs.utils.InjectionUtils.injectContextProxies(InjectionUtils.java:656) at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.injectContexts(JAXRSServerFactoryBean.java:180) at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.updateClassResourceProviders(JAXRSServerFactoryBean.java:201) at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:81) ... 37 more 2009-9-1 20:57:13 org.apache.catalina.core.StandardContext listenerStart 严重: 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 'userServices_wa': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: org.apache.cxf.service.factory.ServiceConstructionException at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) ... 30 more Caused by: javax.ws.rs.WebApplicationException at org.apache.cxf.jaxrs.utils.InjectionUtils.reportServerError(InjectionUtils.java:277) at org.apache.cxf.jaxrs.utils.InjectionUtils.injectThroughMethod(InjectionUtils.java:190) at org.apache.cxf.jaxrs.utils.InjectionUtils.injectContextProxies(InjectionUtils.java:656) at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.injectContexts(JAXRSServerFactoryBean.java:180) at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.updateClassResourceProviders(JAXRSServerFactoryBean.java:201) at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:81) ... 37 more 2009-9-1 20:57:13 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 2009-9-1 20:57:13 org.apache.catalina.core.StandardContext start 严重: Context [] startup failed due to previous errors 2009-9-1 20:57:13 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext 2009-9-1 20:57:13 org.apache.coyote.http11.Http11Protocol start 信息: Starting Coyote HTTP/1.1 on http-8081 2009-9-1 20:57:13 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:9009 2009-9-1 20:57:13 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/47 config=null 2009-9-1 20:57:13 org.apache.catalina.startup.Catalina start 信息: Server startup in 6270 ms [/code] [b]问题补充:[/b] 1:@Transactional 不是说用注解就得用接口吗?你说的加到实现类上我也试了一样的错误。 2:[code="java"]<bean id="threadPoolTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"> <property name="corePoolSize" value="2" /> <property name="keepAliveSeconds" value="200" /> <property name="maxPoolSize" value="10" /> <property name="queueCapacity" value="60" /> </bean> [/code] 这是连接池的东西。 3: <!-- 定义切入点,引用事务通知 --> [code="java"]<aop:config proxy-target-class="true"> <aop:advisor advice-ref="txAdvice" pointcut="execution (* com.mobile.dao.*.*(..))"/>[/code] </aop:config> 这种方式我试过了。也会出错。 [b]4:其二,既然你要用注解的方式,那么你就要在你的项目中,加入这两个jar包:aspectjweaver.jar aspectjrt.jar 我好像没加这两个包。我加加试试。[/b] 5:配置文件哪里有问题?如果我不在接口或类上加@Transactional 就是完全正确的运行。 谢谢!请帮忙! [b]问题补充:[/b] [b]再补充:两个包我加了,还是一样的错误。而且那两个包是aop才需要的吧?[/b] [b]问题补充:[/b] [b][color=darkred]yangtao309[/color][/b] 按照你说的把那个多余的连接池delete了。程序不会出错了。 但是不会回滚事务? 那我另问一下:[color=blue]我把@Transactional(readOnly=false) public Response addCustomer(VisCustomer cut) 放在一个接口的实现类的方法上面,那是不是就说我这个方法体都具有一个相同的事务呢?只要其中一个地方出错整个方法都执行失败? 因为我这个方法内不止使用了一个dao的一个方法,有多个方法。比如我现在有 table1,table1-2(关系表),table2 我现在要操作table1,给其insert ,insert之后要向 table1-2中添加一条数据,这时我添加table1-2时出错了,那么我操作table1的数据可以回滚吗? [/color] [b]问题补充:[/b] [b]我添加table1-2时并没有异常,是在数据库中被回滚的,程序中执行是正确的。这样能把它在程序中就回滚了吗?我正在看spring2.5的开发参考手册,其中rollbackForClassname 是定义一组类的名字,必须是Throwable的子类,遇到时必须回滚。如果我产生不了异常不就是说还是回滚不了?[/b] [b]问题补充:[/b] [quote]@Transactional(readOnly=false,rollbackFor = Throwable.class)[/quote] 不能回滚事务。肯定还有地方不对。但是配置我想是没问题了。看了api现在完全按照上面来了。非常非常感谢[color=olive]yangtao309 [/color]

SSH Action 动态调用 参数 404异常

``` 1. 异常情况: 1. There is no Action mapped for namespace [/dd] and action name [laladList] associated with context path [/baee]. - [unknown location] 1. at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185) 1. at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63) 1. at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) 1. at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58) 1. at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:501) 1. at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) 1. at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) 1. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 1. web.xml 1. <?xml version="1.0" encoding="UTF-8"?> 1. <web-app version="3.0" 1. xmlns="http://java.sun.com/xml/ns/javaee" 1. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 1. xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 1. http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> 1. 1. <display-name>项目名称</display-name> 1. <description>项目描述</description> 1. 1. <jsp-config> 1. <taglib> 1. <!-- 配置标签的引用地址 JSP页面中引用时使用--> 1. <taglib-uri>/el-extends</taglib-uri> 1. <!-- 配置标签的TLD文件地址 --> 1. <taglib-location>/WEB-INF/ELExtends.tld</taglib-location> 1. </taglib> 1. </jsp-config> 1. 1. <!-- 指示服务器在收到引用一个目录名而不是文件名的URL时,使用哪个文件 --> 1. <welcome-file-list> 1. <welcome-file>index.jsp</welcome-file> 1. </welcome-file-list> 1. 1. <!-- 配置Session十分钟有效时间 --> 1. <session-config> 1. <session-timeout>10</session-timeout> 1. </session-config> 1. 1. <!-- 配置错误页面 --> 1. 1. 1. <!-- 将HibernateSession开关控制配置在Filter,保证一个请求一个session,并对lazy提供支持 --> 1. <filter> 1. <filter-name>OpenSessionInViewFilter</filter-name> 1. <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class> 1. </filter> 1. 1. <!-- 配置伪静态 --> 1. <filter> 1. <filter-name>UrlRewriteFilter</filter-name> 1. <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class> 1. </filter> 1. 1. <filter-mapping> 1. <filter-name>UrlRewriteFilter</filter-name> 1. <url-pattern>/*</url-pattern> 1. <dispatcher>REQUEST</dispatcher> 1. <dispatcher>FORWARD</dispatcher> 1. </filter-mapping> 1. 1. <!-- 配置Struts2 --> 1. <filter> 1. <filter-name>struts2</filter-name> 1. <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> 1. <init-param> 1. <param-name>config</param-name> 1. <param-value>struts-default.xml,struts-plugin.xml,struts.xml</param-value> 1. </init-param> 1. </filter> 1. 1. <filter-mapping> 1. <filter-name>struts2</filter-name> 1. <url-pattern>/*</url-pattern> 1. <dispatcher>FORWARD</dispatcher> 1. <dispatcher>REQUEST</dispatcher> 1. </filter-mapping> 1. 1. <!-- 配置Spring --> 1. <context-param> 1. <param-name>contextConfigLocation</param-name> 1. <param-value>classpath:cn/baee/config/applicationContext.*.xml</param-value> 1. </context-param> 1. <listener> 1. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 1. </listener> 1. 1. <!-- log4j的配置文件里可以用${project}来表示刚刚设进去的系统变量 --> 1. <context-param> 1. <param-name>webAppRootKey</param-name> 1. <param-value>project</param-value> 1. </context-param> 1. 1. <!-- 配置由Sprng载入的Log4j配置文件位置 --> 1. <context-param> 1. <param-name>log4jConfigLocation</param-name> 1. <param-value>/WEB-INF/classes/cn/baee/config/log.properties</param-value> 1. </context-param> 1. 1. <!-- Spring刷新Log4j配置文件变动的间隔,单位为毫秒 --> 1. <context-param> 1. <param-name>log4jRefreshInterval</param-name> 1. <param-value>10000</param-value> 1. </context-param> 1. <listener> 1. <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> 1. </listener> 1. 1. <!-- 配置监听器 --> 1. <listener> 1. <listener-class>cn.baee.listener.IniListener</listener-class> 1. </listener> 1. <listener> 1. <listener-class>cn.baee.listener.ReportsListener</listener-class> 1. </listener> 1. <listener> 1. <listener-class>cn.baee.listener.CountsListener</listener-class> 1. </listener> 1. </web-app> 1. 1. struts.xml 1. <?xml version="1.0" encoding="UTF-8" ?> 1. <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> 1. 1. <struts> 1. 1. <!-- 加载国际资源文件 --> 1. <constant name="struts.custom.i18n.resources" value="cn.baee.config.langResource"></constant> 1. 1. <!-- 将Action的创建交给spring来管理 --> 1. <constant name="struts.objectFactory" value="spring" /> 1. 1. <!-- 去掉struts2请求后缀 --> 1. <constant name="struts.action.extension" value=","></constant> 1. 1. <package name="dd" namespace="/dd" extends="struts-default"> 1. <action name="*List?id=*" method="{1}" class="OrderActionBean" > 1. <param name="id">{2}</param> 1. <!--<param name="indexPage">{2}</param>--> 1. <result name="success" type="redirectAction"> 1. <param name="actionName">cc</param> 1. </result> 1. </action> 1. </package> 1. 1. <package name="root" namespace="/" extends="struts-default"> 1. <!-- 用户中心 --> 1. <action name="i" method="i" class="UserCenterActionBean"> 1. <result name="signin">/user_center/signin.jsp</result> 1. <result name="welcome">/user_center/welcome.jsp</result> 1. <result name="system">/user_center/system.jsp</result> 1. <result name="order">/user_center/order.jsp</result> 1. </action> 1. <action name="UserCenter*" method="UserCenter{1}" class="UserCenterActionBean"> 1. <result name="success" type="redirectAction"> 1. <param name="actionName">i</param> 1. </result> 1. </action> 1. 1. <!-- 控制中心 --> 1. <action name="cc" method="cc" class="ControlCenterActionBean"> 1. <result name="signin">/control_center/signin.jsp</result> 1. <result name="welcome">/control_center/welcome.jsp</result> 1. <result name="system">/control_center/system.jsp</result> 1. <result name="order">/control_center/order.jsp</result> <!-- 订单页 --> 1. <result name="order_list">/control_center/order_list.jsp</result> <!-- 订单列表 --> 1. </action> 1. <action name="ControlCenter*" method="ControlCenter{1}" class="ControlCenterActionBean"> 1. <result name="success" type="redirectAction"> 1. <param name="actionName">cc</param> 1. </result> 1. </action> 1. <action name="ControlCenter*?id=*" method="ControlCenter{1}" class="ControlCenterActionBean"> 1. <param name="id">{2}</param> 1. <result name="success" type="redirectAction"> 1. <param name="actionName">cc</param> 1. </result> 1. </action> 1. 1. 1. <!-- 订单 --> 1. <action name="*Order?id=*;sn=*" method="{1}" class="OrderActionBean"> 1. <param name="id">{2}</param> 1. <param name="sn">{3}</param> 1. <result name="success" type="redirectAction"> 1. <param name="actionName">cc</param> 1. </result> 1. </action> 1. 1. <action name="*List?indexPage=*" method="{1}" class="OrderActionBean" > 1. <param name="indexPage">{2}</param> 1. <result name="success" type="redirectAction"> 1. <param name="actionName">cc</param> 1. </result> 1. </action> 1. <!-- 订单列表 --> 1. <action name="*OrderList?orderBusinessId=*;orderSourceTypeId=*;orderStateId=*;indexPage=*" method="{1}" class="OrderActionBean"> 1. <param name="orderBusinessId">{2}</param> 1. <param name="orderSourceTypeId">{3}</param> 1. <param name="orderStateId">{4}</param> 1. <param name="indexPage">{5}</param> 1. <result name="success" type="redirectAction"> 1. <param name="actionName">cc</param> 1. </result> 1. </action> 1. 1. </package> 1. 1. <!-- BAEE Action --> 1. <package name="baee" namespace="/Be" extends="struts-default"> 1. <action name="SiteInitialize" method="Site" class="InitializeActionBean"></action> 1. <action name="PageInitialize?pageAction=*;errorTextCode=*;illegalTextCode=*" method="Page" class="InitializeActionBean"> 1. <param name="pageAction">{1}</param> 1. <param name="errorTextCode">{2}</param> <param name="illegalTextCode">{3}</param> <result name="success" type="dispatcher"> <param name="location">/cc</param> </result> </action> <action name="BugInitialize" method="Bug" class="InitializeActionBean"></action> </package> </struts> action java package cn.baee.action; @SuppressWarnings("serial") public class OrderAction extends GenericAction { private String id; // 订单Id public String getId() { return id; } public void setId(String id) { this.id = id; } public void lalad() throws Exception { System.out.println("lalad()被执行到了" + this.getId()); //return null; } } 问题描述: (1)<s:action name="laladList?id=2" executeResult="true" namespace="/dd"/> (2)http://localhost:8080/baee/dd/laladList?id=2 执行(1)语句的时候没有任何问题,控制台输出了相应的东西,表示我的配置没有任何问题可以正常运行。 执行(2)直接在浏览器访问这个网址的时候却出现了上面的异常,控制台也没有输出,表示根本没有到Acion的这个方法里。 我要实现的效果是利用标签访问Action我指定的这个方法并且可以动态传递参数给它,所有我直接编写了绝对路径去访问这个Action 但是不行,我就很疑惑了,百度了一圈还是解决不了。 附加:如果我没传递任何参数、类似于直接访问(http://localhost:8080/baee/dd/laladList)是可以正常运行的,但是我动态传递了参数进去 就是出现上面的404 找不到这个ACTION的异常。 疑惑1:我思考了半天就是不解了,(1)(2)按理说执行的都是一模一样的东西,连参数都是一样的 为什么在<s:action>就能成功执行呢?难道就因为它指定了一个namespace? 疑惑2:在疑惑1基础上,既然是因为没有指定namespace那么为什么没有带任何参数的时候,两种访问都能成功的访问到我指定的Action的指定方法()呢? 求大神帮解决。。。。 ```

JUnit 测试hibernate添加数据控制台有insert语句,但数据库无数据

JUnit 做hibernate项目单元测试的时候,发现控制台明明打印了insert语句的日志就是没有数据 ``` 这是hbm.xml <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.gyf.hibernate.domain.User" table="tb5"> <id name="uid" column="id"> <generator class="native"></generator> </id> <property name="username"></property> <property name="password"></property> </class> </hibernate-mapping> ``` ``` 这是hibernate.cfg.xml <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- 1、配置数据库连接的4个参数 --> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql:///tb3</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password">123456</property> <!-- 是否显示sql语句 --> <property name="show_sql">true</property> <!-- 是否格式化sql语句 --> <property name="format_sql">true</property> <!-- 是否自动提交事务 --> <property name="hibernate.connection.autocommit">true</property> <!-- 2、配置JavaBean与表的映射文件 --> <mapping resource="com/gyf/hibernate/domain/User.hbm.xml"/> </session-factory> </hibernate-configuration> ``` ```这是测试 package com.gyf.hibernate.test; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.junit.Test; import com.gyf.hibernate.domain.User; public class Lesson02 { @Test public void test1(){ Configuration cfg = new Configuration().configure(); //2.创建会话工厂 SessionFactory factory = cfg.buildSessionFactory(); //3.创建会话 Session session = factory.openSession(); //开启事务 Transaction trans = session.beginTransaction(); //保存 User user = new User(); user.setUsername("gyf"); user.setPassword("123"); session.save(user); //提交事务 trans.commit(); //4.关闭会话 session.close(); //5.关闭工厂,释放资源 factory.close(); } } ```

c3p0 连接不释放 请路过的大神过来看看

配置文件如下 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> <context:annotation-config /> <!-- 打开Spring的Annotation支持 --> <!-- 设定Spring 去哪些包中找Annotation --> <context:component-scan base-package="com.myd" /> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="${driverClass}" /> <property name="jdbcUrl" value="${jdbcUrl}" /> <property name="user" value="${username}" /> <property name="password" value="${password}" /> <!-- 配置连接池的初始值 --> <property name="acquireIncrement" value="${acquireIncrement}" /> <property name="maxPoolSize" value="${maxPoolSize}" /> <property name="minPoolSize" value="${minPoolSize}" /> <property name="initialPoolSize" value="${initialPoolSize}" /> <property name="maxIdleTime" value="${maxIdleTime}" /> <property name="checkoutTimeout" value="${checkoutTimeout}" /> <property name="autoCommitOnClose" value="${autoCommitOnClose}"></property> <property name="acquireRetryDelay" value="${acquireRetryDelay}" /> <property name="idleConnectionTestPeriod" value="${idleConnectionTestPeriod}"></property> <property name="maxStatements" value="${maxStatements}"></property> <property name="numHelperThreads" value="${numHelperThreads}"></property> </bean> <!-- 导入src目录下的c3p0.properties文件 --> <context:property-placeholder location="classpath:c3p0.properties" /> <!--创建Spring的SessionFactory工厂 --> <!-- 如果使用的是Annotation的方式,不能使用LocalSessionFactoryBean,而应该使用 org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <!-- 注入数据源 --> <property name="dataSource" ref="dataSource" /> <!-- 设置Spring取那个包中查找相应的实体类 --> <property name="packagesToScan"> <value>com.myd.entity</value> </property> <property name="hibernateProperties"> <!-- <value> hibernate.dialect=org.hibernate.dialect.HSQLDialect </value> --> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.autoReconnect">true</prop> <prop key="jdbc.use_scrollable_resultset">false</prop> <prop key="hibernate.connection.release_mode">after_statement</prop> <prop key="hibernate.c3p0.validate">true</prop> <prop key="hibernate.c3p0.idle_test_period">30</prop> <prop key="hibernate.c3p0.timeout">30</prop> <prop key="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</prop> </props> </property> </bean> <!-- 开启HibernateTemplate,并且为其注入SessionFactory 使用HibernateTemplate不太方便的就是要获取session得通过getSessionFactory()方法获取 --> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 配置Spring的事务处理 --> <!-- 创建事务管理器 --> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 配置AOP,Spring是通过AOP来进行事务管理的 --> <aop:config> <!-- 设置pointCut表示哪些方法要加入事务处理 --> <!-- 以下的事务是声明在DAO中,但是通常都会在Service来处理多个业务对象逻辑的关系,注入删除,更新等,此时如果在执行了一个步骤之后抛出异常 就会导致数据不完整,所以事务不应该在DAO层处理,而应该在service,这也就是Spring所提供的一个非常方便的工具,声明式事务 --> <aop:pointcut id="allMethods" expression="execution(* com.myd.service.*.*(..))" /> <!-- 通过advisor来确定具体要加入事务控制的方法 --> <aop:advisor advice-ref="txAdvice" pointcut-ref="allMethods" /> </aop:config> <!-- 配置哪些方法要加入事务控制 --> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <!-- 让所有的方法都加入事务管理,为了提高效率,可以把一些查询之类的方法设置为只读的事务 --> <tx:method name="*" propagation="REQUIRED" read-only="true" /> <!-- 以下方法都是可能设计修改的方法,就无法设置为只读 --> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="del*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="save*" propagation="REQUIRED" /> </tx:attributes> </tx:advice> <bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"> <property name="corePoolSize" value="5" /> <property name="maxPoolSize" value="50" /> <property name="queueCapacity" value="1000" /> <property name="keepAliveSeconds" value="60" /> </bean> </beans> 这是事务 package com.myd.dao.impl; import java.lang.reflect.ParameterizedType; import java.sql.SQLException; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; import javax.annotation.Resource; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.transform.Transformers; import org.springframework.dao.DataAccessResourceFailureException; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import org.springframework.stereotype.Repository; import com.myd.dao.BaseDao; /** * 可以考虑把所有公共的方法都写在baseDAo中,让所有的DAO都继承BaseDao * 这样基本上就实现了大量的基础方法,如果DAO中有逻辑处理特殊的方法,再在具体的实现类中的DAO中创建 * * @author Administrator * * @param <T> */ @Repository("baseDaoImpl") public class BaseDaoImpl<T> extends HibernateDaoSupport implements BaseDao<T> { /** * 此处不能使用setSessionFactory注入,因为setSessionFactory在HibernateDaoSupport * 中已经定义了而且还是final的,不能被覆盖 * * @param sessionFactory */ @Resource(name = "sessionFactory") public void setSuperSessionFactory(SessionFactory sessionFactory) { super.setSessionFactory(sessionFactory); } /** * 创建Class的对象来获取泛型的class */ private Class<Object> clz; @SuppressWarnings("unchecked") public Class<Object> getClz() { if (clz == null) { // 获取泛型的Class对象 clz = (Class<Object>) ((ParameterizedType) getClass() .getGenericSuperclass()).getActualTypeArguments()[0]; } return clz; } public void add(T t) { getHibernateTemplate().getSessionFactory().openSession(); getHibernateTemplate().save(t); getHibernateTemplate().getSessionFactory().close(); } public void delete(int id) { getHibernateTemplate().getSessionFactory().openSession(); getHibernateTemplate().delete(load(id)); getHibernateTemplate().getSessionFactory().close(); } @SuppressWarnings("deprecation") public void update(T t) { try { getHibernateTemplate().getSessionFactory().openSession() .connection().prepareStatement("SET SQL_SAFE_UPDATES=0") .execute(); } catch (DataAccessResourceFailureException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (HibernateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } getHibernateTemplate().update(t); getHibernateTemplate().getSessionFactory().close(); } 现在的问题是 运行一段时间后,就卡起, 不是报连接数据库关闭 就是 返回空指针 查了以下是连接未释放导致的,我想请教下各位大神 我这样连接没关闭并回到连接池吗?

JAVA SSH Struts 关于a标签调用Action含参数就异常反之正常

struts 异常 Action path SSH 异常信息 There is no Action mapped for namespace [/dd] and action name [laladList] associated with context path [/baee]. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185) at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63) at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:501) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619) OrderAction.java public void lalad() throws Exception { System.out.println("lalad()被执行到了"); //return null; } applicationContext.xml <bean id="OrderActionBean" class="cn.baee.action.OrderAction" scope="prototype"> <property name="services" ref="GenericServiceImplBean"></property> </bean> struts.xml 文件位置:/WEB-INF/classes <!-- 加载国际资源文件 --> <constant name="struts.custom.i18n.resources" value="cn.baee.config.langResource"></constant> <!-- 将Action的创建交给spring来管理 --> <constant name="struts.objectFactory" value="spring" /> <!-- 去掉struts2请求后缀 --> <constant name="struts.action.extension" value=","></constant> <package name="dd" namespace="/dd" extends="struts-default"> <action name="*List?indexPage=*" method="{1}" class="OrderActionBean" > <param name="indexPage">{2}</param> <result name="success" type="redirectAction"> <param name="actionName">cc</param> </result> </action> </package> web.xml 文件位置:/WEB-INF/ <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> <init-param> <param-name>config</param-name> <param-value>struts-default.xml,struts-plugin.xml,struts.xml</param-value> </init-param> </filter> <filter-mapping> <filter-name>UrlRewriteFilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> 问题描述: (1)<s:action name="laladList?indexPage=1" executeResult="true" namespace="/dd"/> (2)http://localhost:8080/baee/dd/laladList?indexPage=1 执行(1)语句的时候没有任何问题,控制台输出了相应的东西,表示我的配置没有任何问题可以正常运行。 执行(2)直接在浏览器访问这个网址的时候却出现了上面的异常,控制台也没有输出,表示根本没有到Acion的这个方法里。 我要实现的效果是利用<a>标签访问Action我指定的这个方法并且可以动态传递参数给它,所有我直接编写了绝对路径去访问这个Action 但是不行,我就很疑惑了,百度了一圈还是解决不了。 附加:如果我没传递任何参数、类似于直接访问(http://localhost:8080/baee/dd/laladList)是可以正常运行的,但是我动态传递了参数进去 就是出现上面的404 找不到这个ACTION的异常。 很急 求高手指教。

一个SSH的系统错误

在启动tomcat时错误: <br /> <br />2008-11-7 17:38:18 org.apache.catalina.core.StandardContext start <br />严重: Error filterStart <br />2008-11-7 17:38:18 org.apache.catalina.core.StandardContext start <br />严重: Context [/exampleSSH] startup failed due to previous errors <br /> <br />谁能帮忙解决?  谢谢<br /><strong>问题补充:</strong><br />配置文件内容: <br /> <br />&lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" &lt;br=""&gt; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <br /> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee <br /> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt; <br /> <br /> &lt;context-param&gt; <br /> &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; <br /> &lt;param-value&gt;/WEB-INF/application.xml&lt;/param-value&gt; <br /> &lt;/context-param&gt; <br /> <br /> &lt;servlet&gt; <br /> &lt;servlet-name&gt;SpringContextServlet&lt;/servlet-name&gt; <br /> &lt;servlet-class&gt; <br /> org.springframework.web.context.ContextLoaderServlet <br /> &lt;/servlet-class&gt; <br /> &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; <br /> &lt;/servlet&gt; <br /> &lt;filter&gt; <br /> &lt;filter-name&gt;struts2&lt;/filter-name&gt; <br /> &lt;filter-class&gt; <br /> org.apache.struts2.dispatcher.FilterDispatcher <br /> &lt;/filter-class&gt; <br /> &lt;/filter&gt; <br /> <br /> &lt;filter-mapping&gt; <br /> &lt;filter-name&gt;struts2&lt;/filter-name&gt; <br /> &lt;url-pattern&gt;/*&lt;/url-pattern&gt; <br /> &lt;/filter-mapping&gt; <br /> <br /> &lt;welcome-file-list&gt; <br /> &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt; <br /> &lt;/welcome-file-list&gt; <br />&lt;/web-app&gt; <br /><br /><strong>问题补充:</strong><br />下面是控制台打印出来的全部信息: <br />2008-11-7 21:35:03 org.apache.catalina.core.AprLifecycleListener lifecycleEvent <br />信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\eclipse3.2\eclipse321\bin;D:\eclipse3.2\tomcat\Tomcat 5.5\bin <br />2008-11-7 21:35:04 org.apache.coyote.http11.Http11BaseProtocol init <br />信息: Initializing Coyote HTTP/1.1 on http-8080 <br />2008-11-7 21:35:04 org.apache.catalina.startup.Catalina load <br />信息: Initialization processed in 4359 ms <br />2008-11-7 21:35:05 org.apache.catalina.core.StandardService start <br />信息: Starting service Catalina <br />2008-11-7 21:35:05 org.apache.catalina.core.StandardEngine start <br />信息: Starting Servlet Engine: Apache Tomcat/5.5.15 <br />2008-11-7 21:35:05 org.apache.catalina.core.StandardHost start <br />信息: XML validation disabled <br />log4j:WARN No appenders could be found for logger (org.apache.catalina.session.ManagerBase). <br />log4j:WARN Please initialize the log4j system properly. <br />2008-11-7 21:35:10 org.apache.catalina.core.StandardContext start <br />严重: Error filterStart <br />2008-11-7 21:35:10 org.apache.catalina.core.StandardContext start <br />严重: Context [/exampleSSH] startup failed due to previous errors <br />2008-11-7 21:35:11 org.apache.coyote.http11.Http11BaseProtocol start <br />信息: Starting Coyote HTTP/1.1 on http-8080 <br />2008-11-7 21:35:12 org.apache.jk.common.ChannelSocket init <br />信息: JK: ajp13 listening on /0.0.0.0:8009 <br />2008-11-7 21:35:12 org.apache.jk.server.JkMain start <br />信息: Jk running ID=0 time=0/532  config=null <br />2008-11-7 21:35:13 org.apache.catalina.storeconfig.StoreLoader load <br />信息: Find registry server-registry.xml at classpath resource <br />2008-11-7 21:35:13 org.apache.catalina.startup.Catalina start <br />信息: Server startup in 9125 ms <br />2008-11-7 21:35:51 org.apache.catalina.startup.HostConfig checkResources <br />信息: Reloading context [/exampleSSH] <br />2008-11-7 21:35:51 org.apache.catalina.core.StandardContext stop <br />信息: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/exampleSSH] has not been started <br />log4j:WARN No appenders could be found for logger (com.opensymphony.xwork2.config.providers.XmlConfigurationProvider). <br />log4j:WARN Please initialize the log4j system properly. <br />2008-11-7 21:35:53 org.apache.catalina.core.StandardContext start <br />严重: Error filterStart <br />2008-11-7 21:35:53 org.apache.catalina.core.StandardContext start <br />严重: Context [/exampleSSH] startup failed due to previous errors<br /><strong>问题补充:</strong><br />补充一点:使用Spring上下文启动监听器 就会报错error LisenerStart<br /><strong>问题补充:</strong><br />导入的spring包会导致哪些错误?<br /><strong>问题补充:</strong><br />我觉得代码上因该是没有问题的,spring配置放在了WEB-INF下 这个因该不会是错误根源吧 <br /> <br />会不会是导入的包发生了冲突,或者是其他的配置上的错误呢?<br /><strong>问题补充:</strong><br />我用的是jdk1.5  平时用的包都用上了...<br /><strong>问题补充:</strong><br />导入的包有: <br />commons-dbcp.jar <br />commons-logging-1.0.4.jar <br />ommaons-pool-1.3.jar <br />freemarker-2.3.8.jar <br />hibernate3.jar <br />log4j.jar <br />msbase.jar <br />mssqlserver.jar <br />mstil.jar <br />spring.jar <br />standard.jar <br />struts2-core-2.0.11.jar <br />struts2-spring-plugin-2.0.11.jar <br />struts.jar <br />xwork-2.0.4.jar<br /><strong>问题补充:</strong><br />cats_tiger 谢谢你的再三帮助 我用了你提供的web.xml文件 <br />不过可惜 问题还是没有解决<br /><strong>问题补充:</strong><br />asm,cglib,dom4j,spring-aspects.jar,antlr、aspectjrt.jar、aspectjweaver.jar,jta,activation...这些包刚才我全加了 可还是.... <br /> <br />sui366@163.com 这是我的邮箱 麻烦哪位大哥发个SSH的例子给我 谢谢了!<br /><strong>问题补充:</strong><br />呵呵  你告诉我要加哪些包  比如截张图片 一起发   谢谢 了 <br />万望你好人做到底  真的谢谢了  这个问题我已经弄了两天半了  谢谢

struts2+spring2.5+hibernate整合的问题

<p>ssh整合的时候不报错,但插入的时候数据库也没有数据,控制台把insert语句已经打出来了,这是什么情况,请大侠们帮忙看看 <br><br><br>applicationContext.xml 配置如下:</p> <p> </p> <p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>&lt;beans xmlns="<a href="http://www.springframework.org/schema/beans">http://www.springframework.org/schema/beans</a>"<br>xmlns:context="<a href="http://www.springframework.org/schema/context">http://www.springframework.org/schema/context</a>"<br>xmlns:tx="<a href="http://www.springframework.org/schema/tx">http://www.springframework.org/schema/tx</a>"<br>xmlns:aop="<a href="http://www.springframework.org/schema/aop">http://www.springframework.org/schema/aop</a>"<br> xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"<br> xsi:schemaLocation="<a href="http://www.springframework.org/schema/beans">http://www.springframework.org/schema/beans</a><br><a href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">http://www.springframework.org/schema/beans/spring-beans-2.5.xsd</a><br><a href="http://www.springframework.org/schema/tx">http://www.springframework.org/schema/tx</a><br><a href="http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">http://www.springframework.org/schema/tx/spring-tx-2.5.xsd</a><br><a href="http://www.springframework.org/schema/aop">http://www.springframework.org/schema/aop</a><br><a href="http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">http://www.springframework.org/schema/aop/spring-aop-2.5.xsd</a><br><a href="http://www.springframework.org/schema/context">http://www.springframework.org/schema/context</a><br><a href="http://www.springframework.org/schema/context/spring-context-2.5.xsd">http://www.springframework.org/schema/context/spring-context-2.5.xsd</a><br>" default-autowire="byName" default-lazy-init="true"&gt;</p> <p> &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;<br>  &lt;property name="locations"&gt;<br>   &lt;list&gt;<br>    &lt;value&gt;classpath*:jdbc.properties&lt;/value&gt;<br>   &lt;/list&gt;<br>  &lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;<br>  &lt;property name="driverClassName" value="${jdbc.driver}"/&gt;<br>  &lt;property name="url" value="${jdbc.url}"/&gt;<br>  &lt;property name="username" value="${jdbc.username}"/&gt;<br>  &lt;property name="password" value="${jdbc.password}"&gt;&lt;/property&gt;<br>  <br>  &lt;property name="initialSize" value="5" /&gt;<br>  &lt;property name="maxActive" value="100" /&gt;<br>  &lt;property name="maxIdle" value="30" /&gt;<br>  &lt;property name="maxWait" value="500" /&gt;<br>  &lt;property name="poolPreparedStatements" value="false" /&gt;<br>  &lt;property name="defaultAutoCommit" value="false" /&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;<br>     &lt;property name="dataSource" ref="dataSource"/&gt;<br>     &lt;property name="mappingResources"&gt;<br>       &lt;list&gt;<br>         &lt;value&gt;com/demo/mapping/demo.hbm.xml&lt;/value&gt;<br>       &lt;/list&gt;<br>     &lt;/property&gt;<br>  &lt;property name="hibernateProperties"&gt;<br>   &lt;props&gt;<br>    &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.OracleDialect&lt;/prop&gt;<br>       &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;<br>   &lt;/props&gt;<br>  &lt;/property&gt;<br>  <br> &lt;/bean&gt;<br> <br> &lt;bean id="dDao" class="com.demo.dao.Impl.demoDaoImpl"&gt;<br>  &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="dService" class="com.demo.service.Impl.demoServiceImpl"&gt;<br>  &lt;property name="dDao" ref="dDao"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> &lt;bean id="txManage" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;  <br>     &lt;property name="sessionFactory" ref="sessionFactory"/&gt;  <br> &lt;/bean&gt;  </p> <p>&lt;/beans&gt;</p> <p> </p> <p>struts.xml 如下:</p> <p> </p> <p>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;<br>&lt;!DOCTYPE struts PUBLIC<br>    "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"<br>    "<a href="http://struts.apache.org/dtds/struts-2.1.7.dtd">http://struts.apache.org/dtds/struts-2.1.7.dtd</a>"&gt;<br>&lt;struts&gt;<br> &lt;package name="demo" namespace="/demo" extends="struts-default"&gt;<br>  &lt;action name="demo" class="com.demo.action.RegisterAction"&gt;<br>   &lt;result name="index"&gt;/demo/demo-index.jsp&lt;/result&gt;<br>   &lt;result name="add"&gt;/demo/demo-add.jsp&lt;/result&gt;<br>   &lt;result name="operate"&gt;/demo/demo-add.jsp&lt;/result&gt;<br>   &lt;result name="save" type="redirectAction"&gt;demo!index.action&lt;/result&gt;<br>   &lt;result name="update" type="redirectAction"&gt;demo!index.action&lt;/result&gt;<br>   &lt;result name="delete" type="redirectAction"&gt;demo!index.action&lt;/result&gt;<br>  &lt;/action&gt;<br> &lt;/package&gt;<br>&lt;/struts&gt;</p> <p> </p> <p>jdbc.properties  如下:</p> <p> </p> <p>jdbc.driver=oracle.jdbc.driver.OracleDriver<br>jdbc.url=jdbc:oracle:thin:@192.168.6.90:1521:orcl<br>jdbc.username=example<br>jdbc.password=123456<br>hibernate.dialect=org.hibernate.dialect.Oracle10gDialect</p> <p> </p> <p>web.xml   如下:</p> <p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>&lt;web-app version="2.5" xmlns="<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a>"<br> xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"<br> xsi:schemaLocation="<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a> <br> <a href="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd</a>"&gt;<br> <br>    &lt;context-param&gt;<br>   &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;<br>   &lt;param-value&gt;classpath:applicationContext.xml&lt;/param-value&gt;<br>    &lt;/context-param&gt;<br>  &lt;listener&gt;<br>      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;<br>     &lt;/listener&gt;<br>  &lt;filter&gt;<br>   &lt;filter-name&gt;struts2Filter&lt;/filter-name&gt;<br>   &lt;filter-class&gt;org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter&lt;/filter-class&gt;<br>  &lt;/filter&gt;<br>  &lt;filter-mapping&gt;<br>   &lt;filter-name&gt;struts2Filter&lt;/filter-name&gt;<br>   &lt;url-pattern&gt;/*&lt;/url-pattern&gt;<br>  &lt;/filter-mapping&gt;<br>&lt;/web-app&gt;<br> </p> <p>dao  接口如下:</p> <p>package com.demo.dao;</p> <p>import java.io.Serializable;<br>import java.util.List;</p> <p>import com.demo.model.Demo;</p> <p>public interface demoDao {<br> <br> public void save(Demo demo);</p> <p> public List&lt;Demo&gt; getDemos(final String strHql,final Object...params);<br> <br> public List&lt;Demo&gt; getDemos();<br> <br> public void delete(Demo demo);<br> <br> public abstract &lt;T&gt; T findByPrimaryKey(Class&lt;T&gt; class1, Serializable serializable);<br> <br> public void update(Demo demo);<br>}</p> <p>dao的实现:</p> <p>package com.demo.dao.Impl;</p> <p>import java.io.Serializable;<br>import java.sql.SQLException;<br>import java.util.ArrayList;<br>import java.util.List;</p> <p>import org.hibernate.HibernateException;<br>import org.hibernate.Query;<br>import org.hibernate.Session;<br>import org.springframework.orm.hibernate3.HibernateCallback;<br>import org.springframework.orm.hibernate3.HibernateTemplate;<br>import org.springframework.orm.hibernate3.support.HibernateDaoSupport;<br>import org.springframework.transaction.annotation.Transactional;</p> <p>import com.demo.dao.demoDao;<br>import com.demo.model.Demo;</p> <p>public class demoDaoImpl  extends HibernateDaoSupport implements demoDao{</p> <p> @Transactional<br> public void save(Demo demo) {<br>  this.getHibernateTemplate().save(demo);<br> }</p> <p> @SuppressWarnings("unchecked")<br> public List&lt;Demo&gt; getDemos(final String strHql,final Object...params) {<br>  List&lt;Demo&gt; demos=new ArrayList&lt;Demo&gt;();<br>  demos=this.getHibernateTemplate().executeFind(new HibernateCallback() {<br>     public Object doInHibernate(Session session) throws HibernateException,SQLException {<br>      Query query=session.createQuery(strHql);<br>      for(int i=0;params!=null&amp;&amp;i&lt;params.length;i++){<br>       query.setString(i,params[i].toString());<br>      }<br>      return query.list();<br>   }<br>  });<br>  return demos;<br> }</p> <p> public void delete(Demo demo) {<br>  this.getHibernateTemplate().delete(demo);<br> }</p> <p>  @SuppressWarnings("unchecked")<br>  public &lt;T&gt; T findByPrimaryKey(Class&lt;T&gt; clazz, Serializable key) {<br>         T obj = (T) getSession().get(clazz, key);<br>         return obj;<br>     }</p> <p> public void update(Demo demo) {<br>  this.getHibernateTemplate().update(demo);<br> }</p> <p>  @SuppressWarnings("unchecked")<br> public List&lt;Demo&gt; getDemos() {<br>  return this.getHibernateTemplate().find("from Demo where 1=1");<br> }</p> <p> <br>}</p> <p>service接口:</p> <p>package com.demo.service;</p> <p>import java.io.Serializable;<br>import java.util.List;</p> <p>import com.demo.model.Demo;</p> <p>public interface demoService {<br> <br> public void save(Demo demo);<br> <br> public List&lt;Demo&gt; getDemos(final String strHql,final Object...params);<br> <br> public List&lt;Demo&gt; getDemos();<br> <br> public void delete(Demo demo);<br> <br> public &lt;T&gt; T findByPrimaryKey(Class&lt;T&gt; class1, Serializable serializable);<br> <br> public String createHql(Demo demo);<br> <br> public void update(Demo demo);<br>}</p> <p>service 的实现:</p> <p>package com.demo.service.Impl;</p> <p>import java.io.Serializable;<br>import java.util.List;</p> <p>import org.springframework.transaction.annotation.Transactional;</p> <p>import com.demo.dao.demoDao;<br>import com.demo.model.Demo;<br>import com.demo.service.demoService;</p> <p>public class demoServiceImpl implements demoService{</p> <p> private demoDao dDao;</p> <p> public demoDao getdDao() {<br>  return dDao;<br> }</p> <p> public void setdDao(demoDao dDao) {<br>  this.dDao = dDao;<br> }</p> <p> public void save(Demo demo) {<br>  dDao.save(demo);<br> }</p> <p> public List&lt;Demo&gt; getDemos(final String strHql,final Object...params) {<br>  return dDao.getDemos(strHql, params);<br> }</p> <p> public void delete(Demo demo) {<br>  dDao.delete(demo);<br> }</p> <p> @Override<br> public String createHql(Demo demo) {<br>  StringBuffer buf=new StringBuffer();<br>  buf.append("from Demo d where 1=1");<br>  if(demo!=null){<br>   buf.append("and d.name like '%"+demo.getName()+"%'");<br>  }<br>  return buf.toString();<br> }</p> <p> @Override<br> public &lt;T&gt; T findByPrimaryKey(Class&lt;T&gt; class1, Serializable serializable) {<br>  return dDao.findByPrimaryKey(class1, serializable);<br> }</p> <p> @Override<br> public void update(Demo demo) {<br>  dDao.update(demo);<br> }</p> <p> @Override<br> public List&lt;Demo&gt; getDemos() {<br>  return dDao.getDemos();<br> }<br>}<br><br>action 如下:</p> <p> </p> <p>package com.demo.action;</p> <p><br>import java.util.List;</p> <p>import com.demo.model.Demo;<br>import com.demo.service.demoService;</p> <p>public class RegisterAction {</p> <p> private Demo demo;<br> private demoService dService;<br> private List&lt;Demo&gt; demos;<br> <br> public Demo getDemo() {<br>  return demo;<br> }<br> public void setDemo(Demo demo) {<br>  this.demo = demo;<br> }<br> public demoService getdService() {<br>  return dService;<br> }<br> public void setdService(demoService dService) {<br>  this.dService = dService;<br> }<br> public List&lt;Demo&gt; getDemos() {<br>  return demos;<br> }</p> <p> public void setDemos(List&lt;Demo&gt; demos) {<br>  this.demos = demos;<br> }<br> <br> public String execute(){<br>  return "index";<br> }</p> <p> public String index(){<br>  //demos=dService.getDemos(dService.createHql(demo),null);<br>  demos=dService.getDemos();<br>  return "index";<br> }<br> public String add(){<br>  return "add";<br> }<br> public String operate(){<br>  demo=dService.findByPrimaryKey(Demo.class,demo.getId());<br>  return "operate";<br> }<br> public String save(){<br>  dService.save(demo);<br>  return "save";<br> }<br> public String delete(){<br>  demo=dService.findByPrimaryKey(Demo.class,demo.getId());<br>  dService.delete(demo);<br>  return "delete";<br> }<br> public String update(){<br>  demo=dService.findByPrimaryKey(Demo.class,demo.getId());<br>  demo.setName(demo.getName());<br>  demo.setAge(demo.getAge());<br>  demo.setAddress(demo.getAddress());<br>  dService.update(demo);<br>  return "update";<br> }<br>}</p> <p> 实体:</p> <p>package com.demo.model;</p> <p>public class Demo {</p> <p> private Long id;<br> private String name;<br> private Integer age;<br> private String address;<br> <br> public Long getId() {<br>  return id;<br> }<br> public void setId(Long id) {<br>  this.id = id;<br> }<br> public String getName() {<br>  return name;<br> }<br> public void setName(String name) {<br>  this.name = name;<br> }<br> public Integer getAge() {<br>  return age;<br> }<br> public void setAge(Integer age) {<br>  this.age = age;<br> }<br> public String getAddress() {<br>  return address;<br> }<br> public void setAddress(String address) {<br>  this.address = address;<br> }<br>}</p> <p>映射文件:demo.hbm.xml</p> <p>&lt;?xml version="1.0" encoding="utf-8"?&gt;<br>&lt;!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"<br>"<a href="http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd</a>"&gt;<br>&lt;!-- <br>    Mapping file autogenerated by MyEclipse Persistence Tools<br>--&gt;<br>&lt;hibernate-mapping package="com.demo.model"&gt;<br>    &lt;class name="Demo" table="tb_demo" catalog="example"&gt;<br>        &lt;id name="id" type="java.lang.Long"&gt;<br>            &lt;column name="id" /&gt;<br>            &lt;generator class="sequence"&gt;<br>             &lt;param name="sequence"&gt;seq_demo&lt;/param&gt;<br>            &lt;/generator&gt;<br>        &lt;/id&gt;<br>        &lt;property name="name" type="java.lang.String"&gt;<br>            &lt;column name="tb_name" length="50" not-null="true" unique="true" /&gt;<br>        &lt;/property&gt;<br>        &lt;property name="age" type="java.lang.Integer"&gt;<br>            &lt;column name="tb_age" /&gt;<br>        &lt;/property&gt;<br>        &lt;property name="address" type="java.lang.String"&gt;<br>            &lt;column name="tb_address" length="50" not-null="true" /&gt;<br>        &lt;/property&gt;<br>    &lt;/class&gt;<br>&lt;/hibernate-mapping&gt;</p> <p> </p> <p>页面:</p> <p>demo-add.jsp  如下 :</p> <p>&lt;%@ page pageEncoding="utf-8" contentType="text/html; charset=utf-8"%&gt;<br>&lt;%@ taglib uri="/struts-tags" prefix="s"%&gt;<br>&lt;html&gt;<br> &lt;head&gt;<br>  &lt;title&gt;ssh整合测试&lt;/title&gt;<br>  &lt;script type="text/javascript" src="/SSH1/js/jquery.js"&gt;&lt;/script&gt;<br> &lt;/head&gt;<br> &lt;body&gt;<br>  &lt;form method="post" action="demo/demo.action"&gt;<br>  &lt;input type="hidden" id="num" name="demo.id" value="${demo.id}"/&gt;<br>   &lt;table&gt;<br>    &lt;tr&gt;ssh整合数据测试&lt;/tr&gt;<br>    &lt;tr&gt;&lt;td align="right"&gt;姓名:&lt;/td&gt;&lt;td align="left"&gt;&lt;input type="text" name="demo.name" value="${demo.name}"/&gt;&lt;/td&gt;&lt;/tr&gt;<br>    &lt;tr&gt;&lt;td align="right"&gt;年龄:&lt;/td&gt;&lt;td align="left"&gt;&lt;input type="text" name="demo.age" value="${demo.age}"/&gt;&lt;/td&gt;&lt;/tr&gt;<br>    &lt;tr&gt;&lt;td align="right"&gt;家庭住址:&lt;/td&gt;&lt;td align="left"&gt;&lt;input type="text" name="demo.address" value="${demo.address}"/&gt;&lt;/td&gt;&lt;/tr&gt;<br>    &lt;tr&gt;&lt;td colspan="2"&gt;&lt;input type="button" value="保存" id="save"/&gt;&lt;input type="reset" value="重置"/&gt;&lt;/td&gt;&lt;/tr&gt;<br>   &lt;/table&gt;<br>  &lt;/form&gt;<br> &lt;/body&gt;<br>&lt;/html&gt;<br>&lt;script&gt;<br> $("document").ready(function (){<br>  $("#save").click(function(){<br>   if($("#num").val()==null||$("#num").val()==""){<br>    document.forms[0].action="/SSH1/demo/demo!save.action";<br>    document.forms[0].submit();<br>   }else{<br>    alert("eee");<br>    document.forms[0].action="/SSH1/demo/demo!update.action";<br>    document.forms[0].submit();<br>   }<br>  });<br> });<br>&lt;/script&gt;</p> <p> </p> <p>demo-index.jsp  如下:</p> <p>&lt;%@ page pageEncoding="utf-8" contentType="text/html; charset=utf-8"%&gt;<br>&lt;%@ taglib uri="/struts-tags" prefix="s"%&gt;<br>&lt;html&gt;<br> &lt;head&gt;<br>  &lt;title&gt;ssh整合测试&lt;/title&gt;<br> &lt;/head&gt;<br> &lt;body&gt;<br>  &lt;form action="demo/demo.action"&gt;<br>   &lt;table&gt;<br>    &lt;tr&gt;&lt;td&gt;&lt;a href="&lt;%=request.getContextPath() %&gt;/demo/demo!add.action"&gt;添加&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;<br>    &lt;tr&gt;&lt;td&gt;序号&lt;/td&gt;&lt;td&gt;姓名&lt;/td&gt;&lt;td&gt;年龄&lt;/td&gt;&lt;td&gt;地址&lt;/td&gt;&lt;td&gt;操作&lt;/td&gt;&lt;/tr&gt;<br>    &lt;s:if test="demos.size()&gt;0"&gt;<br>     &lt;s:iterator value="demos" status="st"&gt;<br>      &lt;tr&gt;<br>       &lt;td&gt;${st.index+1}&lt;/td&gt;<br>       &lt;td&gt;${name}&lt;/td&gt;<br>       &lt;td&gt;${age}&lt;/td&gt;<br>       &lt;td&gt;${address}&lt;/td&gt;<br>       &lt;td&gt;&lt;a href="&lt;%=request.getContextPath() %&gt;/demo/demo!operate.action?demo.id=${id}"&gt;修改&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="&lt;%=request.getContextPath() %&gt;/demo/demo!operate.action?demo.id=${id}"&gt;删除&lt;/a&gt;&lt;/td&gt;<br>      &lt;/tr&gt;<br>     &lt;/s:iterator&gt;<br>    &lt;/s:if&gt;<br>   &lt;/table&gt;<br>  &lt;/form&gt;<br> &lt;/body&gt;<br>&lt;/html&gt;</p>

启动Tomcat控制台报错:Could not parse mapping document from input stream

启动Tomcat控制台报错如下 ``` org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AccountHistorySVCImpl': Injection of resource fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AccountHistoryDaoImpl' defined in ServletContext resource [/WEB-INF/dataAccessContext-local.xml]: Cannot resolve reference to bean 'SessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SessionFactory' defined in ServletContext resource [/WEB-INF/dataAccessContext-local.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessAfterInstantiation(CommonAnnotationBeanPostProcessor.java:292) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4994) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5492) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:672) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1859) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AccountHistoryDaoImpl' defined in ServletContext resource [/WEB-INF/dataAccessContext-local.xml]: Cannot resolve reference to bean 'SessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SessionFactory' defined in ServletContext resource [/WEB-INF/dataAccessContext-local.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:435) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:537) at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:180) at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessAfterInstantiation(CommonAnnotationBeanPostProcessor.java:289) ... 29 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SessionFactory' defined in ServletContext resource [/WEB-INF/dataAccessContext-local.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269) ... 47 more Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:508) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:631) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) ... 57 more Caused by: org.dom4j.DocumentException: Error on line 21 of document : 元素类型 "class" 必须由匹配的结束标记 "</class>" 终止。 Nested exception: 元素类型 "class" 必须由匹配的结束标记 "</class>" 终止。 at org.dom4j.io.SAXReader.read(SAXReader.java:482) at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:499) ... 61 more ``` dataAccessContext-local.xml配置文件内容如下 ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <bean id="dataSource2" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/> <property name="jdbcUrl" value="jdbc:oracle:thin:@192.168.1.2:1521:CEMP" /> <property name="user" value="cs_imrs" /> <property name="password" value="123123" /> <property name="maxPoolSize" value="15"/> <property name="minPoolSize" value="10"/> <property name="initialPoolSize" value="5"/> <property name="maxIdleTime" value="60"/> </bean> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/> <property name="jdbcUrl" value="jdbc:oracle:thin:@192.168.0.92:1521:ORCL" /> <property name="user" value="CS_IMRS" /> <property name="password" value="CS_IMRS" /> <property name="maxPoolSize" value="15"/> <property name="minPoolSize" value="10"/> <property name="initialPoolSize" value="5"/> <property name="maxIdleTime" value="60"/> </bean> <bean id="dataSource3" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/> <property name="jdbcUrl" value="jdbc:oracle:thin:@192.168.1.177:1521:orcl" /> <property name="user" value="energy" /> <property name="password" value="energy" /> <property name="maxPoolSize" value="15"/> <property name="minPoolSize" value="10"/> <property name="initialPoolSize" value="5"/> <property name="maxIdleTime" value="60"/> </bean> <bean id="SessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="dataSource" /> </property> <property name="mappingResources"> <list> <value>com/hd/imrs/log/map/LogEntity.hbm.xml</value> <value>com/hd/imrs/system/map/SubSystemEntity.hbm.xml</value> <value>com/hd/imrs/system/map/ModuleEntity.hbm.xml</value> <value>com/hd/imrs/system/map/OperationEntity.hbm.xml</value> <value>com/hd/imrs/system/map/RoleEntity.hbm.xml</value> <value>com/hd/imrs/system/map/SystemParamEntity.hbm.xml</value> <value>com/hd/imrs/system/map/UserEntity.hbm.xml</value> <value>com/hd/imrs/system/map/SendingEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/BuildingEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/ConcentratorEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/CollectorEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/OrganizationEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/FactoryEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/MeterEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/FaultEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/ArchiveEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/SiteEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/RoomEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/ModelEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/YxvEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/MarketingEntity.hbm.xml</value> <value>com/hd/imrs/archive/map/SimEntity.hbm.xml</value> <value>com/hd/imrs/rate/map/RateItem.hbm.xml</value> <value>com/hd/imrs/rate/map/BasicWaterRate.hbm.xml</value> <value>com/hd/imrs/rate/map/Rate.hbm.xml</value> <value>com/hd/imrs/rate/map/OverDue.hbm.xml</value> <value>com/hd/imrs/rate/map/RateSet.hbm.xml</value> <value>com/hd/imrs/rate/map/RateSubSidy.hbm.xml</value> <value>com/hd/imrs/rate/map/AreaUser.hbm.xml</value> <value>com/hd/imrs/rate/map/SubSidySend.hbm.xml</value> <value>com/hd/imrs/rate/map/SubSidySendDetal.hbm.xml</value> <value>com/hd/imrs/rate/map/Dayily.hbm.xml</value> <value>com/hd/imrs/rate/map/Month.hbm.xml</value> <value>com/hd/imrs/rate/map/RecordEntity.hbm.xml</value> <value>com/hd/imrs/maintain/map/RunTaskEntity.hbm.xml</value> <value>com/hd/imrs/maintain/map/WarningSetEntity.hbm.xml</value> <value>com/hd/imrs/maintain/map/WarningInfoEntity.hbm.xml</value> <value>com/hd/imrs/maintain/map/DayusedtempEntity.hbm.xml</value> <value>com/hd/imrs/maintain/map/BlacklistEntity.hbm.xml</value> <value>com/hd/imrs/maintain/map/BlacklistEntityResult.hbm.xml</value> <value>com/hd/imrs/maintain/map/FaultmEntity.hbm.xml</value> <value>com/hd/imrs/maintain/map/ChangeEntity.hbm.xml</value> <value>com/hd/imrs/maintain/map/FreezeEntity.hbm.xml</value> <value>com/hd/imrs/maintain/map/SwitchEntity.hbm.xml</value> <value>com/hd/imrs/maintain/map/MtCountEntity.hbm.xml</value> <value>com/hd/imrs/maintain/map/MessageEntity.hbm.xml</value> <value>com/hd/imrs/maintain/map/DataCommunicationEntity.hbm.xml</value> <value>com/hd/imrs/monitor/map/MeterHourCurveEntity.hbm.xml</value> <value>com/hd/imrs/monitor/map/MeterDayCurveEntity.hbm.xml</value> <value>com/hd/imrs/monitor/map/MeterMonthCurveEntity.hbm.xml</value> <value>com/hd/imrs/monitor/map/MeterDayLoss.hbm.xml</value> <value>com/hd/imrs/monitor/map/MeterMonthLoss.hbm.xml</value> <value>com/hd/imrs/monitor/map/MeterDayConsuEntity.hbm.xml</value> <value>com/hd/imrs/monitor/map/BuildMonthConstituteEntity.hbm.xml</value> <value>com/hd/imrs/monitor/map/UnitHourcurveEntity.hbm.xml</value> <value>com/hd/imrs/monitor/map/UnitDaycurveEntity.hbm.xml</value> <value>com/hd/imrs/monitor/map/UnitMonthcurveEntity.hbm.xml</value> <value>com/hd/imrs/account/map/AccountEntity.hbm.xml</value> <value>com/hd/imrs/account/map/AccountHistoryET.hbm.xml</value> <value>com/hd/imrs/payment/map/PaymentEntity.hbm.xml</value> <value>com/hd/imrs/payment/map/NetworkEntity.hbm.xml</value> <value>com/hd/imrs/statistical/map/SubmitDayEntity.hbm.xml</value> <value>com/hd/imrs/statistical/map/SubmitMonthEntity.hbm.xml</value> <value>com/hd/imrs/statistical/map/DosageEntity.hbm.xml</value> <value>com/hd/imrs/statistical/map/MeterDayilyEntity.hbm.xml</value> <value>com/hd/imrs/statistical/map/FeedayilyEntity.hbm.xml</value> <value>com/hd/quartz/msg/map/MsgEntity.hbm.xml</value> <value>com/hd/quartz/msg/map/BillEntity.hbm.xml</value> <value>com/hd/quartz/map/JobBeanEntity.hbm.xml</value> <value>com/hd/imrs/decision/map/PsEntity.hbm.xml</value> <value>com/hd/imrs/decision/map/FeeEntity.hbm.xml</value> <value>com/hd/imrs/decision/map/MrrEntity.hbm.xml</value> <value>com/hd/imrs/decision/map/FmrrEntity.hbm.xml</value> <value>com/hd/imrs/decision/map/FaultsEntity.hbm.xml</value> <value>com/hd/imrs/master/map/SimmEntity.hbm.xml</value> <value>com/hd/imrs/master/map/MasterEntity.hbm.xml</value> <value>com/hd/imrs/master/map/CommunicationEntity.hbm.xml</value> <value>com/hd/imrs/presm/map/PresmDetailEntity.hbm.xml</value> <value>com/hd/imrs/presm/map/PresmSetEntity.hbm.xml</value> <value>com/hd/imrs/community/map/PersonnelEntity.hbm.xml</value> <value>com/hd/imrs/community/map/SpecialEntity.hbm.xml</value> <value>com/hd/imrs/community/map/SpecialWarnEntity.hbm.xml</value> <value>com/hd/imrs/scene/map/DesignEntity.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.bytecode.use_reflection_optimizer">true</prop> <prop key="hibernate.connection.release_mode">auto</prop> <prop key="hibernate.cglib.use_reflection_optimizer">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 local="SessionFactory" /> </property> </bean> <!-- 配置事务传播特性 --> <tx:advice id="txAdvice" transaction-manager="TransactionManager"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="del*" propagation="REQUIRED" /> <tx:method name="execute*" propagation="REQUIRED" /> <tx:method name="create*" propagation="REQUIRED" /> <tx:method name="find*" read-only="true" /> <tx:method name="query*" read-only="true" /> </tx:attributes> </tx:advice> <!-- 通知织入接口 --> <aop:config> <aop:pointcut id="ServicePointcut" expression="execution(* com.hd.imrs.*.service.impl.*ServiceImpl.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="ServicePointcut" /> </aop:config> <bean id="HibernateDaoImpl" class="com.hd.imrs.dao.HibernateDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="LogDaoImpl" class="com.hd.imrs.log.dao.impl.LogDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="UserDaoImpl" class="com.hd.imrs.system.dao.impl.UserDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="RoleDaoImpl" class="com.hd.imrs.system.dao.impl.RoleDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="OperationDaoImpl" class="com.hd.imrs.system.dao.impl.OperationDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="ModuleDaoImpl" class="com.hd.imrs.system.dao.impl.ModuleDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SubSystemDaoImpl" class="com.hd.imrs.system.dao.impl.SubSystemDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SystemParamDaoImpl" class="com.hd.imrs.system.dao.impl.SystemParamDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SendingDaoImpl" class="com.hd.imrs.system.dao.impl.SendingDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="BuildingDaoImpl" class="com.hd.imrs.archive.dao.impl.BuildingDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="OrganizationDaoImpl" class="com.hd.imrs.archive.dao.impl.OrganizationDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="ConcentratorDaoImpl" class="com.hd.imrs.archive.dao.impl.ConcentratorDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="CollectorDaoImpl" class="com.hd.imrs.archive.dao.impl.CollectorDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="ConsumeDaoImpl" class="com.hd.imrs.archive.dao.impl.ConsumeDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SiteDaoImpl" class="com.hd.imrs.archive.dao.impl.SiteDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="FactoryDaoImpl" class="com.hd.imrs.archive.dao.impl.FactoryDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MeterDaoImpl" class="com.hd.imrs.archive.dao.impl.MeterDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="FaultDaoImpl" class="com.hd.imrs.archive.dao.impl.FaultDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SwitchDaoImpl" class="com.hd.imrs.maintain.dao.impl.SwitchDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MtCountDaoImpl" class="com.hd.imrs.maintain.dao.impl.MtCountDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="ArchiveDaoImpl" class="com.hd.imrs.archive.dao.impl.ArchiveDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="RoomDaoImpl" class="com.hd.imrs.archive.dao.impl.RoomDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="ModelDaoImpl" class="com.hd.imrs.archive.dao.impl.ModelDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="YxvDaoImpl" class="com.hd.imrs.archive.dao.impl.YxvDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MarketingDaoImpl" class="com.hd.imrs.archive.dao.impl.MarketingDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SimDaoImpl" class="com.hd.imrs.archive.dao.impl.SimDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="RunTaskDaoImpl" class="com.hd.imrs.maintain.dao.impl.RunTaskDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="WarningSetDaoImpl" class="com.hd.imrs.maintain.dao.impl.WarningSetDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="WarningInfoDaoImpl" class="com.hd.imrs.maintain.dao.impl.WarningInfoDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="DayusedtempDaoImpl" class="com.hd.imrs.maintain.dao.impl.DayusedtempDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="BlacklistDaoImpl" class="com.hd.imrs.maintain.dao.impl.BlacklistDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MessageDaoImpl" class="com.hd.imrs.maintain.dao.impl.MessageDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="BlacklistResultDaoImpl" class="com.hd.imrs.maintain.dao.impl.BlacklistResultDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="FaultmDaoImpl" class="com.hd.imrs.maintain.dao.impl.FaultmDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="ChangeDaoImpl" class="com.hd.imrs.maintain.dao.impl.ChangeDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MeterHourCurveDaoImpl" class="com.hd.imrs.monitor.dao.impl.MeterHourCurveDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MeterDayCurveDaoImpl" class="com.hd.imrs.monitor.dao.impl.MeterDayCurveDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MeterMonthCurveDaoImpl" class="com.hd.imrs.monitor.dao.impl.MeterMonthCurveDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="UnitHourCurveDaoImpl" class="com.hd.imrs.monitor.dao.impl.UnitHourCurveDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="UnitDayCurveDaoImpl" class="com.hd.imrs.monitor.dao.impl.UnitDayCurveDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="UnitMonthCurveDaoImpl" class="com.hd.imrs.monitor.dao.impl.UnitMonthCurveDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MeterDayLossDaoImpl" class="com.hd.imrs.monitor.dao.impl.MeterDayLossDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MeterMonthLossDaoImpl" class="com.hd.imrs.monitor.dao.impl.MeterMonthLossDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MeterDayConsuDaoImpl" class="com.hd.imrs.monitor.dao.impl.MeterDayConsuDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="AccountDaoImpl" class="com.hd.imrs.account.dao.impl.AccountDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <!-- <bean id="AccountHistoryDaoImpl" class="com.hd.imrs.account.dao.impl.AccountHistoryDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> --> <bean id="AccountHistoryDaoImpl" class="com.hd.imrs.account.dao.impl.AccountHistoryDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="RateDaoImpl" class="com.hd.imrs.rate.impl.RateDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="RateItemDaoImpl" class="com.hd.imrs.rate.impl.RateItemDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="NewRateItemDaoImpl" class="com.hd.imrs.rate.impl.NewRateItemDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="BasicWaterRateDaoImpl" class="com.hd.imrs.rate.impl.BasicWaterRateDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="OverDueDaoImpl" class="com.hd.imrs.rate.impl.OverDueDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="RateSetDaoImpl" class="com.hd.imrs.rate.impl.RateSetDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SubSidyDaoImpl" class="com.hd.imrs.rate.impl.SubSidyDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SubSidySendDaoImpl" class="com.hd.imrs.rate.impl.SubSidySendDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SubSidySendDetalDaoImpl" class="com.hd.imrs.rate.impl.SubSidySendDetalDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="AreaDaoImpl" class="com.hd.imrs.rate.impl.AreaDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="DayilyDaoImpl" class="com.hd.imrs.rate.impl.DayilyDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MonthDaoImpl" class="com.hd.imrs.rate.impl.MonthDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="RecordDaoImpl" class="com.hd.imrs.rate.impl.RecordDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="PaymentDaoImpl" class="com.hd.imrs.payment.dao.impl.PaymentDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="NetworkDaoImpl" class="com.hd.imrs.payment.dao.impl.NetworkDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="DesignDaoImpl" class="com.hd.imrs.scene.dao.impl.DesignDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SubmitDayDaoImpl" class="com.hd.imrs.statistical.dao.impl.SubmitDayDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SubmitMonthDaoImpl" class="com.hd.imrs.statistical.dao.impl.SubmitMonthDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="CostDaoImpl" class="com.hd.imrs.statistical.dao.impl.CostDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="PsDaoImpl" class="com.hd.imrs.decision.dao.impl.PsDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="FeeDaoImpl" class="com.hd.imrs.decision.dao.impl.FeeDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MrrDaoImpl" class="com.hd.imrs.decision.dao.impl.MrrDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="FmrrDaoImpl" class="com.hd.imrs.decision.dao.impl.FmrrDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="FaultsDaoImpl" class="com.hd.imrs.decision.dao.impl.FaultsDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SimmDaoImpl" class="com.hd.imrs.master.dao.impl.SimmDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MasterDaoImpl" class="com.hd.imrs.master.dao.impl.MasterDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="DetailDaoImpl" class="com.hd.imrs.presm.dao.impl.DetailDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="PresmSetDaoImpl" class="com.hd.imrs.presm.dao.impl.PresmSetDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="FreezeDaoImpl" class="com.hd.imrs.maintain.dao.impl.FreezeDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="CommunicationDaoImpl" class="com.hd.imrs.master.dao.impl.CommunicationDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="PersonnelDaoImpl" class="com.hd.imrs.community.dao.impl.PersonnelDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SpecialDaoImpl" class="com.hd.imrs.community.dao.impl.SpecialDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="SpecialWarnDaoImpl" class="com.hd.imrs.community.dao.impl.SpecialWarnDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="ControlSetDaoImpl" class="com.hd.imrs.maintain.dao.impl.ControlSetDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="MsgDaoImpl" class="com.hd.quartz.msg.dao.impl.MsgDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="BillDaoImpl" class="com.hd.quartz.msg.dao.impl.BillDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="DataCommunicationDaoImpl" class="com.hd.imrs.maintain.dao.impl.DataCommunicationDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="JobBeanDaoImpl" class="com.hd.quartz.dao.impl.JobBeanDaoImpl"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean id="JobBeanServiceImpl" class="com.hd.quartz.msg.service.impl.JobBeanServiceImpl"/> <bean id="HibernateHelper" class="com.hd.imrs.dao.HibernateHelper"> <property name="sessionFactory"> <ref local="SessionFactory" /> </property> </bean> <bean name="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="applicationContextSchedulerContextKey" value="applicationContextKey"/> <property name="configLocation" value="classpath:quartz.properties"/> <!--这个是必须的,QuartzScheduler 延时启动,应用启动完后 QuartzScheduler 再启动--> <property name="startupDelay" value="45"/> <!--这个是可选,QuartzScheduler 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了--> <property name="overwriteExistingJobs" value="true"/> <property name="jobDetails" > <list> <ref bean="jobDetail"/> </list> </property> </bean> <bean id="jobDetail" class="org.springframework.scheduling.quartz.JobDetailBean"> <property name="jobClass"> <value> com.hd.quartz.job.TaskJobBean </value> </property> </bean> <!-- <bean id="timerClose" class="com.hd.quartz.job.TimerCloseJobBean" /> <bean id="timerHang" class="com.hd.quartz.job.TimerHangJobBean" /> <bean id="oweHang" class="com.hd.quartz.job.OweHangJobBean" /> <bean id="meterExPmc" class="com.hd.quartz.pmc.MeterExceptionPMC" /> <bean id="pwdOuttimePmc" class="com.hd.quartz.pmc.PasswordOuttimePMC" /> <bean id="usedEx" class="com.hd.quartz.job.UsedExceptionJobBean" /> --> <bean id="quartzDao" class="com.hd.quartz.dao.QuartzDao" > </bean> <bean id="schedulerService" class="com.hd.quartz.service.SchedulerServiceImpl" > </bean> <!-- 使加密狗正常工作而添加 --> <bean id="MsgServiceImpl" class="com.hd.quartz.msg.service.impl.MsgServiceImpl"/> <bean id="ModuleServiceImpl" class="com.hd.imrs.system.service.impl.ModuleServiceImpl"/> <bean id="OperationServiceImpl" class="com.hd.imrs.system.service.impl.OperationServiceImpl"/> <bean id="RoleServiceImpl" class="com.hd.imrs.system.service.impl.RoleServiceImpl"/> <bean id="SubSystemServiceImpl" class="com.hd.imrs.system.service.impl.SubSystemServiceImpl"/> <bean id="SystemParamServiceImpl" class="com.hd.imrs.system.service.impl.SystemParamServiceImpl"/> <bean id="UserServiceImpl" class="com.hd.imrs.system.service.impl.UserServiceImpl"/> <bean id="SubmitServiceImpl" class="com.hd.imrs.statistical.service.impl.SubmitServiceImpl"/> <bean id="AreaServiceImpl" class="com.hd.imrs.rate.service.impl.AreaServiceImpl"/> <bean id="DayilyServiceImpl" class="com.hd.imrs.rate.service.impl.DayilyServiceImpl"/> <bean id="ManualServiceImpl" class="com.hd.imrs.rate.service.impl.ManualServiceImpl"/> <bean id="MonthServiceImpl" class="com.hd.imrs.rate.service.impl.MonthServiceImpl"/> <bean id="OverDueServiceImpl" class="com.hd.imrs.rate.service.impl.OverDueServiceImpl"/> <bean id="RateServiceImpl" class="com.hd.imrs.rate.service.impl.RateServiceImpl"/> <bean id="RateSetServiceImpl" class="com.hd.imrs.rate.service.impl.RateSetServiceImpl"/> <bean id="SubSidySendServiceImpl" class="com.hd.imrs.rate.service.impl.SubSidySendServiceImpl"/> <bean id="SubSidyServiceImpl" class="com.hd.imrs.rate.service.impl.SubSidyServiceImpl"/> <bean id="PaymentServiceImpl" class="com.hd.imrs.payment.service.impl.PaymentServiceImpl"/> <bean id="MeterMonitorServiceImpl" class="com.hd.imrs.monitor.service.impl.MeterMonitorServiceImpl"/> <bean id="BasicParamServiceImpl" class="com.hd.imrs.maintain.service.impl.BasicParamServiceImpl"/> <bean id="ConcentratorCmdServiceImpl" class="com.hd.imrs.maintain.service.impl.ConcentratorCmdServiceImpl"/> <bean id="ControlServiceImpl" class="com.hd.imrs.maintain.service.impl.ControlServiceImpl"/> <bean id="DataMaintainServiceImpl" class="com.hd.imrs.maintain.service.impl.DataMaintainServiceImpl"/> <bean id="ArchiveServiceImpl" class="com.hd.imrs.archive.service.impl.ArchiveServiceImpl"/> <bean id="BuildingServiceImpl" class="com.hd.imrs.archive.service.impl.BuildingServiceImpl"/> <bean id="ConcentratorServiceImpl" class="com.hd.imrs.archive.service.impl.ConcentratorServiceImpl"/> <bean id="CollectorServiceImpl" class="com.hd.imrs.archive.service.impl.CollectorServiceImpl"/> <bean id="ConsumeServiceImpl" class="com.hd.imrs.archive.service.impl.ConsumeServiceImpl"/> <bean id="FactoryServiceImpl" class="com.hd.imrs.archive.service.impl.FactoryServiceImpl"/> <bean id="FaultServiceImpl" class="com.hd.imrs.archive.service.impl.FaultServiceImpl"/> <bean id="MeterServiceImpl" class="com.hd.imrs.archive.service.impl.MeterServiceImpl"/> <bean id="OrganizationServiceImpl" class="com.hd.imrs.archive.service.impl.OrganizationServiceImpl"/> <bean id="RoomServiceImpl" class="com.hd.imrs.archive.service.impl.RoomServiceImpl"/> <bean id="SiteServiceImpl" class="com.hd.imrs.archive.service.impl.SiteServiceImpl"/> <bean id="AccountHistorySVCImpl" class="com.hd.imrs.account.service.impl.AccountHistorySVCImpl"/> <bean id="AccountServiceImpl" class="com.hd.imrs.account.service.impl.AccountServiceImpl"/> <bean id="SchedulerServiceImpl" class="com.hd.quartz.service.SchedulerServiceImpl"/> <bean id="LogServiceImpl" class="com.hd.imrs.log.service.impl.LogServiceImpl"/> <bean id="HdBasicParamServiceImpl" class="com.hd.imrs.maintain.service.impl.HdBasicParamServiceImpl"/> <bean id="HBBasicParamServiceImpl" class="com.hd.imrs.maintain.service.impl.HBBasicParamServiceImpl"/> <bean id="HdControlServiceImpl" class="com.hd.imrs.maintain.service.impl.HdControlServiceImpl"/> <bean id="HdDataMaintainServiceImpl" class="com.hd.imrs.maintain.service.impl.HdDataMaintainServiceImpl"/> <bean id="WarningInfoServiceImpl" class="com.hd.imrs.maintain.service.impl.WarningInfoServiceImpl"/> <bean id="WarningSetServiceImpl" class="com.hd.imrs.maintain.service.impl.WarningSetServiceImpl"/> <bean id="NetworkServiceImpl" class="com.hd.imrs.payment.service.impl.NetworkServiceImpl"/> <bean id="BillServiceImpl" class="com.hd.quartz.msg.service.impl.BillServiceImpl"/> <bean id="DayusedtempServiceImpl" class="com.hd.imrs.maintain.service.impl.DayusedtempServiceImpl"/> </beans> ```

求解决No Hibernate Session bound to thread

ssh项目在运行时控制台没有出错,但是页面出现 HTTP Status 500 - No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here怎么解决??? ![图片说明](https://img-ask.csdn.net/upload/201503/18/1426660994_104397.jpg) applicationContext.xml文件配置如下: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.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/hk"></property> <property name="username" value="root"></property> <property name="password" value="123"></property> <property name="maxActive" value="100"></property> <property name="maxIdle" value="30"></property> <property name="maxWait" value="500"></property> <property name="defaultAutoCommit" value="true"></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect </prop> </props> </property> <property name="mappingResources"> <list> <value>vo/News.hbm.xml</value></list> </property></bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED" /><!-- 只有一save、delete、update开头的方法才能执行增删改操作 --> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="*" propagation="SUPPORTS" read-only="true" /><!-- 其他方法为只读方法 --> </tx:attributes> </tx:advice> <aop:config> <aop:pointcut id="interceptorPointCuts" expression="execution(* news.serviceImpl..*.*(..))" /> <!-- 对应实现类接口的包的位置 --> <aop:advisor advice-ref="txAdvice" pointcut-ref="interceptorPointCuts" /> </aop:config> <!-- 业务层Service --> <bean id="news_service" class="service.impl.NewsServiceImpl"> <property name="sessionFactory"> <ref bean="sessionFactory"></ref> </property> </bean> <!-- 控制层Action --> <bean id="news_action" class="action.NewsAction"> <property name="news_services"> <ref bean="news_service" /> </property> </bean> </beans> 初学ssh的菜鸟,请各位大神帮忙解答一下!!谢谢!

软件测试入门、SQL、性能测试、测试管理工具

软件测试2小时入门,让您快速了解软件测试基本知识,有系统的了解; SQL一小时,让您快速理解和掌握SQL基本语法 jmeter性能测试 ,让您快速了解主流来源性能测试工具jmeter 测试管理工具-禅道,让您快速学会禅道的使用,学会测试项目、用例、缺陷的管理、

计算机组成原理实验教程

西北工业大学计算机组成原理实验课唐都仪器实验帮助,同实验指导书。分为运算器,存储器,控制器,模型计算机,输入输出系统5个章节

Java 最常见的 200+ 面试题:面试必备

这份面试清单是从我 2015 年做了 TeamLeader 之后开始收集的,一方面是给公司招聘用,另一方面是想用它来挖掘在 Java 技术栈中,还有那些知识点是我不知道的,我想找到这些技术盲点,然后修复它,以此来提高自己的技术水平。虽然我是从 2009 年就开始参加编程工作了,但我依旧觉得自己现在要学的东西很多,并且学习这些知识,让我很有成就感和满足感,那所以何乐而不为呢? 说回面试的事,这份面试...

winfrom中嵌套html,跟html的交互

winfrom中嵌套html,跟html的交互,源码就在里面一看就懂,很简单

玩转Python-Python3基础入门

总课时80+,提供源码和相关资料 本课程从Python零基础到纯Python项目实战。内容详细,案例丰富,覆盖了Python知识的方方面面,学完后不仅对Python知识有个系统化的了解,让你从Python小白变编程大牛! 课程包含: 1.python安装 2.变量、数据类型和运算符 3.选择结构 4.循环结构 5.函数和模块 6.文件读写 7.了解面向对象 8.异常处理

程序员的兼职技能课

获取讲师答疑方式: 在付费视频第一节(触摸命令_ALL)片头有二维码及加群流程介绍 限时福利 原价99元,今日仅需39元!购课添加小助手(微信号:csdn590)按提示还可领取价值800元的编程大礼包! 讲师介绍: 苏奕嘉&nbsp;前阿里UC项目工程师 脚本开发平台官方认证满级(六级)开发者。 我将如何教会你通过【定制脚本】赚到你人生的第一桶金? 零基础程序定制脚本开发课程,是完全针对零脚本开发经验的小白而设计,课程内容共分为3大阶段: ①前期将带你掌握Q开发语言和界面交互开发能力; ②中期通过实战来制作有具体需求的定制脚本; ③后期将解锁脚本的更高阶玩法,打通任督二脉; ④应用定制脚本合法赚取额外收入的完整经验分享,带你通过程序定制脚本开发这项副业,赚取到你的第一桶金!

HoloLens2开发入门教程

本课程为HoloLens2开发入门教程,讲解部署开发环境,安装VS2019,Unity版本,Windows SDK,创建Unity项目,讲解如何使用MRTK,编辑器模拟手势交互,打包VS工程并编译部署应用到HoloLens上等。

基于VHDL的16位ALU简易设计

基于VHDL的16位ALU简易设计,可完成基本的加减、带进位加减、或、与等运算。

MFC一站式终极全套课程包

该套餐共包含从C小白到C++到MFC的全部课程,整套学下来绝对成为一名C++大牛!!!

利用Verilog实现数字秒表(基本逻辑设计分频器练习)

设置复位开关。当按下复位开关时,秒表清零并做好计时准备。在任何情况下只要按下复位开关,秒表都要无条件地进行复位操作,即使是在计时过程中也要无条件地进行清零操作。 设置启/停开关。当按下启/停开关后,将

董付国老师Python全栈学习优惠套餐

购买套餐的朋友可以关注微信公众号“Python小屋”,上传付款截图,然后领取董老师任意图书1本。

Python可以这样学(第一季:Python内功修炼)

董付国系列教材《Python程序设计基础》、《Python程序设计(第2版)》、《Python可以这样学》配套视频,讲解Python 3.5.x和3.6.x语法、内置对象用法、选择与循环以及函数设计与使用、lambda表达式用法、字符串与正则表达式应用、面向对象编程、文本文件与二进制文件操作、目录操作与系统运维、异常处理结构。

计算机操作系统 第三版.pdf

计算机操作系统 第三版 本书全面介绍了计算机系统中的一个重要软件——操作系统(OS),本书是第三版,对2001年出版的修订版的各章内容均作了较多的修改,基本上能反映当前操作系统发展的现状,但章节名称基

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Vue.js 2.0之全家桶系列视频课程

基于新的Vue.js 2.3版本, 目前新全的Vue.js教学视频,让你少走弯路,直达技术前沿! 1. 包含Vue.js全家桶(vue.js、vue-router、axios、vuex、vue-cli、webpack、ElementUI等) 2. 采用笔记+代码案例的形式讲解,通俗易懂

微信公众平台开发入门

本套课程的设计完全是为初学者量身打造,课程内容由浅入深,课程讲解通俗易懂,代码实现简洁清晰。通过本课程的学习,学员能够入门微信公众平台开发,能够胜任企业级的订阅号、服务号、企业号的应用开发工作。 通过本课程的学习,学员能够对微信公众平台有一个清晰的、系统性的认识。例如,公众号是什么,它有什么特点,它能做什么,怎么开发公众号。 其次,通过本课程的学习,学员能够掌握微信公众平台开发的方法、技术和应用实现。例如,开发者文档怎么看,开发环境怎么搭建,基本的消息交互如何实现,常用的方法技巧有哪些,真实应用怎么开发。

150讲轻松搞定Python网络爬虫

【为什么学爬虫?】 &nbsp; &nbsp; &nbsp; &nbsp;1、爬虫入手容易,但是深入较难,如何写出高效率的爬虫,如何写出灵活性高可扩展的爬虫都是一项技术活。另外在爬虫过程中,经常容易遇到被反爬虫,比如字体反爬、IP识别、验证码等,如何层层攻克难点拿到想要的数据,这门课程,你都能学到! &nbsp; &nbsp; &nbsp; &nbsp;2、如果是作为一个其他行业的开发者,比如app开发,web开发,学习爬虫能让你加强对技术的认知,能够开发出更加安全的软件和网站 【课程设计】 一个完整的爬虫程序,无论大小,总体来说可以分成三个步骤,分别是: 网络请求:模拟浏览器的行为从网上抓取数据。 数据解析:将请求下来的数据进行过滤,提取我们想要的数据。 数据存储:将提取到的数据存储到硬盘或者内存中。比如用mysql数据库或者redis等。 那么本课程也是按照这几个步骤循序渐进的进行讲解,带领学生完整的掌握每个步骤的技术。另外,因为爬虫的多样性,在爬取的过程中可能会发生被反爬、效率低下等。因此我们又增加了两个章节用来提高爬虫程序的灵活性,分别是: 爬虫进阶:包括IP代理,多线程爬虫,图形验证码识别、JS加密解密、动态网页爬虫、字体反爬识别等。 Scrapy和分布式爬虫:Scrapy框架、Scrapy-redis组件、分布式爬虫等。 通过爬虫进阶的知识点我们能应付大量的反爬网站,而Scrapy框架作为一个专业的爬虫框架,使用他可以快速提高我们编写爬虫程序的效率和速度。另外如果一台机器不能满足你的需求,我们可以用分布式爬虫让多台机器帮助你快速爬取数据。 &nbsp; 从基础爬虫到商业化应用爬虫,本套课程满足您的所有需求! 【课程服务】 专属付费社群+每周三讨论会+1v1答疑

SEIR课程设计源码与相关城市数据.rar

SEIR结合学报与之前博客结合所做的一些改进,选择其中三个城市进行拟合仿真SEIR结合学报与之前博客结合所做的一些改进,选择其中三个城市进行拟合仿真SEIR结合学报与之前博客结合所做的一些改进,选择其

Python数据挖掘简易入门

&nbsp; &nbsp; &nbsp; &nbsp; 本课程为Python数据挖掘方向的入门课程,课程主要以真实数据为基础,详细介绍数据挖掘入门的流程和使用Python实现pandas与numpy在数据挖掘方向的运用,并深入学习如何运用scikit-learn调用常用的数据挖掘算法解决数据挖掘问题,为进一步深入学习数据挖掘打下扎实的基础。

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!

Java面试题大全(2020版)

发现网上很多Java面试题都没有答案,所以花了很长时间搜集整理出来了这套Java面试题大全,希望对大家有帮助哈~ 本套Java面试题大全,全的不能再全,哈哈~ 一、Java 基础 1. JDK 和 JRE 有什么区别? JDK:Java Development Kit 的简称,java 开发工具包,提供了 java 的开发环境和运行环境。 JRE:Java Runtime Environ...

定量遥感中文版 梁顺林著 范闻捷译

这是梁顺林的定量遥感的中文版,由范闻捷等翻译的,是电子版PDF,解决了大家看英文费时费事的问题,希望大家下载看看,一定会有帮助的

GIS程序设计教程 基于ArcGIS Engine的C#开发实例

张丰,杜震洪,刘仁义编著.GIS程序设计教程 基于ArcGIS Engine的C#开发实例.浙江大学出版社,2012.05

人工智能-计算机视觉实战之路(必备算法+深度学习+项目实战)

系列课程主要分为3大阶段:(1)首先掌握计算机视觉必备算法原理,结合Opencv进行学习与练手,通过实际视项目进行案例应用展示。(2)进军当下最火的深度学习进行视觉任务实战,掌握深度学习中必备算法原理与网络模型架构。(3)结合经典深度学习框架与实战项目进行实战,基于真实数据集展开业务分析与建模实战。整体风格通俗易懂,项目驱动学习与就业面试。 建议同学们按照下列顺序来进行学习:1.Python入门视频课程 2.Opencv计算机视觉实战(Python版) 3.深度学习框架-PyTorch实战/人工智能框架实战精讲:Keras项目 4.Python-深度学习-物体检测实战 5.后续实战课程按照自己喜好选择就可以

三个项目玩转深度学习(附1G源码)

从事大数据与人工智能开发与实践约十年,钱老师亲自见证了大数据行业的发展与人工智能的从冷到热。事实证明,计算机技术的发展,算力突破,海量数据,机器人技术等,开启了第四次工业革命的序章。深度学习图像分类一直是人工智能的经典任务,是智慧零售、安防、无人驾驶等机器视觉应用领域的核心技术之一,掌握图像分类技术是机器视觉学习的重中之重。针对现有线上学习的特点与实际需求,我们开发了人工智能案例实战系列课程。打造:以项目案例实践为驱动的课程学习方式,覆盖了智能零售,智慧交通等常见领域,通过基础学习、项目案例实践、社群答疑,三维立体的方式,打造最好的学习效果。

微信小程序开发实战之番茄时钟开发

微信小程序番茄时钟视频教程,本课程将带着各位学员开发一个小程序初级实战类项目,针对只看过官方文档而又无从下手的开发者来说,可以作为一个较好的练手项目,对于有小程序开发经验的开发者而言,可以更好加深对小程序各类组件和API 的理解,为更深层次高难度的项目做铺垫。

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

去除异常值matlab程序

数据预处理中去除异常值的程序,matlab写成

用verilog HDL语言编写的秒表

在秒表设计中,分模块书写。用在七段数码管上显示。输入频率是1KHZ.可以显示百分秒,秒,分。如要显示小时,只需修改leds里的代码和主模块代码。改程序以通过硬件电路验证。完全正确。

[透视java——反编译、修补和逆向工程技术]源代码

源代码。

相关热词 c# 解析cad c#数字格式化万 c#int转byte c#格式化日期 c# wpf 表格 c# 实现ad域验证登录 c#心跳包机制 c#使用fmod.dll c#dll vb 调用 c# outlook
立即提问
相关内容推荐