首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring Cloud Skipper外壳-没有合适的HttpMessageConverter

Spring Cloud Skipper外壳-没有合适的HttpMessageConverter
EN

Stack Overflow用户
提问于 2019-07-28 10:05:59
回答 2查看 173关注 0票数 0

我在NGINX代理后面运行Spring Cloud Skipper。当我尝试使用笔记本电脑上运行的本地外壳使用代理url连接到Skipper服务器时,

代码语言:javascript
复制
I get the error: Could not extract response: no suitable HttpMessageConverter found for response type [org.springframework.hateoas.Resources<org.springframework.cloud.skipper.domain.Deployer>] and content type [text/html]
Details of the error have been omitted. You can use the stacktrace command to print the full stacktrace.

我已经尝试过Skipper NGINX代理urls了。浏览器和浏览器开发工具上的https://example.com/skipper/api/abouthttps://example.com/skipper/api/deployers显示响应头为content-type: application/hal+json;charset=UTF-8

直接在skipper服务器使用localhost url运行的主机上运行Skipper工作得很好。只有通过NGINX代理url访问时才会出现错误。

代码语言:javascript
复制
Could not extract response: no suitable HttpMessageConverter found for response type [org.springframework.hateoas.Resources<org.springframework.cloud.skipper.domain.Deployer>] and content type [text/html]
Details of the error have been omitted. You can use the stacktrace command to print the full stacktrace.

org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [org.springframework.hateoas.Resources<org.springframework.cloud.skipper.domain.Deployer>] and content type [text/html]
        at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:121)
        at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:995)
        at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:978)
        at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:737)
        at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:710)
        at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:628)
        at org.springframework.hateoas.client.Traverson$TraversalBuilder.toObject(Traverson.java:344)
        at org.springframework.cloud.skipper.client.DefaultSkipperClient.listDeployers(DefaultSkipperClient.java:335)
        at org.springframework.cloud.skipper.shell.command.PlatformCommands.list(PlatformCommands.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:246)
        at org.springframework.shell.Shell.evaluate(Shell.java:180)
        at org.springframework.shell.Shell.run(Shell.java:142)
        at org.springframework.shell.jline.InteractiveShellApplicationRunner.run(InteractiveShellApplicationRunner.java:84)
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:804)
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:794)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:324)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
        at org.springframework.cloud.skipper.shell.ShellApplication.main(ShellApplication.java:32)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) 
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-07-30 12:07:11

设置以下属性application.yml解决了此问题。

代码语言:javascript
复制
      server:
        use-forward-headers: true
票数 1
EN

Stack Overflow用户

发布于 2019-07-28 21:31:56

此问题的根本原因: TLS在proxy上终止,Spring Cloud Skipper在Nginx Proxy后面的"http“端口上运行。因此,spring cloud skipper hateoas会生成"http“链接,而不是"https”。当shell试图"GET“Spring Cloud Skipper hateoas返回的URLS (http)时,Proxy请求重定向到https的308,这是导致异常的原因。

目前,我使用注释"nginx.ingress.kubernetes.io/ssl- redirect : false“关闭了Kubernetes Nginx入口资源级别的重定向。

当我弄清楚如何在Spring Cloud Skipper中配置代理头部以生成"https“urls而不是http时,我将发布更多详细信息。

或者另一种解决方案可以是在代理中配置TLS通过,并通过在Skipper中启用TLS来在Skipper处终止TLS。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57237431

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档