【Azure Spring Cloud】使用azure-spring-boot-starter-storage来上传文件报错: java.net.UnknownHostException: xxxxxxxx.blob.core.windows.net: Name or service not known
问题描述
使用 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的更多相关文章
- Spring使用mutipartFile上传文件报错【Failed to instantiate [org.springframework.web.multipart.MultipartFile]】
报错场景: 使用SSM框架实现文件上传时报“Failed to instantiate [org.springframework.web.multipart.MultipartFile]”错,控制器源 ...
- Spring MVC实现上传文件报错解决方案
报错代码: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.sp ...
- Spring Boot应用上传文件时报错
问题描述 Spring Boot应用(使用默认的嵌入式Tomcat)在上传文件时,偶尔会出现上传失败的情况,后台报错日志信息如下:"The temporary upload location ...
- spring cloud feign 上传文件报not a type supported by this encoder解决方案
上传文件调用外部服务报错: not a type supported by this encoder 查看SpringFormEncoder类的源码: public class SpringFormE ...
- Spring boot 全局配置 properties或者yml文件报错
主要问题是没有扫描到配置文件 在pom文件里面<build> </build>中加上以下代码就可以保证能扫描到了 <resources> <resour ...
- 后台使用Spring MVC 4.15 版本 通过 ajaxFileUpload plugin插件上传文件相应时引起的一个小问题,Chrome、Firefox中出现SyntaxError:unexpected token <
html: 使用ajaxFileUpload插件做文件上传时,后台返回json格式的数据,js代码如下: 接下来,把结果错误信息打印出来: 先在网上找了下解决办法方案,stackoverflow上有说 ...
- 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 ...
- 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 ...
- 【Spring Boot】关于上传文件例子的剖析
目录 Spring Boot 上传文件 功能实现 增加ControllerFileUploadController 增加ServiceStorageService 增加一个Thymeleaf页面 修改 ...
- Spring Cloud学习笔记--Spring Boot初次搭建
1. Spring Boot简介 初次接触Spring的时候,我感觉这是一个很难接触的框架,因为其庞杂的配置文件,我最不喜欢的就是xml文件,这种文件的可读性很不好.所以很久以来我的Spring学习都 ...
随机推荐
- 服务器重装ip未更改,ssh连不上(WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED)
服务器重装ip未更改,ssh连不上 前言 原因 解决方法 服务器重装ip未更改,ssh连不上 前言 重装了虚拟机,ip还保留了,但是发现连不上了 @@@@@@@@@@@@@@@@@@@@@@@@@@@ ...
- EXPLAIN分析pgsql的性能
EXPLAIN分析pgsql的性能 前言 EXPLAIN命令 EXPLAIN -- 显示一个语句的执行计划 命令详解 EXPLAIN输出结果展示 analyze buffers 全表扫描 索引扫描 位 ...
- 一键式文本纠错工具,整合了BERT、ERNIE等多种模型,让您立即享受纠错的便利和效果
pycorrector一键式文本纠错工具,整合了BERT.MacBERT.ELECTRA.ERNIE等多种模型,让您立即享受纠错的便利和效果 pycorrector: 中文文本纠错工具.支持中文音似. ...
- 【二】最新多智能体强化学习文章如何查阅{顶会:AAAI、 ICML }
相关文章: [一]最新多智能体强化学习方法[总结] [二]最新多智能体强化学习文章如何查阅{顶会:AAAI. ICML } [三]多智能体强化学习(MARL)近年研究概览 {Analysis of e ...
- .NetCore 三种生命周期注入方式
.NetCore彻底诠释了"万物皆可注入"这句话的含义,在.NetCore中到处可见注入的使用.因此core中也提供了三种注入方式的使用,分别是: AddTransient:每次请 ...
- 分享四个实用的vue自定义指令
v-drag 需求:鼠标拖动元素 思路: 元素偏移量 = 鼠标滑动后的坐标 - 鼠标初始点击元素时的坐标 + 初始点击时元素距离可视区域的top.left 将可视区域作为边界,限制在可视区域里面拖拽 ...
- 零基础入门学习Java课堂笔记 ——day04
Java数组 1.数组概述 定义:数组是相同类型的有序集合,同一组同一类型的数据可以按照先后次序排列组合在一起,其中一个数据可以称为元素,每个数组元素可以通过一个下表访问它们 2.数组声明创建 dat ...
- ABC 333
ABCDE 赛时 AC. F 列方程:\(f_{i,j}\) 表示有 \(i\) 个人,第 \(j\) 个人最终活下来的概率. \(f_{i,1}=\dfrac{1}{2}f_{i,i}\),因为只有 ...
- OI中的一些数学小技巧
在OI比赛中,如果能够灵活地运用一些数学小技巧,是能够很好地优化计算的时间和正确性的. 既然说了是小技巧,那么这些指的都是一些技巧,一般是不会单独成题的. 本博客或会随着作者的见识而更新 Better ...
- Ubuntu 22.04 Samba 安装和配置
安装 安装 sudo apt install samba 检查服务状态 systemctl status smbd --no-pager -l 检查是否启用(开机自启动) systemctl is-e ...