http://pwu-developer.blogspot.com/2010/01/nullpointerexception.html

Maven is great build tool making it easy to fetch all the library dependencies for a particular build. But what happens when you've got an application that uses wide variety of libraries of which can be dependent on the same library but different versions. Indeed we can have conflicts and the title of this blog is what I got as a result of some transitive dependency of Apache CXF.

The root cause of the above error is because an older version of the SAXParserFactory was being used. The class loaders for commons digester was using the SAXParserFactory from another JAR file in the classpath rather than the one provided in the JDK 1.6.
Others have had similar problems as in this forum

It turns out I had ther xercesImpl-2.6.2 in my classpath. This I needed to remove and boilied down to adding exclusions in my POM file as follows:

<!--
========================
Apache CXF Web services
========================
-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle-minimal</artifactId>
<version>2.2.4</version> <exclusions>
<exclusion>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
</exclusion>
<exclusion>
<groupId>xalan</groupId>
<artifactId>serializer</artifactId>
</exclusion> <exclusion>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
</exclusion> <exclusion>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
</exclusion> <exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion> <exclusion>
<groupId>xerces</groupId>
<artifactId>xmlParserAPIs</artifactId>
</exclusion> <exclusion>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
</exclusion> </exclusions> </dependency>

---------------

maven 引入依赖时,会进行传递依赖也引入。

比如 a.jar 依赖 x.jar; b.jar 页依赖x.jar;

但是 a.jar依赖的是 x-1.1.jar; b.jar 依赖的是 x-1.0.jar;

这样的话,项目的就会同时引入了 x-1.1.jar 和 x-1.0.jar;

这样的话,需要将 x-1.0.jar 进行排除出去;因为 a.jar 依赖x-1.1jar,但是因为同时存在 x-1.1.jar 和 x-1.0.jar 的话,a.jar 可能会使用x-1.0.jar而没有使用 x-1.1.jar;

这样可能会导致a.jar报错。所以需要将 x-1.0.jar 排除出去;

而 b.jar 依赖于 x-1.0.jar,因为 x-1.1.jar版本比 x-1.0.jar高,所以 b.jar使用 x-1.1.jar 和 使用 x-1.0.jar都应该没有问题;一般高版本会兼容低版本;

反过来就不行。

自己项目中删除掉 xerces-2.6.2.jar包就好了。

注意tomcat也要进行清理,不能仅仅在 eclipse 中删除,因为 删除了eclipse中项目中的jar包,tomcat中的可能并没有删除。所以需要进行 一下 clean.

NullPointerException org.apache.commons.digester.Digester.getXMLReader(Digester.java:1058)的更多相关文章

  1. java.lang.NullPointerException org.apache.struts2.impl.StrutsActionProxy.getErrorMessage(StrutsActionProxy.java:69)

    采用SSH框架时出现了 java.lang.NullPointerException org.apache.struts2.impl.StrutsActionProxy.getErrorMessage ...

  2. Apache Commons Digester 三(规则注解)

    前言 Digester规则的定义除了可以在代码中直接new规则添加到 Digester对象外,还可以用xml配置规则,如下所示: <digester-rules> <pattern ...

  3. Apache Commons Digester 二(规则模块绑定-RulesModule、异步解析-asyncParse、xml变量Substitutor、带参构造方法)

    前言 上一篇对Digester做了基本介绍,也已经了解了Digester的基本使用方法,接下来将继续学习其相关特性,本篇主要涉及以下几个内容: 规则模块绑定,通过定义一个RulesModule接口实现 ...

  4. Apache Commons Digester 一 (基础内容、核心API)

    前言 在许多需要处理XML格式数据的应用环境中, 如果能够以“事件驱动”的方式来处理XML文档,比如,当识别出特定的XML元素时,触发“创建对象”操作事件(或者触发调用对象的方法事件),这对于应用程序 ...

  5. Apache Commons CLI官方文档翻译 —— 快速构建命令行启动模式

    昨天通过几个小程序以及Hangout源码学习了CLI的基本使用,今天就来尝试翻译一下CLI的官方使用手册. 下面将会通过几个部分简单的介绍CLI在应用中的使用场景. 昨天已经联系过几个基本的命令行参数 ...

  6. java.lang.NullPointerException org.apache.jsp.WEB_002dINF.pages.imagecheck.test_jsp._jspInit(test_jsp.java:22)的原因

    HTTP Status 500 - type Exception report message description The server encountered an internal error ...

  7. NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool

    错误:Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/pool/impl ...

  8. java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntim [问题点数:40分,结帖人wangxiaohua_001]

    14:56:10.093 WARN!! Error for /butterfly/plugins/zhonghang/UsefulData/save_usefuldata.bshjava.lang.N ...

  9. Dbcp2抛出org.apache.commons.dbcp2.LifetimeExceededException

    三月 24, 2016 5:16:33 下午 org.apache.commons.dbcp2.BasicDataSource onSwallowException 警告: An internal o ...

随机推荐

  1. find 命令的误差估值与单位调整

    一.命令简介 find 命令的 -size 参数 单位b(不是byte而是block).c.w.k.M.G.默认是单位b ,也就是1block = 512byte = 0.5kb (文件系统ext4) ...

  2. Linux(CentOS6.5)修改系统市区被中国标准时间(北京时间)

    本文地址http://comexchan.cnblogs.com/ ,作者Comex Chan,尊重知识产权,转载请注明出处,谢谢! 备份时区配置文件 cp /etc/localtime /etc/l ...

  3. 在QComboBox的基础上实现复选功能

    这个是最近的一个项目上需要实现的功能.要求如下: 下拉列表的项目可以多选 显示框不能编辑 所选中的项目在显示框中出现 下面根据网上的提示代码(参照博客 一去二三里),主要实现如下代码(与参照略有不同) ...

  4. 有关opacity或RGBA设置颜色值及元素的透明值

    opacity声明来设置元素的透明值,当opacity设置元素的透明值,内部的文字及元素也会透明,通过RGBA设置的颜色值只针对当前元素,内部的文字及元素的透明值并未发生变化   opacity声明来 ...

  5. 鸟哥的linux私房菜学习-(二)VMware虚拟机及linux系统安装过程

    一.安装虚拟机 1.虚拟机常用版本及注册码地址:https://pan.baidu.com/s/1dFnkBrN#list/path=%2FSoftware%20Big%2FVMware%20Work ...

  6. win10使用u盘装回win7

    背景:一朋友要我帮忙把系统从win10装回到win7,因为做IT的嘛,想想也难不倒我,况且以前也经常重装系统,硬盘里就有win7的系统,于是很爽快的答应了.电脑拿过来一试才知道原来有这么多坑,原来的系 ...

  7. jQuery CSS 操作函数(六)

    CSS 属性 描述 css() 设置或返回匹配元素的样式属性. height() 设置或返回匹配元素的高度. offset() 返回第一个匹配元素相对于文档的位置. offsetParent() 返回 ...

  8. 通过!important设置css样式优先级

    CSS写在不同的地方有不同的优先级,一般 .css文件中的定义 < 元素style中的属性,但是如果使用!important,则会变得不一样,使用!important的css定义是拥有最高的优先 ...

  9. ts中interface与class的区别

    interface -- 接口只声明成员方法,不做实现. class -- 类声明并实现方法. 那么接口有什么用呢?设想如下需求: 要实现一个print函数,它将传入的对象打印出来.在实际实现上,它将 ...

  10. DNN论文分享 - Item2vec: Neural Item Embedding for Collaborative Filtering

    前置点评: 这篇文章比较朴素,创新性不高,基本是参照了google的word2vec方法,应用到推荐场景的i2i相似度计算中,但实际效果看还有有提升的.主要做法是把item视为word,用户的行为序列 ...