【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学习都 ...
随机推荐
- MySQL批量执行SQL修改视图属主的办法
前人挖坑 后人填坑 Study From https://blog.csdn.net/carefree2005/article/details/109812943 第一步: 形成SQL select ...
- 基于eBPF的微服务网络安全(Cilium 1)
基于eBPF的微服务网络安全 翻译自:Network security for microservices with eBPF 一些开源的kubernetes工具已经开始使用eBPF,这些工具大多数与 ...
- IdentityServer4 系列文章01---密码授权模式
IdentityServer4实现.Net Core API接口权限认证(快速入门) 什么是IdentityServer4 官方解释:IdentityServer4是基于ASP.NET Core实 ...
- ABP .net Core 将日志打印在控制台
上效果图 来看一下操作流程: 一.分为.net Core 2.2 和 .net Core 3.0及以上 (一)..net Core 2.2 1.在 EntityFrameworkCore中安装Nuge ...
- Linux和Windows系统下安装深度学习框架所需支持:Anaconda、Paddlepaddle、Paddlenlp、pytorch,含GPU、CPU版本详细安装过程
Linux和Windows系统下安装深度学习框架所需支持:Anaconda.Paddlepaddle.Paddlenlp.pytorch,含GPU.CPU版本详细安装过程 1.下载 Anaconda ...
- C/C++ Zlib实现文件压缩与解压
在软件开发和数据处理中,对数据进行高效的压缩和解压缩是一项重要的任务.这不仅有助于减小数据在网络传输和存储中的占用空间,还能提高系统的性能和响应速度.本文将介绍如何使用 zlib 库进行数据的压缩和解 ...
- CF1764H Doremy's Paint 2 题解
题目链接:CF 或者 洛谷 高分题,感觉挺有意思的题,值得一提的是这个题的 \(1\) 和 \(3\) 版本却是两个基础题. 一开始以为跟这道差不多:P8512 [Ynoi Easy Round 20 ...
- 除了mysql 和 sql server, 你还有另外一种选择 postgreSQL
数据库的重要性,不用多说.数据库的名字,大家应该也知道很多.就国内来说,使用者最多的应该是mysql 和sql server,大企业用ORACLE的也不在少数. 就我个人而言,在使用.NET的时候,基 ...
- Java微服务SpringCloud+Uniapp+Vue3+Element Plus开源BizSpring商城
产品介绍 BizSpring电商平台概述 BizSpring电商平台,是基于最新Spring Cloud 微服务架构开发的多语言电商平台,使用领先的 Vue3.0+ElementPlus + unia ...
- select * 的使用说明
一. SELECT * 的含义 select * 语句是从指定的表中按照顺序返回所有列. 二. SELECT * 的优缺点 1 优点 在实际开发过程中,大家习惯性地使用select * from ...