首页  |  知识库  |  资源下载  |  在线工具  |  A-Z  •  JAR  •  名词查         

解决"java.lang.ClassNotFoundException: nu.xom.Serializer..java.lang.NoClassDefFoundError: nu/xom/Serializer"等缺少xom包问题

标签:xom-1.0.jar,ClassNotFoundException,Serializer,NoClassDefFoundError     发布时间:2019-02-22   

一、问题描述

关于运行时报"java.lang.ClassNotFoundException: nu.xom.Serializer..java.lang.NoClassDefFoundError: nu/xom/Serializer"等异常问题,错误日志如下所示

java.lang.ClassNotFoundException: nu.xom.Serializer@b@	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)@b@	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)@b@	at com.xwood.gw.util.XmlJSONUtil.xml2json(XmlJSONUtil.java:18)@b@	at com.xwood.gw.processor.NexusProxyServiceApiXML2JSONProcessor.xml2json(NexusProxyServiceApiXML2JSONProcessor.java:117)@b@	at com.xwood.gw.processor.NexusProxyServiceApiXML2JSONProcessor.serviceProxyJump(NexusProxyServiceApiXML2JSONProcessor.java:81)@b@	at com.xwood.gw.processor.NexusProxyServiceApiXML2JSONProcessor.doProcess(NexusProxyServiceApiXML2JSONProcessor.java:105)@b@	at com.xwood.gw.processor.core.AbstractProcessor.process(AbstractProcessor.java:10)@b@	at com.xwood.gw.processor.core.ProcessorChain.process(ProcessorChain.java:22)@b@	at com.xwood.gw.filter.GateWayProcessorFilter.doFilter(GateWayProcessorFilter.java:58)@b@	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)@b@	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)@b@	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)@b@	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)@b@	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)@b@	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)@b@	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)@b@	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)@b@	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)@b@	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)@b@	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)@b@	at java.lang.Thread.run(Thread.java:662)
	HTTP Status 500 -@b@type Exception report@b@@b@message@b@@b@description The server encountered an internal error () that prevented it from fulfilling this request.@b@@b@exception@b@@b@javax.servlet.ServletException: Filter execution threw an exception@b@root cause@b@@b@java.lang.NoClassDefFoundError: nu/xom/Serializer@b@	com.xwood.gw.util.XmlJSONUtil.xml2json(XmlJSONUtil.java:18)@b@	com.xwood.gw.processor.NexusProxyServiceApiXML2JSONProcessor.xml2json(NexusProxyServiceApiXML2JSONProcessor.java:117)@b@	com.xwood.gw.processor.NexusProxyServiceApiXML2JSONProcessor.serviceProxyJump(NexusProxyServiceApiXML2JSONProcessor.java:81)@b@	com.xwood.gw.processor.NexusProxyServiceApiXML2JSONProcessor.doProcess(NexusProxyServiceApiXML2JSONProcessor.java:105)@b@	com.xwood.gw.processor.core.AbstractProcessor.process(AbstractProcessor.java:10)@b@	com.xwood.gw.processor.core.ProcessorChain.process(ProcessorChain.java:22)@b@	com.xwood.gw.filter.GateWayProcessorFilter.doFilter(GateWayProcessorFilter.java:58)@b@root cause@b@@b@java.lang.ClassNotFoundException: nu.xom.Serializer@b@	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)@b@	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)@b@	com.xwood.gw.util.XmlJSONUtil.xml2json(XmlJSONUtil.java:18)@b@	com.xwood.gw.processor.NexusProxyServiceApiXML2JSONProcessor.xml2json(NexusProxyServiceApiXML2JSONProcessor.java:117)@b@	com.xwood.gw.processor.NexusProxyServiceApiXML2JSONProcessor.serviceProxyJump(NexusProxyServiceApiXML2JSONProcessor.java:81)@b@	com.xwood.gw.processor.NexusProxyServiceApiXML2JSONProcessor.doProcess(NexusProxyServiceApiXML2JSONProcessor.java:105)@b@	com.xwood.gw.processor.core.AbstractProcessor.process(AbstractProcessor.java:10)@b@	com.xwood.gw.processor.core.ProcessorChain.process(ProcessorChain.java:22)@b@	com.xwood.gw.filter.GateWayProcessorFilter.doFilter(GateWayProcessorFilter.java:58)@b@note The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs.@b@@b@Apache Tomcat/6.0.29

二、解决办法

因为项目中缺少xom-1.0.jar依赖包导致(jar及pom文件下载),相关代码示例文件参见更多链接

<dependency>@b@    <groupId>xom</groupId>  @b@    <artifactId>xom</artifactId>  @b@    <version>1.0</version>  @b@</dependency>