gpt4 book ai didi

spring - Websphere 应用程序服务器 - Spring MVC - java.lang.NoSuchMethodError : org/codehaus/jackson/map/type/TypeFactory. 类型

转载 作者:行者123 更新时间:2023-12-02 02:00:00 25 4
gpt4 key购买 nike

由于客户端限制,我正在使用 WAS 8.0 来部署 Spring MVC 应用程序。我有一些 Controller 定义了一个微型网络服务。

我尝试部署在一些常见的服务器上,它运行正常,但是当我尝试部署到 WAS 时,情况是这样的:

  • 我可以使用 GET 服务,而不依赖于获取的元素。
  • 我可以用 XML 呈现 GET 调用。
  • 我可以使用 jackson 注释在 JSON 中呈现 GET 调用。

但是当我尝试使用一些 POST 调用时,应用程序抛出此错误(从 WAS JVM System Out 获取):

0000002c webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[myApp]: java.lang.NoSuchMethodError: org/codehaus/jackson/map/type/TypeFactory.type(Ljava/lang/reflect/Type;Lorg/codehaus/jackson/type/JavaType;)Lorg/codehaus/jackson/type/JavaType;
at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.getJavaType(MappingJacksonHttpMessageConverter.java:219)
at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.canRead(MappingJacksonHttpMessageConverter.java:134)
at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:130)
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:180)
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:95)
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:77)
at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:123)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1225)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:775)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:457)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3763)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:975)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:277)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:166)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1691)

在 org.codehaus.jackson.mapper 库的最新版本中,错误引用的函数已被弃用。因此,我尝试从库的 1.0 版切换到 1.9.12 版,并在每次更改时清洁部署它(以避免类版本冲突)。

谷歌搜索后,我发现一个帖子说它一定是类加载器问题,所以我在 WAS 中选择 PARENT_LAST 配置。但什么也没发生。

我现在不明白里面发生了什么。日志中没有更多信息。

编辑>>> 我忘记附加与 HTTP 调用关联的 Controller 函数

@RequestMapping(method = RequestMethod.POST)
@ResponseBody
public Map<String, String> addIncidence(@RequestBody Incidence incidence) {
incidenceService.addIncidence(incidence);

Map<String, String> response = new HashMap<String, String>();

response.put("token", incidence.getToken().toString());
response.put("service_request_id",
incidence.getServiceRequestIdString());
response.put("service_notice", "some text from server");
response.put("account_id", null);

return response;
}

提前致谢。

最佳答案

WebSphere 8.0 随 Jackson 1.5(或 1.6)开箱即用(它被重新打包,您必须展开它以检查版本的 META-INF)。因此,如果您希望在 1.5(或 1.6)之后引入功能,则需要反转类加载顺序。正如 fnt 上面评论的那样,如果您要这样部署,请确保在 EAR 和 WAR 级别更改顺序。

关于spring - Websphere 应用程序服务器 - Spring MVC - java.lang.NoSuchMethodError : org/codehaus/jackson/map/type/TypeFactory. 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17718554/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com