These are chat archives for spring-cloud/spring-cloud

24th
Oct 2016
Stevo Slavić
@sslavic
Oct 24 2016 15:51
hello
zuul client changed http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html#_zuul_http_client
is it configurable with same read timeout and connection timeout settings?
that is with RIBBON_READTIMEOUT and RIBBON_CONNECTTIMEOUT env vars
Heiko Scherrer
@openwms
Oct 24 2016 16:38
Hi. Whats best practise with handling encrypt.key-store.password and encrypt.key-store.secret ? I put the store.password into the yml/properties configuration file and don't do that for the secret. The secret I pass as cloud environment variable or as command line parameter locally - to keep it somehow secret. What's your approach?
Spencer Gibb
@spencergibb
Oct 24 2016 17:25
@sslavic yes should be
@openwms yes, env vars
Heiko Scherrer
@openwms
Oct 24 2016 17:26
@spencergibb thank you!
suren343
@suren343
Oct 24 2016 20:05
hey, in spring cloud Peer Awareness, whether Peer-1 and Peer-2 to be on same server (diff ports) to reflect other's status?
Spencer Gibb
@spencergibb
Oct 24 2016 20:06
Sorry, I don’t understand the question.
Dean Poulin
@DeanPoulin
Oct 24 2016 22:41
I'm working on securing a Spring Boot web app with OAuth2. The service is hosting a Spring MVC app. However, as soon as I add the annotation @EnableOAuth2Sso @EnableWebMvc and when I make a request to the web app, I'm getting this exception:
2016-10-24 18:39:17.137 ERROR 4895 --- [nio-8085-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.oauth2ClientContext': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:355) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35) ~[spring-aop-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:192) ~[spring-aop-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at com.sun.proxy.$Proxy78.getAccessToken(Unknown Source) ~[na:na]
    at org.springframework.security.oauth2.client.OAuth2RestTemplate.getAccessToken(OAuth2RestTemplate.java:169) ~[spring-security-oauth2-2.0.11.RELEASE.jar:na]
    at org.springframework.security.oauth2.client.filter.OAuth2ClientAuthenticationProcessingFilter.attemptAuthentication(OAuth2ClientAuthenticationProcessingFilter.java:105) ~[spring-security-oauth2-2.0.11.RELEASE.jar:na]
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:121) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:100) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
    at org.springframework.security.
It seems like @EnableWebMvc and @EnableOAuth2Sso don't play well together. Is there some way I can make them play together nicely with custom config?
Dean Poulin
@DeanPoulin
Oct 24 2016 23:00
007bond007
@007bond007_twitter
Oct 24 2016 23:26
@mbogoevici @ilayaperumalg Are there any working examples that you can point me to of using Spring Cloud Streams and schema registries? I've been pushing on this for quite a while now, and coming up empty. I think I am close, but it seems like the behavior I would expect (when I send a payload out, the schema would be fetched from the registry and associated with it, maybe just tacking on a contentType with the appropriate application/vnd.... MIME type). The docs suggest that this is doable, but just aren't providing illumination (to me at least) how to accomplish this task. Also, as a fallback, I am trying to use the Confluent schema registry, but again, the docs don't tell me how to do this, only that it can be done. Creating a bean of type SchemaRegistryClient that returns a ConfluentSchemaRegistryClient instance does not help as it gets invoked much too late in the process to be the one that that is actually used instead of the "default" one.
Marius Bogoevici
@mbogoevici
Oct 24 2016 23:28
@007bond007_twitter We don’t have a complete example, but it should be fairly simple. The closest thing we have to an example right now is the test: https://github.com/spring-cloud/spring-cloud-stream/blob/master/spring-cloud-stream-schema/src/test/java/org/springframework/cloud/schema/avro/AvroSchemaRegistryClientMessageConverterTests.java#L125
you need a running Schema Registry server and the rest is just a matter of adding the client and configuring the input/output binding
007bond007
@007bond007_twitter
Oct 24 2016 23:30
I've got both Confluent and the Spring Cloud Streams servers running (or have had, during testing). Let me look at the code you suggested and see if that sheds some light on the path to winningness :)
Marius Bogoevici
@mbogoevici
Oct 24 2016 23:31
We can try adding an example - shouldn’t be very complicated
if you can push something that you tried and open a github issue, we can probably help - and figure out what needs to be added to the doc
007bond007
@007bond007_twitter
Oct 24 2016 23:32
It would be greatly appreciated. This is quite powerful stuff as I learned at S1P this year, and really want to start leveraging it.
Marius Bogoevici
@mbogoevici
Oct 24 2016 23:34
thanks for the interest :)
007bond007
@007bond007_twitter
Oct 24 2016 23:36
Ok -- if I continue to get stuck, I will strip down my example so it's publishable and push it up. I'm presuming you only need the "sender" (Source) app since that's where the failure is happening? I note in your test example you had the dynamicSchemaGenerationEnabled set to true; when I did this, I got an NPE even though the response was a 200, the code was expecting "id" in the body, but the body was empty -- almost like the code was expecting a different "protocol" on response to registering than it was getting, if that makes sense? Does the default SCSt registry server not yield "id" in the body perhaps on successful registry (I know Confluent hands back JSON content with "id" set)
BTW, thanks for the responses and thanks for building this capability!
Marius Bogoevici
@mbogoevici
Oct 24 2016 23:38
yes, dynamicSchemaGenerationEnabled allows to generate/publish schema from the sender
but the default (our) schema registry client should send back proper responses
007bond007
@007bond007_twitter
Oct 24 2016 23:39
Ok -- let me dig some more with dynamic on and see if I can track down where it's going off the rails
BTW, this is Groovy code - I really don't think that should make a difference, but just in case I thought I should disclose that
Marius Bogoevici
@mbogoevici
Oct 24 2016 23:40
we’ll see :)
Marius Bogoevici
@mbogoevici
Oct 24 2016 23:45
on the schema POST from the client the server responds with a 200 OK and a Schema payload
007bond007
@007bond007_twitter
Oct 24 2016 23:59
I think part of my issue is that I'm wanting to use the Confluent schema registry, and that's what I have schemaRegistryClient.endpoint pointing at, but I am unable to tell SCSt to use the Confluent schema registry client instance.