zoukankan      html  css  js  c++  java
  • 错误: com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl does not extend from SchemaDVFactory

    问题背景

    发现单元测试覆盖率不够,在检查Sonar日志时有下面的错误,导致相关的单元测试覆盖率不够

    Sonar 日志:

     16:50:09  com.sun.org.apache.xerces.internal.impl.dv.DVFactoryException: Schema factory class  com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl does  not extend from SchemaDVFactory.
     16:50:09  	at com.sun.org.apache.xerces.internal.impl.dv.SchemaDVFactory.getInstance(SchemaDVFactory.java:75) ~[?:1.8.0_282]
     16:50:09  	at com.sun.org.apache.xerces.internal.impl.dv.SchemaDVFactory.getInstance(SchemaDVFactory.java:57) ~[?:1.8.0_282]
     16:50:09  	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.reset(XMLSchemaLoader.java:1024) ~[?:1.8.0_282]
     16:50:09  	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:556) ~[?:1.8.0_282]
     16:50:09  	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:535) ~[?:1.8.0_282]
     16:50:09  	at  com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:254) ~[?:1.8.0_282]
     16:50:09  	at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:638) ~[?:1.8.0_282]
     16:50:09  	at org.opensaml.xml.XMLConfigurator.(XMLConfigurator.java:93) ~[xmltooling-1.4.4.jar:1.4.4]
     16:50:09  	at org.opensaml.xml.XMLConfigurator.(XMLConfigurator.java:74) ~[xmltooling-1.4.4.jar:1.4.4]
     16:50:09  	at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:220) ~[opensaml-2.6.4.jar:2.6.4]
     16:50:09  	at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:207) ~[opensaml-2.6.4.jar:2.6.4]
     16:50:09  	at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:100) ~[opensaml-2.6.4.jar:2.6.4]
    

    错误抛出的地方是因为代码中使用了DefaultBootstrap.bootstrap();

    解决办法

    在单元测试类头部@PowerMockIgnore增加"com.sun.org.apache.xerces.*" ,忽略该包

    @PowerMockIgnore({"javax.management.*","org.*","javax.xml.*","com.sun.org.apache.xerces.*"})
    
  • 相关阅读:
    tbusers
    Dism解决win 10访问服务器共享问题,共享需要过时的SMB1协议,安装时错误代码:0x800736B3
    &【03】Python 变量与数据类型概览
    & 【01】 Spring源码编译
    &【02】Python 基础语法
    linux出现 -bash: fork: Cannot allocate memory 问题
    并发编程-15 ThreadPoolExecutor线程池
    Spring事务嵌套问题记录
    多线程笔试题记录
    & IDEA Debug启动失败或启动慢
  • 原文地址:https://www.cnblogs.com/sxyxhj/p/14659403.html
Copyright © 2011-2022 走看看