listObjects方法报解析异常,3.15.2版本
junixapp opened this issue · 1 comments
junixapp commented
代码如下,是从文档上面直接拷贝的:
val listObjectsRequest = ListObjectsRequest(ossInfo.bucket_name)
.withPrefix(prefix)
.withMarker(nextMarker)
objectListing = ossClient!!.listObjects(listObjectsRequest)
报错如下:
2022-12-13 14:56:51,247 - Unable to parse response error: http://xml.org/sax/features/external-general-entities feature not recognized for SAX driver org.gjt.xpp.sax2.Driver
2022-12-13 14:56:51,255 - delete oss dir error : 返回结果无效,无法解析。
[ErrorCode]: InvalidResponse
[RequestId]: 639822335E5EEA3730B887E3
[HostId]: null
[ResponseError]:
http://xml.org/sax/features/external-general-entities feature not recognized for SAX driver org.gjt.xpp.sax2.Driver
com.aliyun.oss.OSSException: 返回结果无效,无法解析。
[ErrorCode]: InvalidResponse
[RequestId]: 639822335E5EEA3730B887E3
[HostId]: null
[ResponseError]:
http://xml.org/sax/features/external-general-entities feature not recognized for SAX driver org.gjt.xpp.sax2.Driver
at com.aliyun.oss.common.utils.ExceptionFactory.createOSSException(ExceptionFactory.java:113)
at com.aliyun.oss.common.utils.ExceptionFactory.createInvalidResponseException(ExceptionFactory.java:95)
at com.aliyun.oss.common.utils.ExceptionFactory.createInvalidResponseException(ExceptionFactory.java:84)
at com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:197)
at com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:153)
at com.aliyun.oss.internal.OSSBucketOperation.listObjects(OSSBucketOperation.java:337)
at com.aliyun.oss.OSSClient.listObjects(OSSClient.java:538)
at com.lxj.imageking.tool.oss.OSSUtil.deleteDir(OSSUtil.kt:61)
at com.lxj.imageking.task.ScheduleTask.removeExpireOSSImage(ScheduleTask.kt:32)
at com.lxj.imageking.task.ScheduleTask$$FastClassBySpringCGLIB$$d73c012c.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Sketcherly commented
我也碰到了,不过是在JunitTest的时候,请问有什么好的解决办法吗,我是在开始TestCase开始的时候添加了
System.setProperty("javax.xml.parsers.SAXParserFactory", "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
我也不知道这么做对不对