wurstmeister / kafka-docker

Dockerfile for Apache Kafka
http://wurstmeister.github.io/kafka-docker/
Apache License 2.0
6.94k stars 2.73k forks source link

"Read timed out" error when trying send message through Producer #254

Closed pavankjadda closed 6 years ago

pavankjadda commented 6 years ago

I have one microservice and gateway generated through JHipster. And setup Kafka along with jhipster micro service configuration process. After this I generated docker-compose files through jhipster docker-compose command. Then, started microservices with docker-compose up. When I tried save the object in microservice, the producer should send an object to broker. But I got following error. I am suspecting this as timeout error and tried to change following properties in code, it didn't work

  //Set acknowledgements for producer requests.      
          props.put("acks", "all");

          props.put("request.timeout.ms", 30000);

          //If the request fails, the producer can automatically retry,
          props.put("retries", 3);

          //Specify buffer size in config
          //props.put("batch.size", 16384);
          props.put("batch.size", 0);

Error:

gateway-app_1        | 2018-01-25 21:28:06.315  WARN 7 --- [nfoReplicator-0] o.a.k.clients.consumer.ConsumerConfig    : The configuration 'key.serializer' was supplied but isn't a known config.
gateway-app_1        | 2018-01-25 21:28:08.504  WARN 7 --- [ XNIO-2 task-23] o.s.c.n.z.filters.post.SendErrorFilter   : Error during filtering
gateway-app_1        | 
gateway-app_1        | com.netflix.zuul.exception.ZuulException: Forwarding error
gateway-app_1        |  at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.handleException(RibbonRoutingFilter.java:188)
gateway-app_1        |  at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:163)
gateway-app_1        |  at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:111)
gateway-app_1        |  at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112)
gateway-app_1        |  at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:193)
gateway-app_1        |  at com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:157)
gateway-app_1        |  at com.netflix.zuul.FilterProcessor.route(FilterProcessor.java:118)
gateway-app_1        |  at com.netflix.zuul.ZuulRunner.route(ZuulRunner.java:96)
gateway-app_1        |  at com.netflix.zuul.http.ZuulServlet.route(ZuulServlet.java:116)
gateway-app_1        |  at com.netflix.zuul.http.ZuulServlet.service(ZuulServlet.java:81)
gateway-app_1        |  at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:157)
gateway-app_1        |  at org.springframework.cloud.netflix.zuul.web.ZuulController.handleRequest(ZuulController.java:44)
gateway-app_1        |  at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50)
gateway-app_1        |  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
gateway-app_1        |  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
gateway-app_1        |  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
gateway-app_1        |  at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:883)
gateway-app_1        |  at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
gateway-app_1        |  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
gateway-app_1        |  at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
gateway-app_1        |  at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
gateway-app_1        |  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
gateway-app_1        |  at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:111)
gateway-app_1        |  at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
gateway-app_1        |  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
gateway-app_1        |  at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
gateway-app_1        |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
gateway-app_1        |  at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
gateway-app_1        |  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
gateway-app_1        |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
gateway-app_1        |  at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
gateway-app_1        |  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
gateway-app_1        |  at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:110)
gateway-app_1        |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
gateway-app_1        |  at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
gateway-app_1        |  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
gateway-app_1        |  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
gateway-app_1        |  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
gateway-app_1        |  at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
gateway-app_1        |  at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
gateway-app_1        |  at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
gateway-app_1        |  at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
gateway-app_1        |  at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
gateway-app_1        |  at com.gateway.security.jwt.JWTFilter.doFilter(JWTFilter.java:36)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
gateway-app_1        |  at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
gateway-app_1        |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
gateway-app_1        |  at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
gateway-app_1        |  at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
gateway-app_1        |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
gateway-app_1        |  at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
gateway-app_1        |  at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
gateway-app_1        |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
gateway-app_1        |  at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
gateway-app_1        |  at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:347)
gateway-app_1        |  at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:263)
gateway-app_1        |  at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
gateway-app_1        |  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
gateway-app_1        |  at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
gateway-app_1        |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
gateway-app_1        |  at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
gateway-app_1        |  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
gateway-app_1        |  at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)
gateway-app_1        |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
gateway-app_1        |  at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
gateway-app_1        |  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
gateway-app_1        |  at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
gateway-app_1        |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
gateway-app_1        |  at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
gateway-app_1        |  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
gateway-app_1        |  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
gateway-app_1        |  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
gateway-app_1        |  at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
gateway-app_1        |  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
gateway-app_1        |  at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
gateway-app_1        |  at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
gateway-app_1        |  at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:64)
gateway-app_1        |  at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
gateway-app_1        |  at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
gateway-app_1        |  at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
gateway-app_1        |  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
gateway-app_1        |  at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
gateway-app_1        |  at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
gateway-app_1        |  at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
gateway-app_1        |  at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
gateway-app_1        |  at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
gateway-app_1        |  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
gateway-app_1        |  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
gateway-app_1        |  at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
gateway-app_1        |  at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
gateway-app_1        |  at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
gateway-app_1        |  at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
gateway-app_1        |  at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
gateway-app_1        |  at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
gateway-app_1        |  at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
gateway-app_1        |  at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
gateway-app_1        |  at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
gateway-app_1        |  at io.undertow.server.Connectors.executeRootHandler(Connectors.java:332)
gateway-app_1        |  at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
gateway-app_1        |  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
gateway-app_1        |  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
gateway-app_1        |  at java.lang.Thread.run(Thread.java:748)
gateway-app_1        | Caused by: com.netflix.client.ClientException: null
gateway-app_1        |  at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:123)
gateway-app_1        |  at org.springframework.cloud.netflix.zuul.filters.route.support.AbstractRibbonCommand.run(AbstractRibbonCommand.java:105)
gateway-app_1        |  at org.springframework.cloud.netflix.zuul.filters.route.support.AbstractRibbonCommand.run(AbstractRibbonCommand.java:43)
gateway-app_1        |  at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)
gateway-app_1        |  at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
gateway-app_1        |  at rx.Observable.unsafeSubscribe(Observable.java:10211)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
gateway-app_1        |  at rx.Observable.unsafeSubscribe(Observable.java:10211)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
gateway-app_1        |  at rx.Observable.unsafeSubscribe(Observable.java:10211)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
gateway-app_1        |  at rx.Observable.unsafeSubscribe(Observable.java:10211)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
gateway-app_1        |  at rx.Observable.unsafeSubscribe(Observable.java:10211)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
gateway-app_1        |  at rx.Observable.unsafeSubscribe(Observable.java:10211)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
gateway-app_1        |  at rx.Observable.unsafeSubscribe(Observable.java:10211)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
gateway-app_1        |  at rx.Observable.unsafeSubscribe(Observable.java:10211)
gateway-app_1        |  at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
gateway-app_1        |  at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
gateway-app_1        |  at rx.Observable.unsafeSubscribe(Observable.java:10211)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
gateway-app_1        |  at rx.Observable.unsafeSubscribe(Observable.java:10211)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
gateway-app_1        |  at rx.Observable.unsafeSubscribe(Observable.java:10211)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)
gateway-app_1        |  at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
gateway-app_1        |  at rx.Observable.subscribe(Observable.java:10307)
gateway-app_1        |  at rx.Observable.subscribe(Observable.java:10274)
gateway-app_1        |  at rx.internal.operators.BlockingOperatorToFuture.toFuture(BlockingOperatorToFuture.java:51)
gateway-app_1        |  at rx.observables.BlockingObservable.toFuture(BlockingObservable.java:412)
gateway-app_1        |  at com.netflix.hystrix.HystrixCommand.queue(HystrixCommand.java:378)
gateway-app_1        |  at com.netflix.hystrix.HystrixCommand.execute(HystrixCommand.java:344)
gateway-app_1        |  at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:157)
gateway-app_1        |  ... 113 common frames omitted
gateway-app_1        | Caused by: java.lang.RuntimeException: java.net.SocketTimeoutException: Read timed out
gateway-app_1        |  at rx.exceptions.Exceptions.propagate(Exceptions.java:58)
gateway-app_1        |  at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:465)
gateway-app_1        |  at rx.observables.BlockingObservable.single(BlockingObservable.java:342)
gateway-app_1        |  at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:117)
gateway-app_1        |  ... 175 common frames omitted
gateway-app_1        | Caused by: java.net.SocketTimeoutException: Read timed out
gateway-app_1        |  at java.net.SocketInputStream.socketRead0(Native Method)
gateway-app_1        |  at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
gateway-app_1        |  at java.net.SocketInputStream.read(SocketInputStream.java:171)
gateway-app_1        |  at java.net.SocketInputStream.read(SocketInputStream.java:141)
gateway-app_1        |  at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
gateway-app_1        |  at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
gateway-app_1        |  at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:282)
gateway-app_1        |  at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
gateway-app_1        |  at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
gateway-app_1        |  at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
gateway-app_1        |  at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
gateway-app_1        |  at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)
gateway-app_1        |  at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
gateway-app_1        |  at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
gateway-app_1        |  at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
gateway-app_1        |  at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
gateway-app_1        |  at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
gateway-app_1        |  at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
gateway-app_1        |  at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
gateway-app_1        |  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
gateway-app_1        |  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
gateway-app_1        |  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
gateway-app_1        |  at org.springframework.cloud.netflix.ribbon.apache.RetryableRibbonLoadBalancingHttpClient$1.doWithRetry(RetryableRibbonLoadBalancingHttpClient.java:93)
gateway-app_1        |  at org.springframework.cloud.netflix.ribbon.apache.RetryableRibbonLoadBalancingHttpClient$1.doWithRetry(RetryableRibbonLoadBalancingHttpClient.java:71)
gateway-app_1        |  at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287)
gateway-app_1        |  at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:164)
gateway-app_1        |  at org.springframework.cloud.netflix.ribbon.apache.RetryableRibbonLoadBalancingHttpClient.executeWithRetry(RetryableRibbonLoadBalancingHttpClient.java:113)
gateway-app_1        |  at org.springframework.cloud.netflix.ribbon.apache.RetryableRibbonLoadBalancingHttpClient.execute(RetryableRibbonLoadBalancingHttpClient.java:104)
gateway-app_1        |  at org.springframework.cloud.netflix.ribbon.apache.RetryableRibbonLoadBalancingHttpClient.execute(RetryableRibbonLoadBalancingHttpClient.java:50)
gateway-app_1        |  at com.netflix.client.AbstractLoadBalancerAwareClient$1.call(AbstractLoadBalancerAwareClient.java:109)
gateway-app_1        |  at com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:303)
gateway-app_1        |  at com.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:287)
gateway-app_1        |  at rx.internal.util.ScalarSynchronousObservable$3.call(ScalarSynchronousObservable.java:231)
gateway-app_1        |  at rx.internal.util.ScalarSynchronousObservable$3.call(ScalarSynchronousObservable.java:228)
gateway-app_1        |  at rx.Observable.unsafeSubscribe(Observable.java:10211)
gateway-app_1        |  at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.drain(OnSubscribeConcatMap.java:286)
gateway-app_1        |  at rx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.onNext(OnSubscribeConcatMap.java:144)
gateway-app_1        |  at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:185)
gateway-app_1        |  at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180)
gateway-app_1        |  at rx.Observable.unsafeSubscribe(Observable.java:10211)
gateway-app_1        |  at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94)
gateway-app_1        |  at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
gateway-app_1        |  at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
gateway-app_1        |  at rx.Observable.subscribe(Observable.java:10307)
gateway-app_1        |  at rx.Observable.subscribe(Observable.java:10274)
gateway-app_1        |  at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:445)
gateway-app_1        |  ... 177 common frames omitted
gateway-app_1        | 

docker-compose.yml

version: '2'
services:
    gateway-app:
        image: gateway
        environment:
            - SPRING_PROFILES_ACTIVE=prod,swagger
            - EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/eureka
            - SPRING_CLOUD_CONFIG_URI=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/config
            - SPRING_DATASOURCE_URL=jdbc:mysql://gateway-mysql:3306/gateway?useUnicode=true&characterEncoding=utf8&useSSL=false
            - JHIPSTER_SLEEP=30
            - SPRING_CLOUD_STREAM_KAFKA_BINDER_BROKERS=kafka
            - SPRING_CLOUD_STREAM_KAFKA_BINDER_ZK_NODES=zookeeper
            - JHIPSTER_REGISTRY_PASSWORD=admin
        ports:
            - 8080:8080
    gateway-mysql:
        image: mysql:5.7.20
        environment:
            - MYSQL_USER=root
            - MYSQL_ALLOW_EMPTY_PASSWORD=yes
            - MYSQL_DATABASE=gateway
        command:             mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8
            --explicit_defaults_for_timestamp

    projects-app:
        image: projects
        environment:
            - SPRING_PROFILES_ACTIVE=prod,swagger
            - EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/eureka
            - SPRING_CLOUD_CONFIG_URI=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/config
            - SPRING_DATASOURCE_URL=jdbc:mysql://projects-mysql:3306/projects?useUnicode=true&characterEncoding=utf8&useSSL=false
            - JHIPSTER_SLEEP=30
            - SPRING_CLOUD_STREAM_KAFKA_BINDER_BROKERS=kafka
            - SPRING_CLOUD_STREAM_KAFKA_BINDER_ZK_NODES=zookeeper
            - JHIPSTER_REGISTRY_PASSWORD=admin
    projects-mysql:
        image: mysql:5.7.20
        environment:
            - MYSQL_USER=root
            - MYSQL_ALLOW_EMPTY_PASSWORD=yes
            - MYSQL_DATABASE=projects
        command:             mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8
            --explicit_defaults_for_timestamp

    zookeeper:
        extends:
            file: kafka.yml
            service: zookeeper
    kafka:
        extends:
            file: kafka.yml
            service: kafka
    jhipster-registry:
        extends:
            file: jhipster-registry.yml
            service: jhipster-registry

kafka.yml


version: '2'
services:
    zookeeper:
        image: wurstmeister/zookeeper:3.4.6
    kafka:
        image: wurstmeister/kafka:1.0.0
        environment:
            KAFKA_ADVERTISED_HOST_NAME: localhost
            KAFKA_ADVERTISED_PORT: 9092
            KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
            KAFKA_CREATE_TOPICS: "project:1:1"
            KAFKA_AUTO_CREATE_TOPICS_ENABLE: true
        #ports:
            #- 9092:9092  # Uncomment to make Kafka available externally

application.yml

#common configuration shared between all applications
configserver:
    name: Docker JHipster Registry
    status: Connected to the JHipster Registry running in Docker

jhipster:
    security:
        authentication:
            jwt:
                secret: d7b995ff8a5e9d9565e71749bdb1075baabcc5d1

eureka:
    client:
        service-url:
            defaultZone: http://admin:${jhipster.registry.password}@jhipster-registry:8761/eureka/

My producer code looks similar to this

SimpleProducer.Java

package com.projects.web.messaging;

//import util.properties packages
import java.util.Properties;

//import simple producer packages
import org.apache.kafka.clients.producer.Producer;

//import KafkaProducer packages
import org.apache.kafka.clients.producer.KafkaProducer;

//import ProducerRecord packages
import org.apache.kafka.clients.producer.ProducerRecord;
import org.springframework.beans.factory.annotation.Configurable;

import com.projects.domain.Project;

//Create java class named “SimpleProducer”
@Configurable
public class SimpleProducer
{
    public  Producer<String, String> producer;
    public String topicName;

    public SimpleProducer()
    {
          //Assign topicName to string variable
          topicName = "project";

          // create instance for properties to access producer configs   
          Properties props = new Properties();

          //Assign localhost id
          props.put("bootstrap.servers", "localhost:9092");

          //Set acknowledgements for producer requests.      
          props.put("acks", "all");

          props.put("request.timeout.ms", 30000);

          //If the request fails, the producer can automatically retry,
          props.put("retries", 3);

          //Specify buffer size in config
          //props.put("batch.size", 16384);
          props.put("batch.size", 0);

          //Reduce the no of requests less than 0   
          props.put("linger.ms", 1);

          //The buffer.memory controls the total amount of memory available to the producer for buffering.   
          props.put("buffer.memory", 33554432);

          props.put("key.serializer","org.apache.kafka.common.serialization.StringSerializer");

          props.put("value.serializer","org.apache.kafka.common.serialization.StringSerializer");

          //Thread.currentThread().setContextClassLoader(null);
          producer = new KafkaProducer<String, String>(props);

    }

    public void send(Project project)
    {
         System.out.println("***************************************************************************************** Before Produce **********************************************************");
         //producer.send(new ProducerRecord<String, String>(topicName,"project", "Project Created"));
         producer.send(new ProducerRecord<String, String>(topicName,"Project Created"));
         producer.close();  
    }

}
pavankjadda commented 6 years ago

There were some mistakes in my configuration. I pushed updated code here.

padawanLearner commented 6 years ago

@pavankjadda What changes did you make to your configuration to fix it? I am also getting SocketTimeoutException using Docker compose.

pavankjadda commented 6 years ago

Compare above files to my latest commit