Spring Cloud Skipper shell - no suitable HttpMessageConverter - content-type

I am running Spring Cloud Skipper behind the NGINX proxy. When I try connecting to the Skipper server using the local shell running on laptop using proxy url,
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.
I have tried the Skipper NGINX proxy urls like . https://example.com/skipper/api/about and https://example.com/skipper/api/deployers on browser and browser developer tools shows that response header is content-type: application/hal+json;charset=UTF-8
Running skipper directly on the host where Skipper server is running with localhost url works fine. Error only happens when accessing through NGINX proxy url.
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)

Root cause for this issue: TLS terminates at the Proxy and Spring Cloud Skipper is running on "http" port behind Nginx proxy. So, spring cloud skipper hateoas generates "http" links instead of "https". When the shell tries to "GET" on the URLS (http) returned by Spring Cloud Skipper hateoas, Proxy is requesting a redirect to https with 308 which is causing the exception.
For time being I have turned off the redirect at Kubernetes Nginx ingress resource level with annotation "nginx.ingress.kubernetes.io/ssl-redirect: false".
I will post more details later when I figure out how to configure the proxy headers to generate "https" urls instead http in Spring Cloud Skipper.
Or another solution could be configure TLS passthrough in Proxy and terminate the TLS at Skipper by enabling TLS in Skipper.

Setting the following property application.yml resolved the issue.
server:
use-forward-headers: true

Related

Deploy apache archiva 2.2.8 war to Tomcat 9: not accept HTTP connection

Deploy apache archiva 2.2.8 war to Tomcat 9: could not accept HTTP connections.
There are many errors like this on server side:
WARNING [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
Did not accept any HTTP connection from browser: http://localhost:8080. HTTP status 404 Not Found.

Maximo Anywhere - Cannot deploy apps remotely to mobilefirst server( Rest Exceptions)

I am trying to deploy Maximo Anywhere apps from MacOS X system using ./build.sh command. It is always failing with:
Resexception: unexpected response, Not able to access <an URL>
I am not able to understand what is causing this issue.
The mobile first server is deployed in a Cloud server.
Please let me know if you have faces this issue.
Below is the error log I can see:
8/7/18 16:32:45:610 AEST] 000000bc WASRuntimeMBe I SOAP connection with port number 8879
[8/7/18 16:32:45:610 AEST] 000000bc WASRuntimeMBe I Establishing SOAP connection on *actualserverName* with port number 8879
[8/7/18 16:32:57:985 AEST] 00000096 WorklightILMT I com.worklight.core.ilmt.WorklightILMTLogger dumpLicense FWLSE0277I: Creating an ILMT record in the file 'D:\IBM\WebSphere\AppServer\profiles\ctgAppSrv01\logs\worklight\caffeda003ba82a720f5f584f060728a.slmtag'. [project MaximoAnywhere]
[8/7/18 16:32:59:126 AEST] 0000005a ProjectManage I com.worklight.core.jmx.ProjectManagementMXBeanImpl logTransactionDetails FWLSE0275I: Starting transaction with ID 14 for 'deployAdapter'. [project MaximoAnywhere]
[8/7/18 16:33:00:891 AEST] 0000005a StatusMessage E StatusMessage createStatusMessage Preparation to deploy adapter failed: HTTP/1.1 404 Not Found while accessing MobileFirst artifact URL: https://*aliashostName*:443/wladmin/otu/1.0/28656effffffd52effffff871bffffffc759ffffffc4ffffffb3ffffffee70377b3f/runtimes/MaximoAnywhere/downloads/adapters/Temporary317569284
java.io.IOException: HTTP/1.1 404 Not Found while accessing MobileFirst artifact URL: https://*aliashostName*:443/wladmin/otu/1.0/28656effffffd52effffff871bffffffc759ffffffc4ffffffb3ffffffee70377b3f/runtimes/MaximoAnywhere/downloads/adapters/Temporary317569284
at com.worklight.common.util.HttpUtil.getBytesFromURL(HttpUtil.java:630)
at com.worklight.integration.services.impl.AdapterManagementServiceBean.readAdapterContent(AdapterManagementServiceBean.java:181)
at com.worklight.integration.services.impl.AdapterManagementServiceBean.deployAdapter(AdapterManagementServiceBean.java:112)
at com.worklight.mgmt.impl.AdapterManagementImpl.deployAdapter(AdapterManagementImpl.java:52)
at com.worklight.core.jmx.ProjectManagementMXBeanImpl.deployAdapter(ProjectManagementMXBeanImpl.java:1488)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
at java.lang.reflect.Method.invoke(Method.java:620)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:88)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
at java.lang.reflect.Method.invoke(Method.java:620)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:292)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:206)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:188)
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:130)
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:67)
at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:250)
at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:151)
at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:265)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:832)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:814)
at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1350)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1243)
at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181)
at com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:247)
at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:360)
at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:602)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$QueuedWork.run(SSLReadServiceContext.java:1987)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)
Caused by: java.io.IOException: HTTP/1.1 404 Not Found
at com.worklight.common.util.HttpUtil.getBytesFromURL(HttpUtil.java:627)
... 32 more
[8/7/18 16:33:00:970 AEST] 000000af BaseTransacti E Result: MaximoAnywhere: worklight/ctgCell01/ctgNode01/172.23.100.7: HTTP/1.1 404 Not Found while accessing MobileFirst artifact URL: https://*aliashostName*:443/wladmin/otu/1.0/28656effffffd52effffff871bffffffc759ffffffc4ffffffb3ffffffee70377b3f/runtimes/MaximoAnywhere/downloads/adapters/Temporary317569284
[8/7/18 16:33:01:001 AEST] 0000005a ProjectManage I com.worklight.core.jmx.ProjectManagementMXBeanImpl logTransactionDetails FWLSE0275I: Starting transaction with ID 14 for 'reject'. [project MaximoAnywhere]
[8/7/18 16:33:01:079 AEST] 000000af BaseTransacti I Result: MaximoAnywhere: worklight/ctgCell01/ctgNode01/172.23.100.7: Rollback
I've read somewhere that you're not supposed to deploy the apps to the real server from a local, remote environment. Is there a team administrating the server on the Cloud? If so, I would recommend providing the Cloud Team with your (perhaps) updated application folders and asking them to perform the deploy for you, from the server itself.

HTTPS and Spring Cloud Contract Stub Runner

I am receiving the following stack trace when sending an https request through the load balanced RestTemplate:
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://securityService/oauth/token": Unrecognized SSL message, plaintext connection?; nested exception is javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:633)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:580)
at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:407)
at org.springframework.web.client.RestTemplate$$FastClassBySpringCGLIB$$aa4e9ed0.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
at org.springframework.cloud.netflix.metrics.RestTemplateUrlTemplateCapturingAspect.captureUrlTemplate(RestTemplateUrlTemplateCapturingAspect.java:33)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
at org.springframework.web.client.RestTemplate$$EnhancerBySpringCGLIB$$dfb025c8.postForEntity()
at com.acme.SecurityService.getBearerToken(SupportServiceImpl.java:62)
... 33 more
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at org.springframework.http.client.SimpleBufferingClientHttpRequest.executeInternal(SimpleBufferingClientHttpRequest.java:78)
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:93)
at org.springframework.cloud.client.loadbalancer.RetryLoadBalancerInterceptor$1$1.apply(RetryLoadBalancerInterceptor.java:70)
at org.springframework.cloud.client.loadbalancer.RetryLoadBalancerInterceptor$1$1.apply(RetryLoadBalancerInterceptor.java:62)
at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:98)
at org.springframework.cloud.client.loadbalancer.RetryLoadBalancerInterceptor$1.doWithRetry(RetryLoadBalancerInterceptor.java:60)
at org.springframework.cloud.client.loadbalancer.RetryLoadBalancerInterceptor$1.doWithRetry(RetryLoadBalancerInterceptor.java:48)
at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:276)
at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:157)
at org.springframework.cloud.client.loadbalancer.RetryLoadBalancerInterceptor.intercept(RetryLoadBalancerInterceptor.java:48)
at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:85)
at org.springframework.cloud.sleuth.instrument.web.client.TraceRestTemplateInterceptor.response(TraceRestTemplateInterceptor.java:59)
at org.springframework.cloud.sleuth.instrument.web.client.TraceRestTemplateInterceptor.intercept(TraceRestTemplateInterceptor.java:53)
at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:85)
at org.springframework.cloud.netflix.metrics.MetricsClientHttpRequestInterceptor.intercept(MetricsClientHttpRequestInterceptor.java:68)
at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:85)
at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:69)
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:619)
... 50 more
How can I configure Spring Cloud Contract Stub Runner to enable my Spring Cloud stubs to be accessed via HTTPS?
Here you have an example of how to set up Spring Cloud Contract Wiremock with SSL - https://github.com/spring-cloud/spring-cloud-contract/blob/master/samples/wiremock-undertow-ssl/src/main/resources/application.properties . You can use a similar setup for the normal Wiremocks. Also since you're using Spring Cloud remember about mapping the artifact id to the service name https://cloud.spring.io/spring-cloud-contract/1.0.x/spring-cloud-contract.html#_stub_runner_spring_cloud

apache zeppelin programmatic test. Websockets calls

Trying to use spring websocet library to connect to zeppelin, running on default port 8080.
When I use :
ClientWebSocketContainer container = new ClientWebSocketContainer(
webSocketClient(), "ws://localhost:8080");
Get error :
java.io.IOException: Connect failure
at org.eclipse.jetty.websocket.jsr356.ClientContainer.connect(ClientContainer.java:157) ~[javax-websocket-client-impl-9.2.14.v20151106.jar:9.2.14.v20151106]
at org.eclipse.jetty.websocket.jsr356.ClientContainer.connectToServer(ClientContainer.java:180) ~[javax-websocket-client-impl-9.2.14.v20151106.jar:9.2.14.v20151106]
at org.springframework.web.socket.client.standard.StandardWebSocketClient$1.call(StandardWebSocketClient.java:152) ~[spring-websocket-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.socket.client.standard.StandardWebSocketClient$1.call(StandardWebSocketClient.java:149) ~[spring-websocket-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_111]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111]
Caused by: org.eclipse.jetty.websocket.api.UpgradeException: Didn't switch protocols
at org.eclipse.jetty.websocket.client.io.UpgradeConnection.validateResponse(UpgradeConnection.java:314) ~[websocket-client-9.2.14.v20151106.jar:9.2.14.v20151106]
at org.eclipse.jetty.websocket.client.io.UpgradeConnection.read(UpgradeConnection.java:241) ~[websocket-client-9.2.14.v20151106.jar:9.2.14.v20151106]
at org.eclipse.jetty.we...
When I try to connect to 8081 (what the docs say is the websocket port):
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_111]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_111]
at org.eclipse.jetty.io.SelectorManager.finishConnect(SelectorManager.java:340) ~[jetty-io-9.2.14.v20151106.jar:9.2.14.v20151106]
On browser I can connect to 8080 and not make notebooks.
Want to automate and write test cases for our notebooks.
I guess your ws url is a bit malformed, could you try with ws://localhost:8080/ws?
Update:
There's similar example in Zeppelin codebase itself, say for getting note. For example here the method for getting note and here is the crafted message that is sent via ws api. Also this class points to the structure of socket message.

why i got an error while running C:\otp\otp>bin\start-server.bat in command prompt?

When i'm tring to run Open trip planner in my windos system i got an error like this why this happens?
when i'm tring to run
C:\otp\otp>bin\start-server.bat
in command prompt,i had an error like below..
can anyone know why this happens??
C:\otp\otp>bin\start-server.bat
C:\otp\otp>java -Xmx1448m -jar lib\winstone.jar --webappsDir=webapps
.......
.......
[Winstone 2012/11/22 15:47:59] - Beginning extraction from war file
[Winstone 2012/11/22 15:48:00] - No webapp classes folder found - C:\otp\otp\web
apps\opentripplanner-webapp\WEB-INF\classes
[Winstone 2012/11/22 15:48:00] - Deployed web application found at opentripplann
er-webapp.war
[Winstone 2012/11/22 15:48:00] - Winstone Servlet Engine v0.9.10 running: contro
lPort=disabled
[Winstone 2012/11/22 15:48:00] - Error during HTTP listener init or shutdown
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at winstone.HttpListener.getServerSocket(HttpListener.java:102)
at winstone.HttpListener.run(HttpListener.java:116)
at java.lang.Thread.run(Unknown Source)
[Winstone 2012/11/22 15:48:00] - HTTP Listener shutdown successfully
[Winstone 2012/11/22 15:48:00] - AJP13 Listener started: port=8009
The error tells you why:
Error during HTTP listener init or shutdown
java.net.BindException: Address already in use: JVM_Bind
The port the application tries to bind to, is already in use by another application. Change the port or shutdown the other application.
java.net.BindException: Address already in use: JVM_Bind... Seems you have something that is already listening on the port you have specified. You have to check what is using it (especially if it's a standard one like 80 or 443).

Resources