MinIO报错 : Non-XML response from server

发生背景:

今天刚学习minio上传文件,但是突然报了Non-XML response from server

image.png

源代码:

``` @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class) public class MinioTest {

public static void main(String[] args) throws IOException, InvalidKeyException, InvalidResponseException, InsufficientDataException, NoSuchAlgorithmException, ServerException, InternalException, XmlParserException, InvalidBucketNameException, ErrorResponseException {

    FileInputStream fileInputStream = new FileInputStream("E:\桌面\learning-files\code\toutiao\day2\list.html");

    // 创建一个minio的客户端
    MinioClient client = MinioClient.builder()
            .credentials("minio", "minio123")
            .endpoint("http://139.159.138.71:9000")
            .build();
    //上传
    PutObjectArgs putObjectArgs = PutObjectArgs.builder()
            .object("list.html") //文件名称
            .contentType("text/html") //文件类型
            .bucket("leadnews") // 桶的名称
            .stream(fileInputStream,fileInputStream.available(),-1)
            .build();
    client.putObject(putObjectArgs);

    //访问路径
    System.out.println("http://139.159.138.71:9000/leadnews/list.html");
}

} ```

解决策略

倒推了一下,我是用dokcer安装minio的,其中指定了文件服务器端口为9090

docker run -p 9000:9000 -p 9090:9090 --name minio -d --restart=always -e "MINIO_ACCESS_KEY=minio" -e "MINIO_SECRET_KEY=minio123" -v /home/data:/data -v /home/config:/root/.minio minio/minio server /data --console-address ":9000" --address ":9090"

所以,上面的代码中的9000换为9090就可以了

image.png

附:环境搭建

docker pull docker.io/minio/minio ``` io.minio minio 8.5.2

```

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值