分布式部署,Net客户端一直报500错误
查看日志发现这个错误: ERROR 8232 --- [http-nio-8060-exec-9] o.a.c.c.C.[.[.[/].[dispatcherServlet]
: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
把报错的URL在浏览器打开看下具体的返回信息?
再看下服务端是否还有更多报错信息?
apollo 1.1.0升级到spring 5以后有兼容问题。
问题
-
.net client中的
HttpUtil.cs中在请求时添加了req.Headers["Authorization"] = basicAuth;#重现方法 curl -v -H 'Authorization:Basic dXNlcjo=' http://127.0.0.1:8080/services/config?appId=test&ip=169.254.4.98 -
在Spring Security 5.0之前,
PasswordEncoder的默认值为NoOpPasswordEncoder既表示为纯文本密码,在 Spring Security 5.0.x 以后去除默认值;spring官方说明 -
apollo-configservice的报错信息
2018-10-29 10:21:53.314 ERROR 12959 --- [http-nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exc
eption
java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null"
at
org.springframework.security.crypto.password.DelegatingPasswordEncoder$UnmappedIdPasswordEncoder.matches(DelegatingPasswordEncoder.java:238)
at
org.springframework.security.crypto.password.DelegatingPasswordEncoder.matches(DelegatingPasswordEncoder.java:198)
at
org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration$LazyPasswordEncoder.matches(AuthenticationConfiguration.java:289)
at
org.springframework.security.authentication.dao.DaoAuthenticationProvider.additionalAuthenticationChecks(DaoAuthenticationProvider.java:86)
解决方法
在apollo-configservice的ConfigServiceAutoConfiguration中添加
@Bean
public static NoOpPasswordEncoder passwordEncoder() {
return (NoOpPasswordEncoder) NoOpPasswordEncoder.getInstance();
}
非常感谢!方便提交一个PR吗?
啥时候打包发布新的?
@kaobeixingfu @zzyykk123456 @birdie7761 1.1.2版本已经release,包含了该问题修复,详见 https://github.com/ctripcorp/apollo/releases