java.lang.NoSuchMethodError:jackson.databind.introspect.AnnotatedMember.getType

a1o7rhls  于 2023-10-14  发布在  Java
关注(0)|答案(2)|浏览(110)

访问本地计算机中的端点时出现错误:

错误提示:

org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-aaayush-mac-1697010426104-0-3]
    at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1842)
    at org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:389)
    at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:64)
    at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
    at org.apache.camel.component.jetty.CamelContinuationServlet.doService(CamelContinuationServlet.java:220)
    at org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:79)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
    at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1656)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:552)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:54)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.Server.handle(Server.java:516)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:555)
    at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:410)
    at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:164)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
    at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.introspect.AnnotatedMember.getType(Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
    at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:421)
    at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:199)
    at io.swagger.converter.ModelConverterContextImpl.resolve(ModelConverterContextImpl.java:103)
    at io.swagger.converter.ModelConverters.read(ModelConverters.java:76)
    at io.swagger.converter.ModelConverters.read(ModelConverters.java:67)
    at org.apache.camel.swagger.RestModelConverters.readClass(RestModelConverters.java:33)
    at org.apache.camel.swagger.RestSwaggerReader.appendModels(RestSwaggerReader.java:755)
    at org.apache.camel.swagger.RestSwaggerReader.parse(RestSwaggerReader.java:227)
    at org.apache.camel.swagger.RestSwaggerReader.read(RestSwaggerReader.java:113)
    at org.apache.camel.swagger.RestSwaggerSupport.renderResourceListing(RestSwaggerSupport.java:224)
    at org.apache.camel.swagger.RestSwaggerProcessor.process(RestSwaggerProcessor.java:119)
    at org.apache.camel.component.rest.RestApiProducer.process(RestApiProducer.java:36)
    at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
    ... 39 more

异常:

com.fasterxml.jackson.databind.introspect.AnnotatedMember.getType(Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;

pom.xml:

<properties>
    <camel.version>2.25.4</camel.version>
</properties>
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-jackson-starter</artifactId>
    <version>${camel.version}</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.datatype</groupId>
    <artifactId>jackson-datatype-jsr310</artifactId>
    <version>2.12.5</version>
</dependency>

这是我在项目中使用的Camel的Jackson依赖项。

pbgvytdp

pbgvytdp1#

我建议你运行命令:

mvn dependency:tree

并获取包含此类的工件的版本:com.fasterxml.jackson.databind.introspect.AnnotatedMember
NoSuchMethodException总是被引发,因为依赖jar有多个版本,你使用的直接依赖lib依赖于另一个lib,但是你的pom中有多个版本,旧版本的Class可能不包含你正在使用的方法。

cfh9epnr

cfh9epnr2#

camel-jackson-starter版本2.25.4使用jackson-databind2.9.10.7版本。

请通过添加以下依赖项更新您的pom.xml

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-jackson-starter</artifactId>
    <version>2.25.4</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.9.10.7</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.datatype</groupId>
    <artifactId>jackson-datatype-jsr310</artifactId>
    <version>2.9.10</version>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.module</groupId>
   <artifactId>jackson-module-jaxb-annotations</artifactId>
  <version>2.9.10</version>
</dependency>

看看这个能不能用。

相关问题