SpringCloud使用中的一下注意事项与问题

jonathan
2018-03-17 / 0 评论

Spring Cloud Config 配置的坑

动态配置时,在配置中心修改zuul的 service id ,修改后将无法访问

kafka整合zipkin笔记

参考:https://github.com/niemingming/springcloud-sleuth-kafka-zipkin/tree/71404c9cd1e3f4b7c6ae8dee80ffca31652b03a9

如果使用actuator就无法访问端口spring-boot-starter-actuator

o.s.k.support.LoggingProducerListener : Exception thrown when sending a message with key='null' and payload='{-1, 4, 11, 99, 111, 110, 116, 101, 110, 116, 84, 121, 112, 101, 0, 0, 0, 78, 34, 97, 112, 112, 108,...' to topic sleuth:

忘记设置

sleuth:
 enabled: false

搭建zipkin整合kafka碰到的问题

一个奇怪的issue:

如果application.yml里面配置logging相关的配置,则sleuth无法启动

http://takeip.com/spring-cloud-stream-app-starter-fails-after-10-secs-saying-binderexception-cannot-initialize-binder.html解决方案

如果程序启动到Kafka commitId : f10ef2720b03b247

过一段时间报

Cannot initialize Binder

org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is org.springframework.cloud.stream.binder.BinderException: Cannot initialize binder:

需要修改kafka的配置

server.properties

listeners=PLAINTEXT://localhost:9092

一般因为没有监听对应的ip

UserRedirectRequiredException: A redirect is required to get the users approval 在spring mvc下无法跳转到统一认证页报错

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.security.oauth2.client.resource.UserRedirectRequiredException: A redirect is required to get the users approval

j

解决方案:缺少两个Spring Security和Oauth2的过滤器:

oauth2ClientContextFilter

springSecurityFilterChain


   public void onStartup(ServletContext container) throws ServletException {

    AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();

   ctx.register(HelloWorldConfiguration.class);

   ctx.setServletContext(container);

   ServletRegistration.Dynamic servlet = container.addServlet(

       "dispatcher", new DispatcherServlet(ctx));

   servlet.setLoadOnStartup(1);

   servlet.addMapping("/");

//  registerProxyFilter(container, "springSecurityFilterChain");

//  registerProxyFilter(container, "oauth2ClientContextFilter");

  }

   private void registerProxyFilter(ServletContext servletContext, String name) {

    DelegatingFilterProxy filter = new DelegatingFilterProxy(name);

   filter.setContextAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcher");

   servletContext.addFilter(name, filter).addMappingForUrlPatterns(null, false, "/*");

  }

评论

博主关闭了当前页面的评论