关于Spring事务传播级别PROPAGATION_NESTED的问题

一年前记得做过Nested传播级别的测试,当时结果是同Spring文档上介绍的一致的,即通过创建Savepoint实现嵌套事务,达到内层事务若抛出异常(unchecked exception)则回滚到savepoint处,但不影响外层事务;外层事务的回滚会一起回滚内层事务;
现在碰到的问题是,内层事务抛出unchecked exception,按照上述逻辑应该会回滚内层事务提交的数据,即便外层事务提交的情况下,但测试结果并非如此,外层事务一提交,内层方法创建的数据仍然被提交(debug显示内层事务已调用rollback),不知道是哪地方出了错误,现将测试代码贴上,请大家帮忙分析!
[code="java"]
<?xml version="1.0" encoding="UTF-8"?>

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="orderDao" class="com.liuj.dao.hibernate.OrderHibernateDao" autowire="byType"/>    
<bean id="orderService" class="com.liuj.service.impl.OrderServiceImpl" autowire="byName"/>

<bean id="productDao" class="com.liuj.dao.hibernate.ProductHibernateDao" autowire="byType"/>    
<bean id="productService" class="com.liuj.service.impl.ProductServiceImpl" autowire="byName"/>


<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
    <property name="beanNames">
        <list>                          
            <!-- beanNames for system.deployTargetAdvisor -->
            <value>orderService</value>
            <value>productService</value>
        </list>
    </property>
    <property name="interceptorNames">
        <list>
            <value>system.transactionAdvisor</value>
        </list>
    </property>
</bean> 

<bean id="system.transactionAdvisor" class="org.springframework.aop.support.DefaultPointcutAdvisor">
    <property name="advice" ref="system.transactionInterceptor"/>
    <property name="pointcut" ref="system.transactionPointcut"/>        
</bean>

<bean id="system.transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
    <property name="transactionManager"><ref bean="system.platformTransactionManager"/></property>
    <property name="transactionAttributes"> 
        <props> 
            <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> 
            <prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>  
            <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
            <prop key="list*">PROPAGATION_REQUIRED,readOnly</prop>
            <prop key="query*">PROPAGATION_REQUIRED,readOnly</prop>     
            <prop key="innerSave*">PROPAGATION_NESTED</prop>
            <prop key="*">PROPAGATION_REQUIRED</prop>
        </props> 
    </property>         
</bean> 
<bean id="system.transactionPointcut" class="org.springframework.aop.support.JdkRegexpMethodPointcut">
    <property name="patterns">
        <list>
            <value>com.liuj.service.OrderService.*</value>
            <value>com.liuj.service.ProductService.*</value>
        </list>
    </property>
</bean>     

<!-- Hibernate SessionFactory -->
<bean id="system.sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="system.datasource"/>
    <property name="annotatedClasses">
        <list>
            <value>com.liuj.model.Order</value>
            <value>com.liuj.model.Product</value>
        </list>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">${hibernate.dialect}</prop>
            <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
            <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
            <prop key="hibernate.max_fetch_depth">3</prop>
            <prop key="hibernate.hbm2ddl.auto">update</prop>
        </props>
    </property>
</bean>


<!-- Local DataSource that works in any environment --> 
<!-- 
<bean id="system.datasource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
    <property name="driverClass" value="${jdbc.driverClassName}" />
    <property name="jdbcUrl" value="${jdbc.url}"/>
    <property name="user" value="${jdbc.username}"/>
    <property name="password" value="${jdbc.password}"/>    
    <property name="initialPoolSize" value="${jdbc.initialPoolSize}" /> 
    <property name="minPoolSize" value="${jdbc.minPoolSize}" />
    <property name="maxPoolSize" value="${jdbc.maxPoolSize}"/>
    <property name="idleConnectionTestPeriod" value="300" />
    <property name="breakAfterAcquireFailure" value="true" />
    <property name="checkoutTimeout" value="100000" />
</bean>
 -->

<bean id="system.datasource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="${jdbc.driverClassName}" />
    <property name="url" value="${jdbc.url}"/>
    <property name="username" value="${jdbc.username}"/>
    <property name="password" value="${jdbc.password}"/>
</bean>

<!--
-->


<bean id="system.propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
            <value>classpath:jdbc.properties</value>
        </list>
    </property> 
</bean>


[/code]
[code="java"]

public class OrderHibernateDao extends HibernateDaoSupport implements OrderDao {

public void save(Order order) {
    getHibernateTemplate().save(order);
}

}

public class ProductHibernateDao extends HibernateDaoSupport implements ProductDao {

public void save(Product product) {
    getHibernateTemplate().save(product);
}

}
public class OrderServiceImpl implements OrderService {

private ProductService productService;

private OrderDao orderDao;

public void setOrderDao(OrderDao orderDao) {
    this.orderDao = orderDao;
}

public void setProductService(ProductService productService) {
    this.productService = productService;
}

public void outerSave(Order order) {
    orderDao.save(order);
    try {
        productService.innerSave();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

}
public class ProductServiceImpl implements ProductService {

private ProductDao productDao;

public void setProductDao(ProductDao productDao) {
    this.productDao = productDao;
}

public void innerSave() {
    Product product = new Product();
    product.setName("inner product");
    productDao.save(product);
    if (true) {
        throw new RuntimeException("error happend");
    }
}

}
[/code]
测试代码如下
[code="java"]
public class OrderServiceTest extends DependencyInjectionSpringContextTests {

private OrderService orderService;

@Test
public void testSave() {
    Order order = new Order();
    order.setName("outer order");
    orderService.outerSave(order);
}

public void setOrderService(OrderService orderService) {
    this.orderService = orderService;
}

}
[/code]
按照我的理解,ProductService.innerSave()方法抛出了runtime exception,那么结果应该是Order被保存,Product被回滚,但实际测试结果显示两个对象都被保存(debug显示save point被创建,并被rollback), why???

3个回答

PROPAGATION_NESTED使用了一个单独的物理事务, 这个事务拥有多个可以回滚的保存点。这样部分回滚允许内部事务在它的作用域内触发一个回滚, 并且外部事务能够不受影响的继续。 这通常是对应于JDBC的保存点,所以只会在 JDBC 资源事务管理上起效 (具体请参见 Spring的DataSourceTransactionManager).而DataSourceTransactionManager只会对Spring Jdbc(即JdbcTemplate)或者ibatis等jdbc操作有效,你的配置里使用了hibernate的sessionFacotry来访问,所以不会有效果;

你引用了错误的system.platformTransactionManager

/**
* Execute within a nested transaction if a current transaction exists,
* behave like PROPAGATION_REQUIRED else. There is no analogous feature in EJB.
*

Note: Actual creation of a nested transaction will only work on specific
* transaction managers. Out of the box, this only applies to the JDBC
* DataSourceTransactionManager when working on a JDBC 3.0 driver.
* Some JTA providers might support nested transactions as well.
* @see org.springframework.jdbc.datasource.DataSourceTransactionManager
*/
NESTED(TransactionDefinition.PROPAGATION_NESTED);

参加源码里面的javadoc

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
JTA使用Propagation.NESTED事务传播方式报错

# JTA使用Propagation.NESTED事务传播方式报错 spring boot配置JTA后,使用Propagation.NESTED事务传播方式,出现异常,切换其他传播方式代码正常。 <br/> 事务配置: A service: @Transactional @Override public void saveOrUpdate(Msg msg) { msgJDBCDAO.save(msg); MsgReceiver msgReceiver = new MsgReceiver(); msgReceiver.setId(msg.getMsgId()); msgReceiver.setMsgId(msg.getMsgId()); msgReceiver.setUserId(1000L); msgReceiver.setReadFlag(0); msgReceiver.setDeleteFlag(0); msgReceiverJDBCService.save(msgReceiver); } B service: @Transactional(propagation = Propagation.NESTED) @Override public void save(MsgReceiver msgReceiver) { msgReceiverJDBCDAO.save(msgReceiver); } <br/> <br/><br/><br/> ## 报错信息如下: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [insert into t_msg_receiver values (?, ?, ?, ?, ?)]; SQL state [null]; error code [0]; Failed to suspend branch: XAResourceTransaction: 3139322E3136382E3232372E322E746D313537343036303233343835373030303031:3139322E3136382E3232372E322E746D31; nested exception is com.atomikos.jdbc.AtomikosSQLException: Failed to suspend branch: XAResourceTransaction: 3139322E3136382E3232372E322E746D313537343036303233343835373030303031:3139322E3136382E3232372E322E746D31 at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1442) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:632) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:861) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:916) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:926) at com.spring.boot.example.dao.jdbc.MsgReceiverJDBCDAO.save(MsgReceiverJDBCDAO.java:16) at com.spring.boot.example.dao.jdbc.MsgReceiverJDBCDAO$$FastClassBySpringCGLIB$$bdb85c72.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) at com.spring.boot.example.dao.jdbc.MsgReceiverJDBCDAO$$EnhancerBySpringCGLIB$$6e56ffb6.save(<generated>) at com.spring.boot.example.service.jdbc.impl.MsgReceiverJDBCServiceImpl.save(MsgReceiverJDBCServiceImpl.java:21) at com.spring.boot.example.service.jdbc.impl.MsgReceiverJDBCServiceImpl$$FastClassBySpringCGLIB$$a40f40ea.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) at com.spring.boot.example.service.jdbc.impl.MsgReceiverJDBCServiceImpl$$EnhancerBySpringCGLIB$$65349f92.save(<generated>) at com.spring.boot.example.service.jdbc.impl.MsgJDBCServiceImpl.saveOrUpdate(MsgJDBCServiceImpl.java:46) at com.spring.boot.example.service.jdbc.impl.MsgJDBCServiceImpl$$FastClassBySpringCGLIB$$a07b1dd9.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) at com.spring.boot.example.service.jdbc.impl.MsgJDBCServiceImpl$$EnhancerBySpringCGLIB$$ecf643bf.saveOrUpdate(<generated>) at com.spring.boot.example.service.MsgJDBCServiceTest.test(MsgJDBCServiceTest.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Caused by: com.atomikos.jdbc.AtomikosSQLException: Failed to suspend branch: XAResourceTransaction: 3139322E3136382E3232372E322E746D313537343036303233343835373030303031:3139322E3136382E3232372E322E746D31 at com.atomikos.jdbc.AtomikosSQLException.throwAtomikosSQLException(AtomikosSQLException.java:29) at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:217) at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:122) at com.sun.proxy.$Proxy98.prepareStatement(Unknown Source) at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1555) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:614) ... 63 more Caused by: com.atomikos.datasource.xa.session.InvalidSessionHandleStateException: Failed to suspend branch: XAResourceTransaction: 3139322E3136382E3232372E322E746D313537343036303233343835373030303031:3139322E3136382E3232372E322E746D31 at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.transactionSuspended(BranchEnlistedStateHandler.java:98) at com.atomikos.datasource.xa.session.TransactionContext.transactionSuspended(TransactionContext.java:94) at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:165) at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:207) ... 67 more Caused by: com.mysql.cj.jdbc.MysqlXAException: XAER_INVAL: Invalid arguments (or unsupported command) at com.mysql.cj.jdbc.MysqlXAConnection.mapXAExceptionFromSQLException(MysqlXAConnection.java:344) at com.mysql.cj.jdbc.MysqlXAConnection.dispatchCommand(MysqlXAConnection.java:329) at com.mysql.cj.jdbc.MysqlXAConnection.end(MysqlXAConnection.java:267) at com.atomikos.datasource.xa.XAResourceTransaction.xaSuspend(XAResourceTransaction.java:700) at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.transactionSuspended(BranchEnlistedStateHandler.java:94) ... 70 more Caused by: java.sql.SQLException: XAER_INVAL: Invalid arguments (or unsupported command) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:764) at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:648) at

spring事务传播异常,事务回滚异常

@Transactional(value="tx2",propagation=Propagation.REQUIRED)//也可以修改为REQUIRED @RequestMapping(value="/TranClass_never",method=RequestMethod.GET) @ResponseBody public void dba_test_never(){ for(int i=0;i<5;i++){ peod.insertPeo(i); } try{ del_never(3); }catch(Exception e){ e.printStackTrace(); } String qq=null; qq.equals(""); } @Transactional(value="tx2",propagation=Propagation.NEVER ) public void del_never(int i){ peod.insertPeo(100); String qq=null; qq.equals(""); peod.delPeo(i); peod.delPeo(i+1); } del_never方法的事务声明为NEVER,系统没有报NEVER的异常;将此方法事务声明为REQUIRES_NEW时,外层事务发生回滚时里面的事务也发生回滚(这两事务应该互不影响的,为什么会发生这种错误?);将此方法事务声明为NESTED时,且将dba_test_never方法中空指针异常的语句清除后,为什么del_never方法无法进行事务回滚?

spring 嵌套事务 的 加锁 问题

有两个service:ServiceA 和 ServiceB [code="java"] ServiceA { methodA() { methodB(); // do many other things ... } } ServiceB { methodB() { ... } } [/code] 现在的 问题是 如果 ServiceB 的 methodB 持有锁(比如 LockMode.UPGRADE),而 ServiceA 中的methodA 在调用 methodB后还要处理很多事情,如果它们在一个事务里就会导致methodB 持有锁过长时间。如果把methodB的传播行为设为PROPAGATION_REQUIRES_NEW的话,如果methodA失败rollback,methodB不会rollback,会产生脏数据。设为PROPAGATION_REQUIRES_NESTED因为是嵌套事务,应该也不会释放锁。 不知道有什么 好的方法可以减少 持锁时间,又可以保证methodA rollback 时,methodB也 rollback 。 先谢过! [b]问题补充:[/b] to joachimz "PROPAGATION_REQUIRED就好了呀,两者同一个事务" 那样的话锁在外部事务结束时才会释放,没有解决我的问题啊。 [b]问题补充:[/b] to joachimz 谢谢你的回复。 “methodB就是需要执行很长时间,怎么可能在没有锁的情况下执行,又有事务的支持呢?” methodB 持有锁,但是它执行的很短,调用它的methodA 会执行很多其他的事情,这样如果它们在一个事务里,methodA 的事务提交之后锁才会释放,锁是独占操作,时间太长影响并发操作了。

controller中获得hibernate的session方法

环境:Spring+Hibernate,事务由org.springframework.orm.hibernate4.HibernateTransactionManager管理 需求是这样的,带有@Transactional注解的Service类中有两个方法: 1. check()----用来验证数据 2. insert()----用来插入数据 我想在controller方法中显式声明一个事物并把check()和insert()放入这个事务中,代码如下 ``` Session session = transactionManager.getSessionFactory().openSession();//**1** //Session session = transactionManager.getSessionFactory().getCurrentSession();//**2** Transaction tx = session.beginTransaction();//手动开启事务 try{ check(); insert(); tx.commit(); }catch(Exception e){ tx.rollback(); } ``` 现在问题来了,在使用由1标注的方法获取session是可以的,但是用2方法会报 org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: nested transactions not supported 这是什么原因呢?难道进入service必须另外开启事务?

碰到个很小白的问题,希望各位大神给抽空解决下

今天试着搭建 struts1+spring+ibatis框架,结果在项目启动时就一直报错,下面是我的配置文件: <?xml version="1.0" encoding="GBK"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd" > <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" lazy-init="true" > <!-- oracle --> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:ORCL" /> <property name="username" value="wendy"/> <property name="password" value="123"/> </bean> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> <bean id="sqlMapClientBase" abstract="true" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation" value="/WEB-INF/config/sqlMapConfig.xml" /> <property name="dataSource" ref="com.shunde.spring.dataSource" /> </bean> <bean id="sqlMapClient" parent="sqlMapClientBase"></bean> <!-- 分页查询取总数据量使用 --> <bean id="sqlMapClientCount" parent="sqlMapClientBase"></bean> <!-- 分页查询取部分数据使用 --> <bean id="sqlMapClientPage" parent="sqlMapClientBase"></bean> <bean id="attributeSource" class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource"> <property name="properties"> <props> <!--PROPAGATION_REQUIRED是事务传播行为 如果当前没有事务,就创建一个事务;如果已经存在事务,则加入事务 --> <!-- -Exception指定事务回滚规则 方法内部出现java.lang.Exception及其子类异常事务会自动回滚 可以用逗号分隔多个回滚规则。“-”前缀强制回滚,“+”前缀指定提交(这允许即使抛出unchecked异常时也可以提交事务) --> <prop key="save*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="edit*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="add*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="init*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="delete*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="insert*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="update*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="create*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="getNext*">PROPAGATION_REQUIRED,-Exception</prop> <!--<prop key="query*">PROPAGATION_REQUIRED,readOnly</prop> --><prop key="transaction*">PROPAGATION_REQUIRED,-Exception</prop> </props> </property> </bean> <bean id="abstractTxDefinition" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" lazy-init="true"> <property name="transactionManager"> <ref bean="transactionManager" /> </property> <property name="transactionAttributeSource"> <ref bean="attributeSource"/> </property> </bean> <bean id="stmStuInfoDaoImpl" class="com.ssi.sm.dao.impl.StmStuInfoDaoImpl"> <property name="sqlMapClient" ref="sqlMapClient" /> </bean> <bean id="stmStuInfoServiceTarget" class="com.ssi.sm.service.impl.StmStuInfoServiceImpl"> <property name="stmStuInfoDao" ref="stmStuInfoDaoImpl"/> </bean> <bean id="stmStuInfoServiceImpl" parent="abstractTxDefinition"> <property name="target" ref="stmStuInfoServiceTarget"/> </bean> <bean name="/stmStuInfoAction" class="com.ssi.sm.action.StmStuInfoAction"> <property name="stmStuInfoService" ref="stmStuInfoServiceImpl"/> </bean> </beans> 报的错是: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stmStuInfoServiceTarget' defined in ServletContext resource [/WEB-INF/config/transaction-define.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlMapClient' is required 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:4210) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:802) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1068) at org.apache.catalina.core.StandardHost.start(StandardHost.java:822) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:759) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) 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:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Caused by: java.lang.IllegalArgumentException: Property 'sqlMapClient' is required at org.springframework.orm.ibatis.SqlMapClientTemplate.afterPropertiesSet(SqlMapClientTemplate.java:147) at org.springframework.orm.ibatis.support.SqlMapClientDaoSupport.checkDaoConfig(SqlMapClientDaoSupport.java:108) at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) ... 39 more

spring3与hibernate4整合session问题

[color=red][b]问题描述:[/b][/color] 整合spring3与hibernate4时,发生错误:[u]nested exception is org.hibernate.HibernateException: No Session found for current thread[/u] 之后查找资料,添加[u]:<prop key="hibernate.current_session_context_class">thread</prop>[/u]属性,报错:org.hibernate.HibernateException: createQuery is not valid without active transaction, 查找资料说,删除上面我添加的那个属性,我被陷入死循环了。 [color=red][b]代码如下[/b][/color] [b]配置文件:[/b] [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:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:config/jdbc.properties</value> </list> </property> </bean> <!--数据源--> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass"> <value>${mysql.driver}</value> </property> <property name="jdbcUrl"> <value>${mysql.url}</value> </property> <property name="user"> <value>${mysql.userName}</value> </property> <property name="password"> <value>${mysql.password}</value> </property> <property name="acquireIncrement"> <value>${c3p0.acquireIncrement}</value> </property> <property name="initialPoolSize"> <value>${c3p0.initialPoolSize}</value> </property> <property name="minPoolSize"> <value>${c3p0.minPoolSize}</value> </property> <property name="maxPoolSize"> <value>${c3p0.maxPoolSize}</value> </property> <property name="maxIdleTime"> <value>${c3p0.maxIdleTime}</value> </property> <property name="idleConnectionTestPeriod"> <value>${c3p0.idleConnectionTestPeriod}</value> </property> <property name="maxStatements"> <value>${c3p0.maxStatements}</value> </property> <property name="numHelperThreads"> <value>${c3p0.numHelperThreads}</value> </property> <property name="testConnectionOnCheckout"> <value>${c3p0.testConnectionOnCheckout}</value> </property> <property name="preferredTestQuery"> <value>${c3p0.preferredTestQuery}</value> </property> </bean> <!-- Session 工厂配置 --> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="packagesToScan"> <list> <value>com..entity</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> <!-- 解决no session found --> <prop key="hibernate.current_session_context_class">thread</prop> </props> </property> </bean> <!-- 配置事务管理器 --> <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <!-- 配置事物管理器,在*ServiceImpl里写@Transactional就可以启用事物管理 --> <tx:annotation-driven transaction-manager="transactionManager" /> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <!-- 方法对应的传播属性 --> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="create*" propagation="REQUIRED" /> <tx:method name="insert*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="merge*" propagation="REQUIRED" /> <tx:method name="del*" propagation="REQUIRED" /> <tx:method name="remove*" propagation="REQUIRED" /> <tx:method name="put*" propagation="REQUIRED" /> <tx:method name="use*" propagation="REQUIRED"/> <tx:method name="get*" propagation="REQUIRED" read-only="true" /> <tx:method name="count*" propagation="REQUIRED" read-only="true" /> <tx:method name="find*" propagation="REQUIRED" read-only="true" /> <tx:method name="list*" propagation="REQUIRED" read-only="true" /> <tx:method name="*" read-only="true" /> </tx:attributes> </tx:advice> <!-- 事务控制位置,一般在业务层service --> <aop:config> <aop:pointcut id="txPointcut" expression="execution(* com..service..*.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/> </aop:config> </beans> [/code] [b]DAO[/b] [code="java"] package com.test; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; public class BaseDao { @Autowired private SessionFactory sessionFactory; public Session getCurrentSession() { return sessionFactory.getCurrentSession(); } } [/code] [code="java"] package com.test.dao.impl; import java.util.List; import org.hibernate.Query; import org.springframework.stereotype.Repository; import com.test.BaseDao; import com.test.dao.IUserDao; import com.test.entity.User; @Repository public class UserDaoImpl extends BaseDao implements IUserDao{ @SuppressWarnings("unchecked") @Override public List<User> findAllUsers() { String hql = "FROM User"; Query query = getCurrentSession().createQuery(hql); return query.list(); } } [/code] 各层次的ioc都OK的,问题出在哪里,或者解答下原因也可以,我自己查找资料,谢谢了。

apringtask项目使用ssm框架但是并没有使用到mvc项目运行后报很多错 是配置文件有问题嚒

//这是spring-mybatis配置文件 <?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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- 开启注解配置 --> <context:annotation-config /> <!-- 把SqlSessionFactory交给spring管理 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <!-- 注入数据源 --> <property name="dataSource" ref="dataSource"/> <!-- 注入mybatis配置文件路径 --> <property name="configLocation" value="classpath:mybatis-config.xml" /> <!-- 注入映射文件 mapper/*.xml --> <property name="mapperLocations" value="classpath:com/zznode/qoe/task/mapper/*.xml"></property> </bean> <context:property-placeholder location="classpath:db.properties" ignore-unresolvable="true"/> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${jdbc.driver}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <!--initialSize: 初始化连接--> <property name="initialSize" value="5"/> <!--maxIdle: 最大空闲连接--> <property name="maxIdle" value="10"/> <!--minIdle: 最小空闲连接--> <property name="minIdle" value="5"/> <!--maxActive: 最大连接数量--> <property name="maxActive" value="50"/> <!--removeAbandoned: 是否自动回收超时连接--> <property name="removeAbandoned" value="true"/> <!--removeAbandonedTimeout: 超时时间(以秒数为单位)--> <property name="removeAbandonedTimeout" value="300"/> <!--maxWait: 超时等待时间以毫秒为单位 6000毫秒/1000等于60秒--> <property name="maxWait" value="3000"/> <property name="validationQuery" value="SELECT 1" /> <property name="testOnBorrow" value="true"/> </bean> <!-- 事务管理 transaction manager, use JtaTransactionManager for global tx --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <!-- 配置事务拦截器和传播属性 --> <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <property name="transactionManager" ref="transactionManager" /> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="list*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="load*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="query*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="submit*">PROPAGATION_REQUIRED</prop> <prop key="create*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="insert*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="update*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="modify*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="delete*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="remove*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="do*">PROPAGATION_REQUIRED</prop> <prop key="execute*">PROPAGATION_REQUIRED</prop> <prop key="exe*">PROPAGATION_REQUIRED</prop> <prop key="backup">PROPAGATION_REQUIRED,-Exception</prop> <prop key="rollback">PROPAGATION_REQUIRED,-Exception</prop> <prop key="calculate">PROPAGATION_REQUIRED,-Exception</prop> <prop key="batchInsert">PROPAGATION_REQUIRED,-Exception</prop> <prop key="batchUpdate">PROPAGATION_REQUIRED,-Exception</prop> </props> </property> </bean> <!-- Mapper接口所在包名,Spring会自动查找其下的Mapper 不用再配置mapper扫描--> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.zznode.qoe.task.mapper" /> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> </bean> </beans> ``` 报错如下: 01-Apr-2019 10:56:58.839 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 01-Apr-2019 10:56:58.930 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.web.context.ContextLoader.initWebApplicationContext Root WebApplicationContext: initialization started 01-Apr-2019 10:56:59.219 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.web.context.support.XmlWebApplicationContext.prepareRefresh Refreshing Root WebApplicationContext: startup date [Mon Apr 01 10:56:59 CST 2019]; root of context hierarchy 01-Apr-2019 10:56:59.324 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from class path resource [spring.xml] 01-Apr-2019 10:56:59.632 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from class path resource [spring-mybatis.xml] 01-Apr-2019 10:56:59.682 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from class path resource [jobs.xml] 01-Apr-2019 10:57:00.297 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from class path resource [spring-mybatis.xml] 01-Apr-2019 10:57:00.694 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'mtMonitorServerInfoMapper' and 'com.zznode.qoe.task.mapper.MtMonitorServerInfoMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.697 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'mtServerAlarmMapper' and 'com.zznode.qoe.task.mapper.MtServerAlarmMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.697 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'newTbResultMapper' and 'com.zznode.qoe.task.mapper.NewTbResultMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.698 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'sysAuthInfoMapper' and 'com.zznode.qoe.task.mapper.SysAuthInfoMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.703 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'sysMailUserInfoMapper' and 'com.zznode.qoe.task.mapper.SysMailUserInfoMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.706 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'sysMonitorServerAttrMapper' and 'com.zznode.qoe.task.mapper.SysMonitorServerAttrMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.707 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'sysMonitorServerMapper' and 'com.zznode.qoe.task.mapper.SysMonitorServerMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.708 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbBssUserMapper' and 'com.zznode.qoe.task.mapper.TbBssUserMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.708 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbCbssUserMapper' and 'com.zznode.qoe.task.mapper.TbCbssUserMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.708 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbDistributionMapper' and 'com.zznode.qoe.task.mapper.TbDistributionMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.709 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbresultMapper' and 'com.zznode.qoe.task.mapper.TbresultMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.709 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbSpeedUserCountMapper' and 'com.zznode.qoe.task.mapper.TbSpeedUserCountMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.710 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbUploadFileInfoMapper' and 'com.zznode.qoe.task.mapper.TbUploadFileInfoMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.711 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbWordbookMapper' and 'com.zznode.qoe.task.mapper.TbWordbookMapper' mapperInterface. Bean already defined with the same name! 01-Apr-2019 10:57:00.711 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.doScan No MyBatis mapper was found in '[com.zznode.qoe.task.mapper]' package. Please check your configuration. 01-Apr-2019 10:57:00.745 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PropertySourcesPlaceholderConfigurer.loadProperties Loading properties file from class path resource [db.properties] 01-Apr-2019 10:57:00.760 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PropertySourcesPlaceholderConfigurer.loadProperties Loading properties file from class path resource [config.properties] 01-Apr-2019 10:57:00.767 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PropertySourcesPlaceholderConfigurer.loadProperties Loading properties file from class path resource [db.properties] 01-Apr-2019 10:57:00.929 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'dataSource' of type [class org.apache.commons.dbcp.BasicDataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.671 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'sqlSessionFactory' of type [class org.mybatis.spring.SqlSessionFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.672 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'sqlSessionFactory' of type [class org.apache.ibatis.session.defaults.DefaultSqlSessionFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.684 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'mtMonitorServerInfoMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.686 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'mtServerAlarmMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.688 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'newTbResultMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.691 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'sysAuthInfoMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.694 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'sysMailUserInfoMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.695 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'sysMonitorServerAttrMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.697 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'sysMonitorServerMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.699 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbBssUserMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.703 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbCbssUserMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.707 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbDistributionMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.710 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbresultMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.714 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbSpeedUserCountMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.715 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbUploadFileInfoMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:01.717 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbWordbookMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 01-Apr-2019 10:57:02.421 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.springframework.web.context.support.XmlWebApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hbServerMonitoJob' defined in file [E:\ZHIZHEN\springtask\springtask\target\spring-task\WEB-INF\classes\com\zznode\qoe\task\control\HbServerMonitoJob.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zznode.qoe.task.control.HbServerMonitoJob]: Constructor threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1050) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ```

ssh中spring的配置加上事务配置后就出错,恳请大家帮忙

出错信息: 2011-3-27 20:15:08 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\java\bin;D:\Program Files\Tomcat 5.5\bin 2011-3-27 20:15:08 org.apache.coyote.http11.Http11BaseProtocol init 信息: Initializing Coyote HTTP/1.1 on http-1688 2011-3-27 20:15:08 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 406 ms 2011-3-27 20:15:08 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2011-3-27 20:15:08 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/5.5.16 2011-3-27 20:15:08 org.apache.catalina.core.StandardHost start 信息: XML validation disabled 2011-03-27 20:15:09,062 INFO [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/SSHExt]] - Initializing Spring root WebApplicationContext 2011-03-27 20:15:09,062 INFO [org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization started 2011-03-27 20:15:09,203 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing Root WebApplicationContext: startup date [Sun Mar 27 20:15:09 CST 2011]; root of context hierarchy 2011-03-27 20:15:09,359 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml] 2011-03-27 20:15:09,593 ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1112) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021) at org.apache.catalina.core.StandardHost.start(StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:709) at org.apache.catalina.startup.Catalina.start(Catalina.java:551) 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:275) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1812) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:866) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1319) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at org.springframework.transaction.config.TxAdviceBeanDefinitionParser.getBeanClass(TxAdviceBeanDefinitionParser.java:69) at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:66) at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59) at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1335) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) ... 37 more 2011-03-27 20:15:09,593 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/SSHExt]] - Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1112) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021) at org.apache.catalina.core.StandardHost.start(StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:709) at org.apache.catalina.startup.Catalina.start(Catalina.java:551) 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:275) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1812) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:866) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1319) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at org.springframework.transaction.config.TxAdviceBeanDefinitionParser.getBeanClass(TxAdviceBeanDefinitionParser.java:69) at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:66) at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59) at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1335) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) ... 37 more 2011-3-27 20:15:09 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 2011-3-27 20:15:09 org.apache.catalina.core.StandardContext start 严重: Context [/SSHExt] startup failed due to previous errors 2011-03-27 20:15:09,593 INFO [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/SSHExt]] - Closing Spring root WebApplicationContext 2011-3-27 20:15:09 org.apache.coyote.http11.Http11BaseProtocol start 信息: Starting Coyote HTTP/1.1 on http-1688 2011-3-27 20:15:09 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:8009 2011-3-27 20:15:09 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/47 config=null 2011-3-27 20:15:09 org.apache.catalina.storeconfig.StoreLoader load 信息: Find registry server-registry.xml at classpath resource 2011-3-27 20:15:09 org.apache.catalina.startup.Catalina start 信息: Server startup in 1703 ms 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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> <!-- 配置数据库连接池 --> <!-- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>oracle.jdbc.OracleDriver</value> </property> <property name="url"> <value>jdbc:oracle:thin:@localhost:1521:orcl</value> </property> <property name="password"> <value>orcl</value> </property> <property name="username"> <value>yhj</value> </property> </bean> <property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property> <property name="connection.url">jdbc:jtds:sqlserver://127.0.0.1:1433;DatabaseName=hibernate</property> --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>net.sourceforge.jtds.jdbc.Driver</value> </property> <property name="url"> <value>jdbc:jtds:sqlserver://127.0.0.1:1433;databaseName=sshtest</value> </property> <property name="password"> <value>sa</value> </property> <property name="username"> <value>sa</value> </property> </bean> <!-- <property name="connection.url"> jdbc:sqlserver://127.0.0.1:1433;databaseName=HTSiteSrv </property> <property name="connection.username">sa</property> <property name="connection.password">sa</property> <property name="connection.driver_class"> com.microsoft.sqlserver.jdbc.SQLServerDriver </property> --> <!-- 配置sessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="dataSource"/> </property> <property name="mappingResources"> <list> <value>UserTab.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <!-- <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>--> <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> <!--AOP的事务管理 --> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!--传播特性 --> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="get*" read-only="true" /> <tx:method name="search*" read-only="true" /> </tx:attributes> </tx:advice> <!--配置事务管理器应用的范围 --> <aop:config> <aop:pointcut id="userServiceMethods" expression="execution(*com.ssh.test.dao.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="userServiceMethods" /> </aop:config> <!-- dao配置 --> <bean id="userDao" class="com.ssh.test.dao.UserDao" scope="prototype"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean> <!-- 业务层配置 --> <bean id="userManageBusiness" class="com.ssh.test.business.UserManageBusiness" scope="prototype"> <property name="userDao"> <ref bean="userDao" /> </property> </bean> <!-- action配置 --> <bean id="loginAction" class="com.ssh.test.action.LoginAction" scope="prototype"> </bean> <bean id="userManageAction" class="com.ssh.test.action.UserManageAction" scope="prototype"> <property name="userManageBusiness"> <ref bean="userManageBusiness" /> </property> </bean> <bean id="deptManageAction" class="com.ssh.test.action.DeptManageAction" scope="prototype"> </bean> </beans> 去掉事务的配置就好,但是加上了就错,大家给力啊

Cannot open connection

HTTP Status 500 - Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection <?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.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> <!-- 加载jdbc.properties文件 --> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>classpath:jdbc.properties</value> </property> </bean> <!-- 定义数据源 --> <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="${jdbc.driverClassName}" ></property> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> </bean> <!-- 配置sessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="hibernateProperties"> <props> <prop key="hibernate.autoReconnect">true</prop> </props> </property> <property name="configLocation"> <value>classpath:hibernate.cfg.xml</value> </property> </bean> <!-- 配置事务管理器 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean> <!-- 配置事务的传播特性 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="query*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="*" read-only="true" /> </tx:attributes> </tx:advice> <!-- 那些类的哪些方法参与事务 --> <aop:config> <aop:pointcut id="allManagerMethod" expression="execution(* cn.ittx.service.impl.*.*(..))" /> <aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice" /> </aop:config> </beans>

数据库连接错误

项目架构struts2+hibernate+spring有一个每隔一秒的spring定时器执行数据库的增删改查操作 事物配置如下: <!-- 指定事务管理器 --> <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" /> <!-- 配置事务的传播特性 --> <aop:config proxy-target-class="true"> <!-- 配置一个切入点,匹配dao包下 所有以Impl结尾的类的所有方法的执行 --> <aop:advisor pointcut="execution(* *..*DaoImpl.*(..))" advice-ref="txAdvice" /> <!-- 指定在txAdvice切入点应用txAdvice事务切面 --> </aop:config> <tx:advice id="txAdvice"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="query*" read-only="true" /> <tx:method name="find*" read-only="true"/> <tx:method name="get*" read-only="true"/> <tx:method name="execute*" propagation="REQUIRED"/> <tx:method name="*" propagation="REQUIRED"/> </tx:attributes> </tx:advice> 当使用此配置时(定时任务执行一段时间后)出现如下异常: Exception in thread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1" java.lang.OutOfMemoryError: Java heap space 当使用如下配置时: <!-- 指定事务管理器 --> <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" /> <!-- 配置事务的传播特性 --> <aop:config proxy-target-class="true"> <!-- 配置一个切入点,匹配dao包下 所有以Impl结尾的类的所有方法的执行 --> <aop:advisor pointcut="execution(* com.lyn.job.company.service.impl.UpCompanyMatchManagerServiceImpl.*(..))" advice-ref="txAdvice" /> <!-- 指定在txAdvice切入点应用txAdvice事务切面 --> </aop:config> <tx:advice id="txAdvice"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="query*" read-only="true" /> <tx:method name="find*" read-only="true"/> <tx:method name="get*" read-only="true"/> <tx:method name="execute*" propagation="REQUIRED"/> <tx:method name="*" propagation="REQUIRED"/> </tx:attributes> </tx:advice> 注:此配置事物直接指定到了定时器的service层,但是定时任务执行一段时间后程序报如下错误: 2012-07-30 09:51:19,716 ERROR [org.quartz.core.ErrorLogger] - [Job (DEFAULT.upCompanyMatchJobDetail threw an exception.] org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection] at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:534) Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:596) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371) at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:354) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:103) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625) at com.lyn.job.company.service.impl.UpCompanyMatchManagerServiceImpl$$EnhancerByCGLIB$$a5f981c9.match(<generated>) at com.lyn.job.company.UpCompanyMatchJob.execute(UpCompanyMatchJob.java:20) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ... 1 more Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142) at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85) at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1354) at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:555) ... 11 more Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database! at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) ... 16 more Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source. at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557) at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525) ... 19 more 急求指点,万分感谢!

启动服务器如下错误求助求助

启动服务器报错。idea中使用的maven ``` org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer#0' defined in class path resource [spring/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/ibatis/session/SqlSessionFactory at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:116) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4900) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5363) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:755) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:731) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1730) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:484) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:433) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NoClassDefFoundError: org/apache/ibatis/session/SqlSessionFactory at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetPublicMethods(Class.java:2902) at java.lang.Class.getMethods(Class.java:1615) ``` 配置文件 ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" 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-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd"> <!-- 数据库连接池 --> <!-- 加载配置文件 --> <context:property-placeholder location="classpath:properties/*.properties" /> <!-- 数据库连接池 --> <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close"> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="driverClassName" value="${jdbc.driver}" /> <property name="maxActive" value="10" /> <property name="minIdle" value="5" /> </bean> <!-- 让spring管理sqlsessionfactory 使用mybatis和spring整合包中的 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <!-- 数据库连接池 --> <property name="dataSource" ref="dataSource" /> <!-- 加载mybatis的全局配置文件 --> <property name="configLocation" value="classpath:mybatis/SqlMapConfig.xml" /> </bean> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.taotao.mapper" /> </bean> <!--service层--> <!-- 包扫描器,扫描带@Service注解的类 --> <context:component-scan base-package="com.taotao.service"/> <!--事务层--> <!-- 事务管理器 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <!-- 数据源 --> <property name="dataSource" ref="dataSource" /> </bean> <!-- 通知 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <!-- 传播行为 --> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="insert*" propagation="REQUIRED" /> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="create*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="find*" propagation="SUPPORTS" read-only="true" /> <tx:method name="select*" propagation="SUPPORTS" read-only="true" /> <tx:method name="get*" propagation="SUPPORTS" read-only="true" /> </tx:attributes> </tx:advice> <!-- 切面 --> <aop:config> <aop:advisor advice-ref="txAdvice" pointcut="execution(* com.taotao.service.*.*(..))" /> </aop:config> </beans> ```

spring与quartz 整合报错

<p>帮忙看看这个是什么问题,谢谢</p> <pre name="code" class="java">public class MyTaskService { public void run(){ System.out.println("任务开始了!"); } } </pre> <p> </p> <p>applicationContext.xml:</p> <pre name="code" class="java">&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;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:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd 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/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"&gt; &lt;!--dataSource数据源--&gt; &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"&gt; &lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/&gt; &lt;property name="url" value="jdbc:oracle:thin:@192.168.0.201:1521:osap"/&gt; &lt;property name="username" value="webadmin"/&gt; &lt;property name="password" value="123456"/&gt; &lt;/bean&gt; &lt;!--配置sessin工厂--&gt; &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt; &lt;property name="dataSource"&gt; &lt;ref local="dataSource" /&gt; &lt;/property&gt; &lt;property name="hibernateProperties"&gt; &lt;props&gt; &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.Oracle9Dialect&lt;/prop&gt; &lt;!-- 设置二级缓冲 --&gt; &lt;prop key="hibernate.cache.provider_class"&gt; org.hibernate.cache.EhCacheProvider &lt;/prop&gt; &lt;!-- 设置二级缓冲,打开查询缓冲 --&gt; &lt;prop key="hibernate.cache.use_query_cache"&gt;true&lt;/prop&gt; &lt;!-- 设置显示Hibernate操作的SQL语句 --&gt; &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; &lt;property name="mappingDirectoryLocations"&gt; &lt;list&gt; &lt;value&gt; classpath:/com/solex/sysmanage/model/config &lt;/value&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; &lt;!--给DAO注入sessionFactory--&gt; &lt;bean id="dao" class="com.solex.sysmanage.dao.impl.BaseDaoImpl"&gt; &lt;property name="sessionFactory"&gt; &lt;ref local="sessionFactory"/&gt; &lt;/property&gt; &lt;/bean&gt; &lt;!--基础的服务类--&gt; &lt;bean id="baseDao" class="com.solex.sysmanage.service.impl.BaseServiceImpl"&gt; &lt;property name="baseDao"&gt; &lt;ref local="dao"/&gt; &lt;/property&gt; &lt;/bean&gt; &lt;!--自定义服务类--&gt; &lt;bean id="manageService" class="com.solex.sysmanage.service.impl.ManageServiceImpl"&gt; &lt;property name="baseDao"&gt; &lt;ref local="dao" /&gt; &lt;/property&gt; &lt;/bean&gt; &lt;!--给interceptor注入事务--&gt; &lt;bean id="interceptor" class="com.solex.sysmanage.web.LoginInterceptor"&gt; &lt;property name="manageService"&gt; &lt;ref local="manageService" /&gt; &lt;/property&gt; &lt;/bean&gt; &lt;!-- 配置事务管理器 --&gt; &lt;bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt; &lt;property name="sessionFactory"&gt; &lt;ref local="sessionFactory"/&gt; &lt;/property&gt; &lt;/bean&gt; &lt;!--监听器的test--&gt; &lt;bean id="myTask" class="com.solex.sysmanage.service.impl.MyTaskService"&gt; &lt;/bean&gt; &lt;bean id="scheduledReportJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"&gt; &lt;property name="targetObject"&gt; &lt;ref bean="myTask" /&gt; &lt;/property&gt; &lt;property name="targetMethod"&gt; &lt;value&gt;run&lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="cronReportTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"&gt; &lt;property name="jobDetail"&gt; &lt;ref bean="scheduledReportJobDetail" /&gt; &lt;/property&gt; &lt;property name="cronExpression"&gt; &lt;value&gt;0 * * * *&lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt; &lt;property name="triggers"&gt; &lt;list&gt; &lt;ref bean="cronReportTrigger" /&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; &lt;!-- 配置事务特性 ,配置add、delete和update开始的方法,事务传播特性为required--&gt; &lt;tx:advice id="txAdvice" transaction-manager="transactionManager"&gt; &lt;tx:attributes&gt; &lt;tx:method name="insert*" propagation="REQUIRED"/&gt; &lt;tx:method name="save*" propagation="REQUIRED"/&gt; &lt;tx:method name="delete*" propagation="REQUIRED"/&gt; &lt;tx:method name="update*" propagation="REQUIRED"/&gt; &lt;tx:method name="*" read-only="true"/&gt; &lt;/tx:attributes&gt; &lt;/tx:advice&gt; &lt;!-- 配置那些类的方法进行事务管理,当前cn.com.jobedu.oa.service包中的子包、类中所有方法需要,还需要参考tx:advice的设置 --&gt; &lt;aop:config&gt; &lt;aop:pointcut id="allManagerMethod" expression="execution (* com.solex.sysmanage.service.*.*(..))"/&gt; &lt;aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod"/&gt; &lt;/aop:config&gt; &lt;/beans&gt;</pre> <p>   </p> <p> </p> <p> </p> <p>报告代码:</p> <pre name="code" class="java">org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cronReportTrigger' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'cronExpression' threw exception; nested exception is java.text.ParseException: Unexpected end of expression. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1277) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470) 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:220) 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:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) 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.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) 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.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'cronExpression' threw exception; nested exception is java.text.ParseException: Unexpected end of expression. at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:104) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1274) ... 40 more</pre> <p> </p>

SSHpersistence.xml和beans.xml配置遇到错误求救

配置文件persistence.xml <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> <persistence-unit name="Gloomy" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /> <property name="hibernate.max_fetch_depth" value="3" /> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.jdbc.fetch_size" value="18" /> <property name="hibernate.jdbc.batch_size" value="10" /> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.format_sql" value="true" /> </properties> </persistence-unit> </persistence> 配置文件bean.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.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <aop:aspectj-autoproxy /> <context:annotation-config></context:annotation-config> <context:component-scan base-package="com.gloomy" /> <!-- 加载数据库属性配置文件 --> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>classpath:jdbc.properties</value> </property> </bean> <!-- 配置数据源 --> <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp2.BasicDataSource"> <property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> </bean> <!-- session工厂 --> <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"></property> <!-- 自动扫描注解方式配置的hibernate类文件 --> <property name="packagesToScan"> <list> <value>com.gloomy.model</value> </list> </property> </bean> <!-- 配置实体管理工厂 --> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource" /> <!-- <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" /> --> <property name="persistenceUnitName" value="Gloomy" /> <property name="loadTimeWeaver"> <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" /> </property> </bean> <!-- 配置事务管理 --> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean> <!-- 配置事务通知属性 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <!-- 定义事务传播属性 --> <tx:attributes> <tx:method name="insert*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="edit*" propagation="REQUIRED" /> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="new*" propagation="REQUIRED" /> <tx:method name="set*" propagation="REQUIRED" /> <tx:method name="remove*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="change*" propagation="REQUIRED" /> <tx:method name="get*" propagation="REQUIRED" read-only="true" /> <tx:method name="find*" propagation="REQUIRED" read-only="true" /> <tx:method name="load*" propagation="REQUIRED" read-only="true" /> <tx:method name="*" propagation="REQUIRED" read-only="true" /> </tx:attributes> </tx:advice> <!-- 配置事务切面 --> <aop:config> <aop:pointcut id="serviceOperation" expression="execution(* com.bufoon.service.*.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperation" /> </aop:config> </beans> 报错信息: 警告: Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: Gloomy] Unable to build Hibernate SessionFactory Caused by: javax.persistence.PersistenceException: [PersistenceUnit: Gloomy] Unable to build Hibernate SessionFactory Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Unable to execute schema management to JDBC target [alter table tb_order add constraint FKt9x5bn0a6216tfqg5udhfyhn4 foreign key (productno) references tb_producttype (producttypename)] Caused by: java.sql.SQLException: Cannot add foreign key constraint

ssm框架连接配置applicationContext.xml运行时报错

**严重: 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 'org.mybatis.spring.mapper.MapperScannerConfigurer#0' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/ibatis/session/SqlSessionFactory** at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:116) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:609) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5189) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1107) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1841) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:844) **Caused by: java.lang.NoClassDefFoundError: org/apache/ibatis/session/SqlSessionFactory** at java.base/java.lang.Class.getDeclaredMethods0(Native Method) at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3119) at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3144) at java.base/java.lang.Class.getMethods(Class.java:1863) at org.springframework.beans.ExtendedBeanInfoFactory.supports(ExtendedBeanInfoFactory.java:54) at org.springframework.beans.ExtendedBeanInfoFactory.getBeanInfo(ExtendedBeanInfoFactory.java:46) at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:275) at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:188) at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:327) at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorInternal(BeanWrapperImpl.java:359) at org.springframework.beans.BeanWrapperImpl.isWritableProperty(BeanWrapperImpl.java:438) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1458) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1197) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) ... 24 more **Caused by: java.lang.ClassNotFoundException: org.apache.ibatis.session.SqlSessionFactory** at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119) ... 38 more db.properties文件,mysql8.0 ``` jdbc_username=root jdbc_password=aaa jdbc_driver=com.mysql.cj.jdbc.Driver jdbc_url=jdbc\:mysql\://localhost\:3306/aaaaa_db?useSSL\=false&serverTimezone\=GMT ``` 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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation= "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.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"> <!-- 配置扫描包 --> <context:component-scan base-package="com.ls.dao"/> <context:component-scan base-package="com.ls.service"/> <!-- 数据库连接相关配置 --> <!-- 加载配置文件 --> <context:property-placeholder location="classpath:conf/db.properties" /> <!-- 数据库连接池 --> <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close"> <property name="url" value="${jdbc_url}" /> <property name="username" value="${jdbc_username}" /> <property name="password" value="${jdbc_password}" /> <property name="driverClassName" value="${jdbc_driver}" /> <property name="maxActive" value="10" /> <property name="minIdle" value="5" /> </bean> <!-- 配置mybatis的sqlSessionFactory --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <!-- 配置自动扫描mapper.xml文件 --> <property name="mapperLocations" value="classpath:com/ls/mapper/*.xml"/> <!-- mybatis的配置文件 --> <property name="configLocation" value="classpath:mybatis-config.xml"/> </bean> <!-- Dao接口所在包名,Spring会自动查找其下的类 --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.ls.dao"/> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> </bean> <!-- 配置事务管理器 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> <!-- 配置事务管理器管理哪些方法 --> <!-- 配置事务通知属性 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <!-- 定义事务传播属性 --> <tx:attributes> <tx:method name="insert*" propagation="REQUIRED" /> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="upd*" propagation="REQUIRED" /> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="query*" propagation="REQUIRED" read-only="true" /> <tx:method name="get*" propagation="REQUIRED" read-only="true" /> <tx:method name="find*" propagation="REQUIRED" read-only="true" /> <tx:method name="*" propagation="REQUIRED" read-only="true" /> </tx:attributes> </tx:advice> <!-- 配置具体那些包下面的那些类下面的那些方法进行事务管理器 --> <aop:config> <aop:pointcut id="servicePoint" expression="execution(* com.service.*.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="servicePoint"/> </aop:config> </beans> ```

s2sh整合问题,弄了一天了都没弄出来,拜托大家了!

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from file [C:\Program Files\apache-tomcat-6.0.28\webapps\System\WEB-INF\classes\applicationContext.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:785) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445) at org.apache.catalina.core.StandardService.start(StandardService.java:519) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:581) 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:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Caused by: java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2722) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1124) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at org.springframework.transaction.config.TxAdviceBeanDefinitionParser.getBeanClass(TxAdviceBeanDefinitionParser.java:69) at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:66) at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59) at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1335) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) ... 37 more Caused by: java.lang.ClassNotFoundException: org.aopalliance.intercept.MethodInterceptor at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 55 more 配置文件代码:web.xml [code="java"]<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <!-- 开始监听 --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- 配置spring监听器 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:*Context.xml</param-value> </context-param> <filter> <filter-name>openSessionInView</filter-name> <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> <init-param> <param-name>sessionFactoryBeanName</param-name> <param-value>sessionFactory</param-value> </init-param> </filter> <filter-mapping> <filter-name>openSessionInView</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- <filter> <filter-name>lazyLoadingFilter</filter-name> <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> <init-param> <param-name>singleSession</param-name> <param-value>false</param-value> </init-param> </filter> <filter-mapping> <filter-name>lazyLoadingFilter</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> --> <!-- 配置OpenSessionInViewFilter,必须在struts,用来解决could not initialize proxy-no Session报错问题,配置自己写的filter --> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- <listener> <listener-class>com.hyit.ttmsoge.listener.FactoryLoaderListener</listener-class> </listener> --> <welcome-file-list> <welcome-file>Login.html</welcome-file> </welcome-file-list> </web-app> [/code] applicationContext: [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: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/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"> </property> <property name="url" value="jdbc:mysql://localhost:8080/ttmsoge"> </property> <property name="username" value="root"></property> <property name="password" value="0429"></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> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> </props> </property> <property name="mappingResources"> <list> <value>com/hyit/ttmsoge/model/Register.hbm.xml</value> <value>com/hyit/ttmsoge/model/User.hbm.xml</value> </list> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 配置Advice(事务的传播特性) --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="del*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="get*" propagation="SUPPORTS" read-only="true" /> <tx:method name="search*" propagation="SUPPORTS" read-only="true" /> </tx:attributes> </tx:advice> </beans> [/code]

ssh框架,连接SQLServer2000 出错

<div class="iteye-blog-content-contain" style="font-size: 14px;"> <p>spring管理hibernate4,连接SQLServer2000时,提示<br>Transaction not successfully started</p> <p> </p> <pre name="code" class="java">Messages: Transaction not successfully started Could not commit Hibernate transaction; nested exception is org.hibernate.TransactionException: Transaction not successfully started File: org/hibernate/engine/transaction/spi/AbstractTransactionImpl.java Line number: 170 Stacktraces org.springframework.transaction.TransactionSystemException: Could not commit Hibernate transaction; nested exception is org.hibernate.TransactionException: Transaction not successfully started org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:472) org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754) org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:392) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) $Proxy16.createQuery(Unknown Source) cn.com.service.impl.BaseService.createQuery(BaseService.java:55) cn.com.action.NewsAction.getNews1OneNewsTop30(NewsAction.java:123) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852) java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) java.lang.Thread.run(Unknown Source) org.hibernate.TransactionException: Transaction not successfully started org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:170) org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:468) org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754) org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:392) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) $Proxy16.createQuery(Unknown Source) cn.com.service.impl.BaseService.createQuery(BaseService.java:55) cn.com.action.NewsAction.getNews1OneNewsTop30(NewsAction.java:123) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852) java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) java.lang.Thread.run(Unknown Source)</pre> <p> </p> <p>配置文件</p> <pre name="code" class="xml">&lt;!-- 配置SessionFactory,由Spring容器来管理Hibernate --&gt; &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;!-- 配置自动扫描包下的实体,也可使用annotatedClasses属性进行单个实体配置 --&gt; &lt;property name="packagesToScan" value="cn.com.entity"&gt;&lt;/property&gt; &lt;!-- 配置Hibernate属性 --&gt; &lt;property name="hibernateProperties"&gt; &lt;props&gt; &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.SQLServerDialect&lt;/prop&gt; &lt;!-- &lt;prop key="hibernate.current_session_context_class"&gt;thread&lt;/prop&gt; --&gt; &lt;!-- &lt;prop key="hibernate.hbm2ddl.auto"&gt;update&lt;/prop&gt; --&gt; &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt; &lt;prop key="hibernate.query.substitutions"&gt;true 1, false 0, yes 'Y', no 'N'&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; &lt;!-- &lt;property name="configLocation"&gt; &lt;value&gt;classpath:hibernate.cfg.xml&lt;/value&gt; &lt;/property&gt; --&gt; &lt;/bean&gt; &lt;!-- 配置事务管理器 --&gt; &lt;bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt; &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt; &lt;/bean&gt; &lt;!-- 加载事务管理器 &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt; --&gt; &lt;!-- 配置事务的传播特性 --&gt; &lt;tx:advice id="txAdvice" transaction-manager="transactionManager"&gt; &lt;tx:attributes&gt; &lt;tx:method name="save*" propagation="REQUIRED" /&gt; &lt;tx:method name="update*" propagation="REQUIRED" /&gt; &lt;tx:method name="delete*" propagation="REQUIRED" /&gt; &lt;tx:method name="*" read-only="true" /&gt; &lt;/tx:attributes&gt; &lt;/tx:advice&gt; &lt;!-- 配置参与事务的类或方法 --&gt; &lt;aop:config&gt; &lt;aop:pointcut id="allServiceMethod" expression="execution(* cn.com.dao.*.*.*(..))" /&gt; &lt;aop:advisor pointcut-ref="allServiceMethod" advice-ref="txAdvice" /&gt; &lt;/aop:config&gt; </pre> <p> </p> <p>basedao</p> <pre name="code" class="java">@SuppressWarnings("unchecked") public List&lt;T&gt; createQuery(Class&lt;T&gt; clazz, String hql) { Session session = getSession(); List&lt;T&gt; list = new ArrayList&lt;T&gt;(); try { // session.beginTransaction(); list = session.createQuery(" from " + clazz.getName() + " " + hql) .list(); // session.getTransaction().commit(); } catch (HibernateException e) { e.printStackTrace(); if (session != null) session.getTransaction().rollback(); return null; } return list; }</pre> <p> </p> <p> </p> </div>

启动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> ```

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

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

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

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

点沙成金:英特尔芯片制造全过程揭密

“亚马逊丛林里的蝴蝶扇动几下翅膀就可能引起两周后美国德州的一次飓风……” 这句人人皆知的话最初用来描述非线性系统中微小参数的变化所引起的系统极大变化。 而在更长的时间尺度内,我们所生活的这个世界就是这样一个异常复杂的非线性系统…… 水泥、穹顶、透视——关于时间与技艺的蝴蝶效应 公元前3000年,古埃及人将尼罗河中挖出的泥浆与纳特龙盐湖中的矿物盐混合,再掺入煅烧石灰石制成的石灰,由此得来了人...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

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

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

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

一文带你入门Java Stream流,太强了

两个星期以前,就有读者强烈要求我写一篇 Java Stream 流的文章,我说市面上不是已经有很多了吗,结果你猜他怎么说:“就想看你写的啊!”你看你看,多么苍白的喜欢啊。那就“勉为其难”写一篇吧,嘻嘻。 单从“Stream”这个单词上来看,它似乎和 java.io 包下的 InputStream 和 OutputStream 有些关系。实际上呢,没毛关系。Java 8 新增的 Stream 是为...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

立即提问
相关内容推荐