首页 > 其他分享> > 错误: com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl does not extend from SchemaDVF
错误: com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl does not extend from SchemaDVF
作者:互联网
问题背景
发现单元测试覆盖率不够,在检查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.*"})
标签:java,extend,xerces,16,sun,09,50,apache,org 来源: https://www.cnblogs.com/sxyxhj/p/14659403.html