• 错误: 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.*"})
    
  • 相关阅读:
    文件参数Python读取wav格式文件
    电子工程术语和定义列表,按字母顺序排列
    MAC地址加减1算法
    uboot通过kernel command line 动态分区 CONFIG_MTD_CMDLINE_PARTS
    c调用shell脚本
    busybox提示can't access tty.job control turned off
    cut命令如何截取以空格隔开的字段
    DS28E01100
    busybox 中的ntpd使用
    Debugfs
  • 原文地址:https://www.cnblogs.com/sxyxhj/p/14659403.html
Copyright © 2020-2023  润新知