开发者社区> 问答> 正文

doesBucketExist报错

判断bucket我用doesBucketExist方法判断,bucket是我随意写的,肯定是不存在的,报这个错

Exception in thread "main" com.aliyun.openservices.ClientException: 服务器返回未知错误。
    at com.aliyun.openservices.oss.internal.OSSExceptionFactory.createInvalidResponseException(OSSExceptionFactory.java:28)
    at com.aliyun.openservices.oss.internal.OSSErrorResponseHandler.handle(OSSErrorResponseHandler.java:41)
    at com.aliyun.common.comm.ServiceClient.handleResponse(ServiceClient.java:284)
    at com.aliyun.common.comm.ServiceClient.sendRequestImpl(ServiceClient.java:177)
    at com.aliyun.common.comm.ServiceClient.sendRequest(ServiceClient.java:136)
    at com.aliyun.openservices.oss.internal.OSSOperation.send(OSSOperation.java:60)
    at com.aliyun.openservices.oss.internal.OSSBucketOperation.getBucketAcl(OSSBucketOperation.java:190)
    at com.aliyun.openservices.oss.internal.OSSBucketOperation.bucketExists(OSSBucketOperation.java:240)
    at com.aliyun.openservices.oss.OSSClient.doesBucketExist(OSSClient.java:271)
    at cc.oscs.OSSObjectSample.main(OSSObjectSample.java:53)
Caused by: com.aliyun.common.parser.ResultParseException: 返回结果无效,无法解析。
    at com.aliyun.common.parser.JAXBResultParser.getObject(JAXBResultParser.java:72)
    at com.aliyun.openservices.oss.internal.OSSErrorResponseHandler.handle(OSSErrorResponseHandler.java:38)
    ... 8 more
Caused by: javax.xml.bind.UnmarshalException
- with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。]
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unknown Source)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
    at com.aliyun.common.parser.JAXBResultParser.getObject(JAXBResultParser.java:70)
    ... 9 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    ... 14 more

展开
收起
半路出家 2014-10-30 19:49:56 15274 0
3 条回答
写回答
取消 提交回答
  • 回2楼半路出家的帖子
    楼主,我按你说的方法测了下,没能重现你的问题。
    从log看,像是服务端返回的 response 中的 content 出现了问题.......
    2014-11-04 16:12:12
    赞同 展开评论 打赏
  • 回1楼deadbeef的帖子
    这个问题估计还在, jar包并没有换, String bucketName = "ywtech1"; client.doesBucketExist(bucketName); 这句话是能正常判断的,如果把bucketName 换成String bucketName = "ywtech3331"; 就会导致异常,错误信息就和我发的一样
    2014-11-03 09:46:58
    赞同 展开评论 打赏
  • RedoesBucketExist报错
    这个问题还在吗?貌似Java SDK不能正确解析XML,能提供大概的时间点,以及你采用的bucket名吗?谢谢!
    2014-11-03 09:25:40
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载