junit测试报错,求大神救命,控制台输出如下,

0 2015-07-09 09:04:52,182 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - #org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:316)# - Loading XML bean definitions from URL [file:WebRoot/WEB-INF/spring/applicationContext.xml]
695 2015-07-09 09:04:52,877 [main] INFO com.alibaba.dubbo.common.logger.LoggerFactory - ## - using logger: com.alibaba.dubbo.common.logger.log4j.Log4jLoggerAdapter
701 2015-07-09 09:04:52,883 [main] ERROR com.alibaba.dubbo.common.Version - #com.alibaba.dubbo.common.Version.checkDuplicate(Version.java:144)# - [DUBBO] Duplicate class com/alibaba/dubbo/common/Version.class in 3 jar [file:/D:/guyatong/shopworkspace/jpa-demo/WebRoot/WEB-INF/lib/dubbo-2.8.4.jar!/com/alibaba/dubbo/common/Version.class, file:/D:/guyatong/shopworkspace/jpa-demo/WebRoot/WEB-INF/lib/original-dubbo-2.8.4.jar!/com/alibaba/dubbo/common/Version.class, file:/D:/guyatong/shopworkspace/jpa-demo/WebRoot/WEB-INF/lib/dubbo-2.8.4-shaded.jar!/com/alibaba/dubbo/common/Version.class], dubbo version: 2.8.4, current host: 127.0.0.1
702 2015-07-09 09:04:52,884 [main] ERROR com.alibaba.dubbo.common.Version - #com.alibaba.dubbo.common.Version.checkDuplicate(Version.java:144)# - [DUBBO] Duplicate class com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandler.class in 3 jar [file:/D:/guyatong/shopworkspace/jpa-demo/WebRoot/WEB-INF/lib/dubbo-2.8.4-shaded.jar!/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandler.class, file:/D:/guyatong/shopworkspace/jpa-demo/WebRoot/WEB-INF/lib/original-dubbo-2.8.4.jar!/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandler.class, file:/D:/guyatong/shopworkspace/jpa-demo/WebRoot/WEB-INF/lib/dubbo-2.8.4.jar!/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandler.class], dubbo version: 2.8.4, current host: 127.0.0.1
747 2015-07-09 09:04:52,929 [main] INFO org.springframework.context.support.GenericApplicationContext - #org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:513)# - Refreshing org.springframework.context.support.GenericApplicationContext@cde55ec: startup date [Thu Jul 09 09:04:52 CST 2015]; root of context hierarchy
1043 2015-07-09 09:04:53,225 [main] INFO org.springframework.orm.jpa.LocalEntityManagerFactoryBean - #org.springframework.orm.jpa.LocalEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalEntityManagerFactoryBean.java:79)# - Building JPA EntityManagerFactory for persistence unit 'jpa-demo'
[EL Info]: 2015-07-09 09:04:54.475--ServerSession(335828946)--EclipseLink, version: Eclipse Persistence Services - 2.5.0.v20130507-3faac2b
[EL Severe]: ejb: 2015-07-09 09:04:56.582--ServerSession(335828946)--Exception EclipseLink-4002: org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Error Code: 0
4576 2015-07-09 09:04:56,758 [main] ERROR org.springframework.test.context.TestContextManager - #org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:334)# - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@6fcbba0c] to prepare test instance [test.TestUser@2823a32b]
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:101)
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:331)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:213)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:290)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:292)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:233)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:87)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:176)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

4个回答

好像是类冲突,有重复的类引起的。一个DubboNamespaceHandler.class文件存在于多jar中。

Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.//这句话是说连接你本机的5432端口被拒绝,然后让你检查主机名和端口是否正确。

ERROR com.alibaba.dubbo.common.Version - #com.alibaba.dubbo.common.Version.checkDuplicate(Version.java:144)# - [DUBBO] Duplicate class com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandler.class in 3 jar [file:/D:/guyatong/shopworkspace/jpa-demo/WebRoot/WEB-INF/lib/dubbo-2.8.4-shaded.jar!/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandler.class, file:/D:/guyatong/shopworkspace/jpa-demo/WebRoot/WEB-INF/lib/original-dubbo-2.8.4.jar!/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandler.class, file:/D:/guyatong/shopworkspace/jpa-demo/WebRoot/WEB-INF/lib/dubbo-2.8.4.jar!/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandler.class], dubbo version: 2.8.4, current host: 127.0.0.1

从下网上看 [main] ERROR org.springframework.test.context.TestContextManager /applicationContext.xml文件

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问