NullPointerException org.apache.commons.digester.Digester.getXMLReader(Digester.java:1058)
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)的更多相关文章
- java.lang.NullPointerException org.apache.struts2.impl.StrutsActionProxy.getErrorMessage(StrutsActionProxy.java:69)
采用SSH框架时出现了 java.lang.NullPointerException org.apache.struts2.impl.StrutsActionProxy.getErrorMessage ...
- Apache Commons Digester 三(规则注解)
前言 Digester规则的定义除了可以在代码中直接new规则添加到 Digester对象外,还可以用xml配置规则,如下所示: <digester-rules> <pattern ...
- Apache Commons Digester 二(规则模块绑定-RulesModule、异步解析-asyncParse、xml变量Substitutor、带参构造方法)
前言 上一篇对Digester做了基本介绍,也已经了解了Digester的基本使用方法,接下来将继续学习其相关特性,本篇主要涉及以下几个内容: 规则模块绑定,通过定义一个RulesModule接口实现 ...
- Apache Commons Digester 一 (基础内容、核心API)
前言 在许多需要处理XML格式数据的应用环境中, 如果能够以“事件驱动”的方式来处理XML文档,比如,当识别出特定的XML元素时,触发“创建对象”操作事件(或者触发调用对象的方法事件),这对于应用程序 ...
- Apache Commons CLI官方文档翻译 —— 快速构建命令行启动模式
昨天通过几个小程序以及Hangout源码学习了CLI的基本使用,今天就来尝试翻译一下CLI的官方使用手册. 下面将会通过几个部分简单的介绍CLI在应用中的使用场景. 昨天已经联系过几个基本的命令行参数 ...
- 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 ...
- NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
错误:Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/pool/impl ...
- 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 ...
- Dbcp2抛出org.apache.commons.dbcp2.LifetimeExceededException
三月 24, 2016 5:16:33 下午 org.apache.commons.dbcp2.BasicDataSource onSwallowException 警告: An internal o ...
随机推荐
- PHP-无限级分类
给定省市地区数组如下: $area = array( array('id'=>1,'name'=>'安徽','parent'=>'0'), ...
- 常用API接口汇总
下面列举了100多个国内常用API接口,并按照 笔记.出行.词典.电商.地图.电影.即时通讯.开发者网站.快递查询.旅游.社交.视频.天气.团队协作.图片与图像处理.外卖.消息推送.音乐.云.语义识别 ...
- 阿里云Centos7 apache配置
其实很简单,主要是有坑. 首先填坑,在阿里云安全策略上开放要访问的端口,然后配置firewall添加对应端口开放. firewall-cmd --zone=public --add-port=8011 ...
- SQL Server(解决问题)已成功与服务器建立连接,但是在登录过程中发生错误。(provider: Shared Memory Provider, error:0 - 管道的另一端上无任何进程。
http://blog.csdn.net/github_35160620/article/details/52676416 如果你在使用新创建的 SQL Server 用户名和密码 对数据库进行连接的 ...
- selenium WebDriver 八种定位方式源码
/* * 多种元素定位方式 */ package com.sfwork; import java.util.List; import org.openqa.selenium.By; import or ...
- java面向对象知识整理(一)
1.面向对象思想 概述:面向对象是相对于面向过程而言的,面向过程强调的是功能,面向对象强调的是将功能封装进对像,强调具备功能的对象. 特点:(1)符合人们思考习惯的一种思想. (2)将复杂的事情简单化 ...
- 扎实基础之从零开始-Nginx集群分布式.NET应用
1 扎实基础之快速学习Nginx Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行.其特点是占有内存少 ...
- js 数组API之filter的用法
filter 查找数组中满足条件的元素,返回新数组:原数组不变 var subArr = arr.filter(function(value, index, array){ return 条件 }) ...
- Android studio打开项目一直卡住
修改/gradle/wrapper/gradle-wrapper.properties文件中的最后一行distributionUrl=:(可找一个可用项目的复制过来)
- PyCharm/WebStorm遇到Cannot start internal HTTP server
在开始学习html.css的时候,使用PyCharm 的模拟链接到服务器的时候总是遇到 网上也没有遇到合适的解决方案,遂下载了WebStorm,希望能通过安装配置好一些设置,结果依然不行,只有从头分析 ...