问题描述

使用 azure-spring-boot-starter-storage 来上传文件到 Storage Blob中,并把应用部署到Azure 中国区的Spring Cloud服务后,调用上传文件的接口报错:  java.net.UnknownHostException: xxxxxxxx.blob.core.windows.net: Name or service not known

使用的依赖为:

<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>spring-starter-azure-storage</artifactId>
<version>1.2.8</version>
</dependency>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.5.RELEASE</version>
<relativePath/>
</parent>

问题解决

从错误来分析,这是使用到了SDK中默认Global Azure Storage的Endpoint导致,在中国区,正确的Blob Endpoint为:xxxxxxxx.blob.core.chinacloudapi.cn

根据查看官方文档,对 azure storage的spring boot引用的storage 依赖名称为 com.azure.spring:azure-spring-boot-starter-storage,而当前错误的应用中引用的是 com.microsoft.azure: spring-starter-azure-storage

根据文档建议修改后,上传文件问题“Name not known”得以解决。

参考资料

Spring Boot Starter for Azure Storage: https://docs.microsoft.com/en-us/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-storage

【Azure Spring Cloud】使用azure-spring-boot-starter-storage来上传文件报错: java.net.UnknownHostException: xxxxxxxx.blob.core.windows.net: Name or service not known的更多相关文章

  1. Spring使用mutipartFile上传文件报错【Failed to instantiate [org.springframework.web.multipart.MultipartFile]】

    报错场景: 使用SSM框架实现文件上传时报“Failed to instantiate [org.springframework.web.multipart.MultipartFile]”错,控制器源 ...

  2. Spring MVC实现上传文件报错解决方案

    报错代码: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.sp ...

  3. Spring Boot应用上传文件时报错

    问题描述 Spring Boot应用(使用默认的嵌入式Tomcat)在上传文件时,偶尔会出现上传失败的情况,后台报错日志信息如下:"The temporary upload location ...

  4. spring cloud feign 上传文件报not a type supported by this encoder解决方案

    上传文件调用外部服务报错: not a type supported by this encoder 查看SpringFormEncoder类的源码: public class SpringFormE ...

  5. Spring boot 全局配置 properties或者yml文件报错

    主要问题是没有扫描到配置文件 在pom文件里面<build>    </build>中加上以下代码就可以保证能扫描到了 <resources> <resour ...

  6. 后台使用Spring MVC 4.15 版本 通过 ajaxFileUpload plugin插件上传文件相应时引起的一个小问题,Chrome、Firefox中出现SyntaxError:unexpected token <

    html: 使用ajaxFileUpload插件做文件上传时,后台返回json格式的数据,js代码如下: 接下来,把结果错误信息打印出来: 先在网上找了下解决办法方案,stackoverflow上有说 ...

  7. dubbo spring pom文件报错:提示no declaration can be found for element 'dubbo:service'.

    pom文件报错:The matching wildcard is strict, but no declaration can be found for  element 'dubbo:service ...

  8. spring pom文件报错:提示no declaration can be found for element 'dubbo:service'.

    转自:http://blog.csdn.net/happylife_haha/article/details/52755425 pom文件报错:The matching wildcard is str ...

  9. 【Spring Boot】关于上传文件例子的剖析

    目录 Spring Boot 上传文件 功能实现 增加ControllerFileUploadController 增加ServiceStorageService 增加一个Thymeleaf页面 修改 ...

  10. Spring Cloud学习笔记--Spring Boot初次搭建

    1. Spring Boot简介 初次接触Spring的时候,我感觉这是一个很难接触的框架,因为其庞杂的配置文件,我最不喜欢的就是xml文件,这种文件的可读性很不好.所以很久以来我的Spring学习都 ...

随机推荐

  1. 数组查询includes

    let arr1 = ['kk', 'jo', 'll']; if (arr1.includes("kk")) {//[ɪnˈkluːz] console.log("找到 ...

  2. 【JS 逆向百例】XHR 断点调试,Steam 登录逆向

    声明 本文章中所有内容仅供学习交流,抓包内容.敏感网址.数据接口均已做脱敏处理,严禁用于商业用途和非法用途,否则由此产生的一切后果均与作者无关,若有侵权,请联系我立即删除! 逆向目标 目标:Steam ...

  3. 强化学习技巧五:numba提速python程序

    numba是一款可以将python函数编译为机器代码的JIT编译器,经过numba编译的python代码(仅限数组运算),其运行速度可以接近C或FORTRAN语言. numba使用情况 使用numpy ...

  4. Linux下的gcc/g++编译器的使用 [补档-2023-06-13]

    gcc编译器 ​ 这东西是Linux上的c/c++编译器. 5-1 gcc的工作流程 5-2 gcc的常用参数 -v 查看gcc版本号, --version也可以 -E 生成预处理文件 -S 生成汇编 ...

  5. 使用s3fs-fuse挂载minio文件时无法删除问题排查过程

    使用s3fs-fuse挂载minio文件时无法删除问题排查过程 结论:部分场景无法满足,具体问题详见正文 1. 部署minio docker run    -p 9000:9100    -p 909 ...

  6. ubuntu系统单网卡配置多网段IP

    环境 系统版本:Ubuntu 16.04.5 LTS 配置 ubuntu系统网卡文件是interfaces,修改网卡配置文件vim /etc/network/interfaces添加2个IP地址: a ...

  7. 散片便宜300元!但还是劝你买盒装CPU

    喜欢DIY的小伙伴在选购产品时会纠结于散片和盒装,以13代酷睿i5-13600KF为例,散片一般是1899元左右,而盒装2199元,两者相差300元,AMD的锐龙5 7600也差不多,盒装和散片相差也 ...

  8. 教你用CSS实现表单部件

    案例介绍 欢迎来到我的小院,我是霍大侠,恭喜你今天又要进步一点点了!我们来用CSS编程实战案例,使用 列表标签完成一个下拉菜单样式的表单部件. 案例演示 运行代码后在浏览器弹出由 标签组成的下拉菜单样 ...

  9. 如何在windows端安装和配置maven

    1.下载maven 从官方下载maven,下载页面:http://maven.apache.org/download.cgi 2.安装maven maven压缩包解压到一个没有中文,空格或其他特殊字符 ...

  10. 分布式图算法Pregel

    最近看了Google的Pregel论文,图算法有一些经典且不可被替代的应用场景,如社交网络,相互引用等.但是在单个结点上的运算量往往过少,注重的是消息传播和逻辑处理,而不是单纯的大规模计算.虽然已经过 ...