{"action":"closed","issue":{"url":"https://api.github.com/repos/mstine/springbox-cloud/issues/7","labels_url":"https://api.github.com/repos/mstine/springbox-cloud/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/mstine/springbox-cloud/issues/7/comments","events_url":"https://api.github.com/repos/mstine/springbox-cloud/issues/7/events","html_url":"https://github.com/mstine/springbox-cloud/issues/7","id":71953050,"number":7,"title":"Hystrix errors with spring singleton beans","user":{"login":"viniciusccarvalho","id":803893,"avatar_url":"https://avatars.githubusercontent.com/u/803893?v=3","gravatar_id":"","url":"https://api.github.com/users/viniciusccarvalho","html_url":"https://github.com/viniciusccarvalho","followers_url":"https://api.github.com/users/viniciusccarvalho/followers","following_url":"https://api.github.com/users/viniciusccarvalho/following{/other_user}","gists_url":"https://api.github.com/users/viniciusccarvalho/gists{/gist_id}","starred_url":"https://api.github.com/users/viniciusccarvalho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viniciusccarvalho/subscriptions","organizations_url":"https://api.github.com/users/viniciusccarvalho/orgs","repos_url":"https://api.github.com/users/viniciusccarvalho/repos","events_url":"https://api.github.com/users/viniciusccarvalho/events{/privacy}","received_events_url":"https://api.github.com/users/viniciusccarvalho/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"viniciusccarvalho","id":803893,"avatar_url":"https://avatars.githubusercontent.com/u/803893?v=3","gravatar_id":"","url":"https://api.github.com/users/viniciusccarvalho","html_url":"https://github.com/viniciusccarvalho","followers_url":"https://api.github.com/users/viniciusccarvalho/followers","following_url":"https://api.github.com/users/viniciusccarvalho/following{/other_user}","gists_url":"https://api.github.com/users/viniciusccarvalho/gists{/gist_id}","starred_url":"https://api.github.com/users/viniciusccarvalho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viniciusccarvalho/subscriptions","organizations_url":"https://api.github.com/users/viniciusccarvalho/orgs","repos_url":"https://api.github.com/users/viniciusccarvalho/repos","events_url":"https://api.github.com/users/viniciusccarvalho/events{/privacy}","received_events_url":"https://api.github.com/users/viniciusccarvalho/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-04-29T18:33:33Z","updated_at":"2015-04-30T13:00:16Z","closed_at":"2015-04-30T13:00:16Z","body":"Seems that some Oauth beans need to run on the same thread that the caller, this lead to errors bellow. Because methods are ran inside hystrix commands, we don't have access to the original thread.\r\n\r\nNeed to investigate further:\r\n\r\nError 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\r\n\r\njava.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.\r\n\r\n0 = {java.lang.StackTraceElement@11409} \"org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:352)\"\r\n1 = {java.lang.StackTraceElement@11410} \"org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)\"\r\n2 = {java.lang.StackTraceElement@11411} \"org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)\"\r\n3 = {java.lang.StackTraceElement@11412} \"org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:187)\"\r\n4 = {java.lang.StackTraceElement@11413} \"com.sun.proxy.$Proxy90.getAccessToken(Unknown Source)\"\r\n5 = {java.lang.StackTraceElement@11414} \"org.springframework.security.oauth2.client.OAuth2RestTemplate.doExecute(OAuth2RestTemplate.java:125)\"\r\n6 = {java.lang.StackTraceElement@11415} \"org.springframework.web.client.RestTemplate.execute(RestTemplate.java:530)\"\r\n7 = {java.lang.StackTraceElement@11416} \"org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:476)\"\r\n8 = {java.lang.StackTraceElement@11417} \"io.springbox.apigateway.services.reviews.ReviewsIntegrationService$1.invoke(ReviewsIntegrationService.java:28)\"\r\n9 = {java.lang.StackTraceElement@11418} \"sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\"\r\n10 = {java.lang.StackTraceElement@11419} \"sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\"\r\n11 = {java.lang.StackTraceElement@11420} \"sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\"\r\n12 = {java.lang.StackTraceElement@11421} \"java.lang.reflect.Method.invoke(Method.java:483)\"\r\n13 = {java.lang.StackTraceElement@11422} \"com.netflix.hystrix.contrib.javanica.command.MethodExecutionAction.execute(MethodExecutionAction.java:101)\"\r\n14 = {java.lang.StackTraceElement@11423} \"com.netflix.hystrix.contrib.javanica.command.MethodExecutionAction.executeWithArgs(MethodExecutionAction.java:80)\"\r\n15 = {java.lang.StackTraceElement@11424} \"com.netflix.hystrix.contrib.javanica.command.MethodExecutionAction.execute(MethodExecutionAction.java:66)\"\r\n16 = {java.lang.StackTraceElement@11425} \"com.netflix.hystrix.contrib.javanica.command.GenericCommand$1.execute(GenericCommand.java:45)\"\r\n17 = {java.lang.StackTraceElement@11426} \"com.netflix.hystrix.contrib.javanica.command.AbstractHystrixCommand.process(AbstractHystrixCommand.java:161)\"\r\n18 = {java.lang.StackTraceElement@11427} \"com.netflix.hystrix.contrib.javanica.command.GenericCommand.run(GenericCommand.java:42)\"\r\n19 = {java.lang.StackTraceElement@11428} \"com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:294)\"\r\n20 = {java.lang.StackTraceElement@11429} \"com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:289)\"\r\n21 = {java.lang.StackTraceElement@11430} \"rx.Observable$1.call(Observable.java:144)\"\r\n22 = {java.lang.StackTraceElement@11431} \"rx.Observable$1.call(Observable.java:136)\"\r\n23 = {java.lang.StackTraceElement@11432} \"rx.Observable$1.call(Observable.java:144)\"\r\n24 = {java.lang.StackTraceElement@11433} \"rx.Observable$1.call(Observable.java:136)\"\r\n25 = {java.lang.StackTraceElement@11434} \"rx.Observable$1.call(Observable.java:144)\"\r\n26 = {java.lang.StackTraceElement@11435} \"rx.Observable$1.call(Observable.java:136)\"\r\n27 = {java.lang.StackTraceElement@11436} \"rx.Observable.unsafeSubscribe(Observable.java:7466)\"\r\n28 = {java.lang.StackTraceElement@11437} \"com.netflix.hystrix.AbstractCommand$5.call(AbstractCommand.java:518)\"\r\n29 = {java.lang.StackTraceElement@11438} \"com.netflix.hystrix.AbstractCommand$5.call(AbstractCommand.java:501)\"\r\n30 = {java.lang.StackTraceElement@11439} \"rx.Observable.unsafeSubscribe(Observable.java:7466)\"\r\n31 = {java.lang.StackTraceElement@11440} \"rx.internal.operators.OperatorSubscribeOn$1$1.call(OperatorSubscribeOn.java:62)\"\r\n32 = {java.lang.StackTraceElement@11441} \"com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)\"\r\n33 = {java.lang.StackTraceElement@11442} \"com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)\"\r\n34 = {java.lang.StackTraceElement@11443} \"com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)\"\r\n35 = {java.lang.StackTraceElement@11444} \"rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:47)\"\r\n36 = {java.lang.StackTraceElement@11445} \"java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\"\r\n37 = {java.lang.StackTraceElement@11446} \"java.util.concurrent.FutureTask.run(FutureTask.java:266)\"\r\n38 = {java.lang.StackTraceElement@11447} \"java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\"\r\n39 = {java.lang.StackTraceElement@11448} \"java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\"\r\n40 = {java.lang.StackTraceElement@11449} \"java.lang.Thread.run(Thread.java:745)\""}}