shisgmei 发表于 2017-12-25 09:04:07

NullPointerException org.apache.commons.digester.Digester.getXMLReader(Digester.

  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 bedependent on the same library but different versions. Indeed we can have conflicts and the>
  The root cause of the above error is because an older version of the SAXParserFactory was being used. The>  Others have had similar problems as in this forum

  It turns out I had ther xercesImpl-2.6.2 in my>  

<!--  ========================
  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.
页: [1]
查看完整版本: NullPointerException org.apache.commons.digester.Digester.getXMLReader(Digester.