ssh整合activiti5.14,部署到Tomcat启动时报错java.lang.ClassNotFoundException: org.junit.Test
在单元测试时引入了MyEclipse提供的Junit的jar包,但是部署到Tomcat启动时报错,具体报错信息如下:
1 2017-02-16 14:07:34,256 DEBUG [org.springframework.core.type.classreading.AnnotationAttributesReadingVisitor] - Failed to classload type while reading annotation metadata. This is a non-fatal error, but certain annotation metadata may be unavailable. 2 java.lang.ClassNotFoundException: org.junit.Test 3 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) 4 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) 5 at org.springframework.core.type.classreading.RecursiveAnnotationAttributesVisitor.visitEnd(AnnotationAttributesReadingVisitor.java:165) 6 at org.springframework.asm.ClassReader.a(Unknown Source) 7 at org.springframework.asm.ClassReader.accept(Unknown Source) 8 at org.springframework.asm.ClassReader.accept(Unknown Source) 9 at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:59) 10 at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80) 11 at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:101) 12 at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:257) 13 at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242) 14 at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84) 15 at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73) 16 at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1435) 17 at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1425) 18 at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184) 19 at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140) 20 at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111) 21 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) 22 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) 23 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) 24 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) 25 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) 26 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) 27 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) 28 at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) 29 at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) 30 at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131) 31 at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537) 32 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451) 33 at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647) 34 at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598) 35 at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661) 36 at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517) 37 at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458) 38 at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138) 39 at javax.servlet.GenericServlet.init(GenericServlet.java:212) 40 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173) 41 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993) 42 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4420) 43 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4733) 44 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799) 45 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779) 46 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601) 47 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079) 48 at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002) 49 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506) 50 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315) 51 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324) 52 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142) 53 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061) 54 at org.apache.catalina.core.StandardHost.start(StandardHost.java:840) 55 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) 56 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) 57 at org.apache.catalina.core.StandardService.start(StandardService.java:525) 58 at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) 59 at org.apache.catalina.startup.Catalina.start(Catalina.java:595) 60 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 61 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 62 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 63 at java.lang.reflect.Method.invoke(Method.java:606) 64 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) 65 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 66 2017-02-16 14:07:34,257 DEBUG [org.springframework.core.type.classreading.AnnotationAttributesReadingVisitor] - Failed to classload type while reading annotation metadata. This is a non-fatal error, but certain annotation metadata may be unavailable. 67 java.lang.ClassNotFoundException: org.junit.Test 68 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) 69 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) 70 at org.springframework.core.type.classreading.RecursiveAnnotationAttributesVisitor.visitEnd(AnnotationAttributesReadingVisitor.java:165) 71 at org.springframework.asm.ClassReader.a(Unknown Source)
后来下载了一个junit4.4.jar引入到项目中,启动就没有报错了。
本文出自wentaokyle,转载请标明出处!谢谢!