【已解决】Unrecognized configuration feature: http://javax.xml.XMLConstants/property/accessExternalDTD
一、问题复现
使用华为云分段上传文件时发生报错。
二、报错信息
com.obs.services.exception.ObsException: OBS service Error Message. java.lang.IllegalArgumentException: Unrecognized configuration feature: http://javax.xml.XMLConstants/property/accessExternalDTD
at com.obs.services.internal.utils.ServiceUtils.changeFromServiceException(ServiceUtils.java:540)
at com.obs.services.AbstractClient.doActionWithResult(AbstractClient.java:398)
at com.obs.services.AbstractMultipartObjectClient.completeMultipartUpload(AbstractMultipartObjectClient.java:181)
...
Caused by: java.lang.IllegalArgumentException: Unrecognized configuration feature: http://javax.xml.XMLConstants/property/accessExternalDTD
at net.sf.saxon.Configuration.setConfigurationProperty(Configuration.java:4408)
at net.sf.saxon.jaxp.SaxonTransformerFactory.setAttribute(SaxonTransformerFactory.java:311)
at com.obs.services.internal.xml.OBSXMLBuilder.asString(OBSXMLBuilder.java:306)
at com.obs.services.internal.V2Convertor.transCompleteMultipartUpload(V2Convertor.java:96)
at com.obs.services.internal.service.ObsMultipartObjectService.completeMultipartUploadImpl(ObsMultipartObjectService.java:96)
at com.obs.services.AbstractMultipartObjectClient.access$400(AbstractMultipartObjectClient.java:39)
at com.obs.services.AbstractMultipartObjectClient$5.action(AbstractMultipartObjectClient.java:185)
at com.obs.services.AbstractMultipartObjectClient$5.action(AbstractMultipartObjectClient.java:182)
at com.obs.services.AbstractClient.doActionWithResult(AbstractClient.java:388)
... 97 common frames omitted
三、解决方法
将华为云 maven 依赖的版本升级就没有报错了。
附个官方文档的地址(Java):下载与安装SDK(Java SDK)
四、适用范围
Unrecognized configuration feature
是“无法识别的配置功能”的意思,可能是因为官方升级了sdk,感觉所有 Unrecognized configuration feature: http://javax.xml.XMLConstants/property/accessExternalDTD
的报错都可以试试升级版本,具体升级的版本看报错信息,如我的是 com.obs.services.exception.ObsException: OBS service Error Message.
。