项目使用maven 构建,并且使用集成测试(integration-test)。
在命令行中运行mvn clean deploy tomcat:undeploy时,报错:
------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.tdr.test.IntegrationTest This is integration-test $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ log4j:WARN Error during default initialization java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source) at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180) at org.apache.log4j.xml.DOMConfigurator$2.parse(DOMConfigurator.java:690) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:789) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:696) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:471) at org.apache.log4j.LogManager.<clinit>(LogManager.java:125) at org.apache.log4j.Logger.getLogger(Logger.java:105) at org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:289) at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:109) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.apache.commons.logging.impl.LogFactoryImpl.createLogFromClass(LogFactoryImpl.java:1116) at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:914) at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:604) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:336) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:310) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685) at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.<init>(ThreadSafeClientConnManager.java:136) at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.<init>(ThreadSafeClientConnManager.java:115) at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.<init>(ThreadSafeClientConnManager.java:94) at org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(HttpClientFactory.java:61) at org.openqa.selenium.remote.internal.HttpClientFactory.<init>(HttpClientFactory.java:48) at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:100) at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:81) at org.openqa.selenium.remote.service.DriverCommandExecutor.<init>(DriverCommandExecutor.java:46) at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:182) at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:174) at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:147) at com.tdr.test.IntegrationTest.test01(IntegrationTest.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) 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.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 75 more Started InternetExplorerDriver server (32-bit)
解决方法:
在项目的pom中增加:
<dependency> <groupId>xml-apis</groupId> <artifactId>xml-apis</artifactId> <version>1.4.01</version> </dependency>
详情请参阅
相关推荐
该jar包解决报错java.lang.NoClassDefFoundError: org/apache/james/mime4j/MimeException,亲测可用。
java.lang.NoClassDefFoundError: de/javakaffee/kryoserializers/CurrencySerializer
java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport异常处理
JavaMail的java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream错误 原因: MyEclipse6.5的javaee.jar中的mail包与JavaMail包有冲突。 解决: 在MyEclipse目录下(D:\Program Files\MyEclipse ...
Java编程中的`java.lang.NoClassDefFoundError: org/jboss/logging/`是一个常见的运行时错误,通常发生在尝试执行一个类时,JVM无法找到在编译时已经存在的类定义。这个错误并不意味着类在编译期间不存在,而是表明...
标题 "java.lang.NoClassDefFoundError: javax/persistence/EntityListener" 提到的问题是一个常见的Java运行时异常,通常表示在类加载时找不到指定的类定义。这个错误在Java应用程序或Web应用中出现,可能是因为...
在Java开发过程中,我们经常会遇到`java.lang.NoClassDefFoundError`这个异常,尤其是在进行JDK版本升级时。这个错误通常表示在运行时找不到某个类的定义,即使编译时该类是可用的。在本例中,问题发生在从一个较低...
NULL 博文链接:https://jaychang.iteye.com/blog/980159
在Java编程中,`java.lang.NoClassDefFoundError` 是一个常见的运行时异常,它发生在类加载器尝试加载一个在编译时存在但在运行时找不到的类定义时。这个错误通常意味着类路径设置不正确或者依赖项没有正确地被包含...
标题中的“JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决”指的是一类常见的Java运行时错误,当尝试加载一个类时,如果Java虚拟机(JVM)找不到该类的定义,就会抛出`...
在Java编程中,`java.lang.NoClassDefFoundError` 是一个常见的运行时错误,它发生在类加载器尝试执行一个类,但在类路径中找不到该类的定义时。在这个特定的场景中,问题聚焦于 `net.sf.ezmorph.Morpher` 类。`...
jdk升级jdk10后,原本jdk自带的 webservice一些包确实,引起的一系列错误解决方案
jackson-annotations-2.10.2.jar jackson-core-2.10.2.jar jackson-databind-2.10.2.jar NoClassDefFoundError解决
在plugins org.eclipse.ui.workbench_3.3.1.M20070921-1200.jar下 打到org/eclipse/ui/internal/util/SWTResourceUtil.class 用winrar打开,同时也打开3.4的org.eclipse.ui.workbench_3.4.0.I20080606-1300.jar ...
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/api/client/config/ClientConfig at org.apache.hadoop.yarn.client.api.TimelineClient.createTimelineClient(TimelineClient.java:...
NoClassDefFoundError: org/slf4j/LoggerFactory解决方案,需要添加的三个jar包都在,slf4j-api-1.5.2,slf4j-log4j12-1.5.2,log4j-1.2.12
flink-hadoop-compatibility_2.12-1.7.1.jar javax.ws.rs-api-2.0.1.jar jersey-common-2.27.jar ...Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/api/client/config/ClientConfig
标题中的“java.lang.NoClassDefFoundError: javax/tools/StandardJavaFile”是一个常见的Java运行时错误,它表示在类路径中找不到某个类的定义。这个错误通常发生在试图执行包含特定类的代码,但该类在运行时环境中...
java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory 要在java里使用json用到的jar包怎么导入...