日期:2014-05-19  浏览次数:20636 次

MyBatis + Spring测试DAO出错
2012-08-05 21:26:54 [日志信息] @TestExecutionListeners is not present for class [class com.luqin.dao.impl.UserDAOImplTest]: using defaults.
2012-08-05 21:26:54 [日志信息] Loading XML bean definitions from class path resource [applicationContext.xml]
2012-08-05 21:26:54 [日志信息] Refreshing org.springframework.context.support.GenericApplicationContext@b25b9d: startup date [Sun Aug 05 21:26:54 CST 2012]; root of context hierarchy
2012-08-05 21:26:54 [日志信息] Loading properties file from class path resource [db.properties]
2012-08-05 21:26:54 [日志信息] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@cf829d: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,userDAOImpl,propertyConfigurer,dataSource,sqlSessionFactory,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor]; root of factory hierarchy
2012-08-05 21:26:55 [日志信息] MLog clients using log4j logging.
2012-08-05 21:26:55 [日志信息] Initializing c3p0-0.9.1.1 [built 15-March-2007 01:32:31; debug? true; trace: 10]
2012-08-05 21:26:55 [日志信息] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@cf829d: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,userDAOImpl,propertyConfigurer,dataSource,sqlSessionFactory,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor]; root of factory hierarchy
2012-08-05 21:26:55 [日志信息] Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@ec898a] to prepare test instance [com.luqin.dao.impl.UserDAOImplTest@13a0212]
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:333)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303)
at org.springframewor