2014-03-06 60 views
1

我們有一個tomcat與春天web應用程序。 我們有很多junit測試。Junit測試在服務器啓動時帶來奇怪的錯誤(logger.DEBUG)

當我們設置記錄器值設置爲「DEBUG」我們得到噸以下錯誤:

06 Mar 2014 12:16:39 TRACE ClassPathScanningCandidateComponentProvider - Scanning file [D:\workspaceNG\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\NG\WEB- INF\classes\com\xxx\testing\BaseRollbackTest.class] 
06 Mar 2014 12:16:39 DEBUG AnnotationAttributesReadingVisitor - Failed to classload type while reading annotation metadata. This is a non-fatal error, but certain annotation metadata may be unavailable. 
java.lang.ClassNotFoundException: org.junit.After 
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702) 
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) 
at org.springframework.core.type.classreading.RecursiveAnnotationAttributesVisitor.visitEnd(AnnotationAttributesReadingVisitor.java:171) 
at org.springframework.asm.ClassReader.a(Unknown Source) 
at org.springframework.asm.ClassReader.accept(Unknown Source) 
at org.springframework.asm.ClassReader.accept(Unknown Source) 
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:64) 
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80) 
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102) 
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:266) 
at org.springframework.data.repository.config.RepositoryBeanDefinitionBuilder.detectCustomImplementation(RepositoryBeanDefinitionBuilder.java:154) 
at org.springframework.data.repository.config.RepositoryBeanDefinitionBuilder.registerCustomImplementation(RepositoryBeanDefinitionBuilder.java:116) 
at org.springframework.data.repository.config.RepositoryBeanDefinitionBuilder.build(RepositoryBeanDefinitionBuilder.java:97) 
at org.springframework.data.repository.config.RepositoryBeanDefinitionParser.registerGenericRepositoryFactoryBean(RepositoryBeanDefinitionParser.java:101) 
at org.springframework.data.repository.config.RepositoryBeanDefinitionParser.parse(RepositoryBeanDefinitionParser.java:71) 
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73) 
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438) 
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428) 
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:195) 
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139) 
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108) 
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) 
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) 
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.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:266) 
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:207) 
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:192) 
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139) 
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108) 
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) 
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) 
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:174) 
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) 
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) 
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) 
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) 
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) 
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537) 
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451) 
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) 
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) 
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) 
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) 
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) 
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 
at java.util.concurrent.FutureTask.run(Unknown Source) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
at java.lang.Thread.run(Unknown Source) 

任何想法,爲什麼?

回答

0

堆棧跟蹤了一切:

java.lang.ClassNotFoundException: org.junit.After 

的JUnit或JUnit的正確版本是不是在classpath。

+0

是什麼奇怪的,我認爲JUnit測試工作正常 – Urbanleg

+0

是否有任何其他JUnit測試後使用? –

+0

其中大部分仍然運行完好 – Urbanleg

2

它只是發生在我身上。

在我來說,我是從TestNG的swithching JUnit的(唉)我的所有項目的測試類

遷移時他們,我一直保持一些Java TestNG的文件,逐一下JUnit的,但他們沒有編譯任何更多的(我已經刪除了maven依賴項)。

(AnnotationAttributesReadingVisitor.java:184).visitEnd() - Failed to class-load type while reading annotation metadata. etc 
java.lang.ClassNotFoundException: BeforeClass 

下月食「MAVEN」去掉最後TestNG的文件 也乾淨後 - >「更新項目...它消失

雖然這並不能說明你的情況下,方案可能帶來你點燃!

你必須使用JUnit地方缺少正確的Junit的jar編譯陳舊的測試類...