提问人:xvz_cdw 提问时间:11/8/2023 最后编辑:xvz_cdw 更新时间:11/11/2023 访问量:49
使用 minio s3 spring cloud config server 检索文本文件
Retrieve text files using minio s3 spring cloud config server
问:
我正在尝试使用我的 spring cloud config server 中的配置 url 获取文本文件。
url 格式为:其中,config-server 是应用服务器的名称,prod 是配置文件,test 是 minio bucket 的文件夹名称,test1.text 是文件名。http://localhost:8080/config-server-service/prod/test/test1.txt
即使测试文件夹中存在test1.txt和test1-prod.txt文件,我也收到 404 错误:
Host: localhost:8080
Connection: keep-alive
sec-ch-ua: "Google Chrome";v="113", "Chromium";v="113", "Not-A.Brand";v="24"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Linux"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cookie: security_authentication=Fe26.2**a84f225ac3c9fa344b6d276dc2d142c67f4dc78543705577cd5c5de24f470b47*UijhHhd7tN6efBvaMszEng*rjAHa4KoTHd_NYeJW4M7Zqm8IuAgQ_wW8l88XYRLxVGQmIyDzvK6WUN3w5xzRnSrinNEJH8ZI6tVGUWYlZUYtLnNWd_CqZlXDOX1bYHc7u8btoBL7-KIsXyyWU837_ImcPhs8c8wZzHJwRrGBNpXtkMxeQBPIeH2G_-tsncE9blZLUesMRA9NWn9sOUJLN7xU2ByhTVYczatOwszGPnPzzKZlp9qOwY-hg5yFB9WdnQ**0f1695b96263093906fbc9a5ab0ef70b46ed18374a153738c0082b5ff762cd5c*v2HX3YWPQnTk4mAidQfIRRo_lQJFd8waWbNXYcRDhR0; JSESSIONID=6D14C332CC525CE613BAE2FEDAAE21C0
]
2023-11-08T15:43:40.286+05:30 DEBUG 214768 --- [nio-8080-exec-1] org.apache.tomcat.util.http.Parameters : Set query string encoding to UTF-8
2023-11-08T15:43:40.287+05:30 DEBUG 214768 --- [nio-8080-exec-1] o.a.t.util.http.Rfc6265CookieProcessor : Cookies: Parsing b[]: security_authentication=Fe26.2**a84f225ac3c9fa344b6d276dc2d142c67f4dc78543705577cd5c5de24f470b47*UijhHhd7tN6efBvaMszEng*rjAHa4KoTHd_NYeJW4M7Zqm8IuAgQ_wW8l88XYRLxVGQmIyDzvK6WUN3w5xzRnSrinNEJH8ZI6tVGUWYlZUYtLnNWd_CqZlXDOX1bYHc7u8btoBL7-KIsXyyWU837_ImcPhs8c8wZzHJwRrGBNpXtkMxeQBPIeH2G_-tsncE9blZLUesMRA9NWn9sOUJLN7xU2ByhTVYczatOwszGPnPzzKZlp9qOwY-hg5yFB9WdnQ**0f1695b96263093906fbc9a5ab0ef70b46ed18374a153738c0082b5ff762cd5c*v2HX3YWPQnTk4mAidQfIRRo_lQJFd8waWbNXYcRDhR0; JSESSIONID=6D14C332CC525CE613BAE2FEDAAE21C0
2023-11-08T15:43:40.288+05:30 DEBUG 214768 --- [nio-8080-exec-1] o.a.catalina.connector.CoyoteAdapter : Requested cookie session id is 6D14C332CC525CE613BAE2FEDAAE21C0
2023-11-08T15:43:40.289+05:30 DEBUG 214768 --- [nio-8080-exec-1] o.a.c.authenticator.AuthenticatorBase : Security checking request GET /config-server-service/prod/test/test1.txt
2023-11-08T15:43:40.289+05:30 DEBUG 214768 --- [nio-8080-exec-1] org.apache.catalina.realm.RealmBase : No applicable constraints defined
2023-11-08T15:43:40.292+05:30 DEBUG 214768 --- [nio-8080-exec-1] o.a.c.a.jaspic.AuthConfigFactoryImpl : Loading persistent provider registrations from [/tmp/tomcat.8080.14180384723947386722/conf/jaspic-providers.xml]
2023-11-08T15:43:40.292+05:30 DEBUG 214768 --- [nio-8080-exec-1] o.a.c.authenticator.AuthenticatorBase : Not subject to any constraint
2023-11-08T15:43:40.299+05:30 DEBUG 214768 --- [nio-8080-exec-1] org.apache.tomcat.util.http.Parameters : Set encoding to UTF-8
2023-11-08T15:43:40.299+05:30 DEBUG 214768 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : GET "/config-server-service/prod/test/test1.txt", parameters={}
2023-11-08T15:43:40.307+05:30 DEBUG 214768 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.cloud.config.server.resource.ResourceController#retrieve(String, String, String, ServletWebRequest, boolean)
2023-11-08T15:43:40.322+05:30 DEBUG 214768 --- [nio-8080-exec-1] .m.m.a.ExceptionHandlerExceptionResolver : Using @ExceptionHandler org.springframework.cloud.config.server.resource.ResourceControllerAdvice#notFound(NoSuchResourceException)
2023-11-08T15:43:40.322+05:30 DEBUG 214768 --- [nio-8080-exec-1] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.cloud.config.server.resource.NoSuchResourceException: Not found: test1.txt]
2023-11-08T15:43:40.322+05:30 DEBUG 214768 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed 404 NOT_FOUND
我在设置项目时参考了 spring cloud config 文档: https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#spring-cloud-config-serving-plain-text-aws-s3
我正在使用标准端点格式来获取文件: /{application}/{profile}/{label}/{path}我还尝试将 Accept 标头设置为 application/octet-stream,同时使用 url 发出 get 请求,但没有运气。
我正在使用以下版本:
Java 版本:17 spring-cloud-version:2022.0.4
s3:2.20.52 spring-cloud-aws-context:2.4.2
spring-cloud-aws-autoconfigure:2.2.6.RELEASE
基本上我想从 s3 服务器获取 excel 和文本文件。谢谢
答: 暂无答案
评论