当前位置: 首页 > 知识库问答 >
问题:

Spring Data Rest 2.0.0.release中断了以前使用RC1的代码

管峻
2023-03-14

我有一个使用Spring Data REST的项目。我的pom.xml中最初有2.0.0.build-snapshot,但在上次更新期间,代码出现故障,在访问大多数endpoint时开始抛出以下IllegalStateException:

java.lang.IllegalStateException: No suitable resolver for argument [0]
[type=org.springframework.http.converter.HttpMessageNotReadableException]
HandlerMethod details: 
Controller [org.springframework.data.rest.webmvc.RepositoryEntityController]
Method [public org.springframework.http.ResponseEntity<org.springframework.data.rest.webmvc.support.ExceptionMessage> org.springframework.data.rest.webmvc.AbstractRepositoryRestController.handleNotReadable(org.springframework.http.converter.HttpMessageNotReadableException)]

at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:169)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:124)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver.doResolveHandlerMethodException(ExceptionHandlerExceptionResolver.java:340)
at org.springframework.web.servlet.handler.AbstractHandlerMethodExceptionResolver.doResolveException(AbstractHandlerMethodExceptionResolver.java:60)
at org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver.resolveException(AbstractHandlerExceptionResolver.java:138)
at org.springframework.web.servlet.handler.HandlerExceptionResolverComposite.resolveException(HandlerExceptionResolverComposite.java:75)
at org.springframework.web.servlet.DispatcherServlet.processHandlerException(DispatcherServlet.java:1164)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilter(WebRequestTraceFilter.java:114)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextFilterConfiguration$1.doFilterInternal(EndpointWebMvcAutoConfiguration.java:128)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration$MetricsFilter.doFilterInternal(MetricFilterAutoConfiguration.java:84)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:680)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1721)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1679)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

则Spring Boot Actuate将记录以下错误:

2014-02-28 07:58:54.986错误9232---[nio-8080-exec-6]O.S.B.Actuate.web.BasicErrorController:org.SpringFramework.http.Converter.HttpMessageNotWritableException:无法写入JSON:(was java.lang.NullPointerException)(通过引用链:org.SpringFramework.HateOas.Resource[“Content”]);嵌套异常为com.fasterxml.jackson.databind.JSONMappingException:(was java.lang.NullPointerException)(通过引用链:org.springframework.hateoas.resource[“content”])

如果我修改pom.xml以使用SDR版本2.0.0.rc1,那么一切似乎都能按预期工作。

我想解决这个问题,因为我一直在等待的最新版本中包含了bug修复,但这个问题阻止了我升级。有解决办法吗?从stacktrace中甚至很难看出问题出在哪里,但仅根据时间,我认为这个问题可能与这个提交有关:

https://github.com/spring-projects/spring-data-rest/commit/3E5914D84F9708015B36A8840A25E9FA10A7F6AE

根据要求,依赖关系如下:

spring-data-rest-webmvc 2.0.0.release

spring-boot-starter-web 1.0.0.build-snapshot

Spring-Boot-Starter-Actutor 1.0.0.Build-Snapshot

spring-boot-starter-shell-remote 1.0.0.build-snapshot

spring-boot-starter-tomcat[提供]

spring-boot-starter-test 1.0.0.build-snapshot

共有1个答案

太叔繁
2023-03-14

这是一个已知并已修复的bug,基本上掩盖了我们这边的Jackson序列化问题。该修复程序已经在2.0.1版本和2.1M1版本中,并将在其中执行。

请随意试一试快照。

 类似资料:
  • 0.15.3 版本 到 1.0.0 版本的变化 建议使用 0.28.0 版本的 Mesos 重大修改 任务发布中新的默认设置 Marathon 做了很多设置调整。我们的目标是,让默认值对于中小型集群来说更加合理。 我们意识到,一些默认值可能并不适合一些小规模的场景,所以我们修改了这些值: --launch_tokens 从1000修改为100 --max_tasks_per_offer 从100修

  • 我一直试图使用一个简单的密钥创建和签名JwtSecurityToken。经过大量研究,我发现的所有示例似乎都使用InMemorySymmetricSecurityKey类,但不幸的是,这个类似乎不存在于最新版本的System.IdentityModel库中。 这是我第一次使用JwtSecurityToken,所以我猜我可能在某个地方漏掉了一个步骤

  • 我的项目中当前有以下代码: 后端: 前端: 当我启动本地主机并导航到/login路由时,我的终端中出现一个错误,该错误有以下消息: 我很困惑是什么正在发生,因为我有它以前的工作,我没有改变任何东西,因为它是上次工作。如果有人知道发生了什么,我很乐意知道。 谢谢!

  • 使用git-1.8.5时,使用maven release插件(使用版本2.4.2和2.3.2测试)和mvn(使用版本3.1.1和3.0.5测试),运行mvn release:prepare和mvn release:prepare with pom失败。 mvn release:prepare无法创建它应该创建的提交: [maven-Relase-plugin]为下一次开发迭代做准备 [maven-

  • 问题内容: 我不确定这是什么错误! 我没有双值字段或数据! 我浪费了整整一个小时试图解决这个问题! 这是我的查询 这是我要显示结果的表的show create表 问题答案: 此消息表示您正在尝试比较or 子句中的数字和字符串。在您的查询中,唯一可能发生的地方是;。确保它们具有相似的声明,或使用显式将数字转换为字符串。 如果关闭模式,则错误应变为警告。

  • 问题内容: 我正在尝试在VisualStudio代码中调试摩卡单元测试。我遵循了这个问题,并得到了以下运行配置: 有用。但这并不会在断点处停止!如果我使用正常的启动配置运行文件,则不会忽略断点。 任何想法可能是什么原因吗? 问题答案: 这对我有效,您需要指向。使用just 不允许附加断点。