运行 JUnit报错

来源:2-7 验证Dao

321121254

2017-10-27

http://img.mukewang.com/szimg/59f312680001176013310598.jpg

十月 27, 2017 7:00:49 下午 org.springframework.test.context.support.DefaultTestContextBootstrapper getDefaultTestExecutionListenerClassNames

信息: Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]

十月 27, 2017 7:00:49 下午 org.springframework.test.context.support.DefaultTestContextBootstrapper getTestExecutionListeners

信息: Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@6b143ee9, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@1936f0f5, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@6615435c, org.springframework.test.context.support.DirtiesContextTestExecutionListener@4909b8da, org.springframework.test.context.transaction.TransactionalTestExecutionListener@3a03464, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@2d3fcdbd]

十月 27, 2017 7:00:49 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

信息: Loading XML bean definitions from class path resource [spring/spring-dao.xml]

十月 27, 2017 7:00:50 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

信息: Loading XML bean definitions from class path resource [spring/spring-service.xml]

十月 27, 2017 7:00:50 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

信息: Loading XML bean definitions from class path resource [spring/spring-redis.xml]

十月 27, 2017 7:00:50 下午 org.springframework.context.support.GenericApplicationContext prepareRefresh

信息: Refreshing org.springframework.context.support.GenericApplicationContext@7823a2f9: startup date [Fri Oct 27 19:00:50 CST 2017]; root of context hierarchy

十月 27, 2017 7:00:50 下午 org.mybatis.spring.mapper.ClassPathMapperScanner checkCandidate

警告: Skipping MapperFactoryBean with name 'areaDao' and 'com.imooc.o2o.dao.AreaDao' mapperInterface. Bean already defined with the same name!

十月 27, 2017 7:00:50 下午 org.mybatis.spring.mapper.ClassPathMapperScanner doScan

警告: No MyBatis mapper was found in '[com.imooc.o2o.dao]' package. Please check your configuration.

十月 27, 2017 7:00:50 下午 org.mybatis.spring.mapper.ClassPathMapperScanner checkCandidate

警告: Skipping MapperFactoryBean with name 'areaDao' and 'com.imooc.o2o.dao.AreaDao' mapperInterface. Bean already defined with the same name!

十月 27, 2017 7:00:50 下午 org.mybatis.spring.mapper.ClassPathMapperScanner doScan

警告: No MyBatis mapper was found in '[com.imooc.o2o.dao]' package. Please check your configuration.

十月 27, 2017 7:00:50 下午 org.springframework.context.support.GenericApplicationContext refresh

警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.imooc.o2o.util.EncryptPropertyPlaceholderConfigurer] for bean with name 'com.imooc.o2o.util.EncryptPropertyPlaceholderConfigurer#0' defined in class path resource [spring/spring-dao.xml]; nested exception is java.lang.ClassNotFoundException: com.imooc.o2o.util.EncryptPropertyPlaceholderConfigurer

十月 27, 2017 7:00:50 下午 org.springframework.test.context.TestContextManager prepareTestInstance

严重: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@6615435c] to prepare test instance [com.imooc.o2o.dao.AreaDaoTest@7a52f2a2]

java.lang.IllegalStateException: Failed to load ApplicationContext

at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)

at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)

at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)

at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)

at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)

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:191)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.imooc.o2o.util.EncryptPropertyPlaceholderConfigurer] for bean with name 'com.imooc.o2o.util.EncryptPropertyPlaceholderConfigurer#0' defined in class path resource [spring/spring-dao.xml]; nested exception is java.lang.ClassNotFoundException: com.imooc.o2o.util.EncryptPropertyPlaceholderConfigurer

at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1385)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:641)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609)

at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484)

at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1007)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:741)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)

at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:128)

at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)

at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:108)

at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:251)

at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)

at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)

... 25 more

Caused by: java.lang.ClassNotFoundException: com.imooc.o2o.util.EncryptPropertyPlaceholderConfigurer

at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)

at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:401)

at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1432)

at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1377)

... 38 more


写回答

1回答

翔仔

2017-10-27

警告: Skipping MapperFactoryBean with name 'areaDao' and 'com.imooc.o2o.dao.AreaDao' mapperInterface. Bean already defined with the same name!
同学错误显示是AreaDao重名了,请好好检查下相关配置

0
14
321121254
回复
音策
加我,我刚加了群
2017-10-27
共14条回复

Java双版本(SSM到SpringBoot)校园商铺全栈开发

SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需

5113 学习 · 8144 问题

查看课程