升级到spring boot 2.3.1.0版本后,应用程序无法启动

0md85ypi  于 2021-07-24  发布在  Java
关注(0)|答案(0)|浏览(453)

我使用的是spring boot 2.3.1.release、spring-cloud-services.version 2.0.0.rc2和spring-cloud.version hoxton.m1,在启动应用程序时面临以下问题:

APPLICATION FAILED TO START

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.cloud.stream.binder.rabbit.config.RabbitServiceAutoConfiguration.configureCachingConnectionFactory(RabbitServiceAutoConfiguration.java:72)
The following method did not exist:
org.springframework.boot.autoconfigure.amqp.RabbitProperties.isPublisherConfirms()Z
The method's class, org.springframework.boot.autoconfigure.amqp.RabbitProperties, is available from the following locations:
jar:file:/home/vcap/app/BOOT-INF/lib/spring-boot-autoconfigure-2.3.1.RELEASE.jar!/org/springframework/boot/autoconfigure/amqp/RabbitProperties.class
The class hierarchy was loaded from the following locations:
org.springframework.boot.autoconfigure.amqp.RabbitProperties: file:/home/vcap/app/BOOT-INF/lib/spring-boot-autoconfigure-2.3.1.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.boot.autoconfigure.amqp.RabbitProperties

在升级到spring boot2.3.8.release和spring cloud到hoxton.sr9之后,我得到了以下异常:

org.springframework.messaging.MessagingException: Exception thrown while invoking BusAutoConfiguration#acceptRemote[1 args]; nested exception is java.lang.IllegalStateException: java.lang.ClassCastException@526e6469
    Endpoint [org.springframework.cloud.bus.BusAutoConfiguration]
    Method [public void org.springframework.cloud.bus.BusAutoConfiguration.acceptRemote(org.springframework.cloud.bus.event.RemoteApplicationEvent)] with argument values:
     [0] [type=java.lang.String] [value={"type":"RegisterInstanceRemoteApplicationEvent","timestamp":1611732673850,"originService":"ps-shipmethodservice:dit02,rabbitmq,elastic,dit02-elastic,cloud:0","destinationService":"ps-shipmethodservice:**","id":"28831bca-d676-4871-8499-2d837ed31f27","instanceId":"ps-shipmethodservice:dit02,rabbitmq,elastic,dit02-elastic,cloud:0","onInstanceStart":false}] , failedMessage=GenericMessage [payload=byte[355], headers={amqp_receivedDeliveryMode=PERSISTENT, amqp_receivedExchange=ps-shipmethodservice, amqp_deliveryTag=1, deliveryAttempt=3, amqp_consumerQueue=ps-shipmethodservice.anonymous.bf6cfAv2T-Soekf_NtRbcw, amqp_redelivered=false, originalContentType=application/json;charset=UTF-8, amqp_receivedRoutingKey=ps-shipmethodservice, id=e84fe2c8-635e-f08b-6835-44f7f3bd3dbd, amqp_consumerTag=amq.ctag-1egWJoPelY6EmHaHAj_kYg, sourceData=(Body:'{"type":"RegisterInstanceRemoteApplicationEvent","timestamp":1611732673850,"originService":"ps-shipmethodservice:dit02,rabbitmq,elastic,dit02-elastic,cloud:0","destinationService":"ps-shipmethodservice:**","id":"28831bca-d676-4871-8499-2d837ed31f27","instanceId":"ps-shipmethodservice:dit02,rabbitmq,elastic,dit02-elastic,cloud:0","onInstanceStart":false}' MessageProperties [headers={contentType=text/plain, originalContentType=application/json;charset=UTF-8}, contentType=text/plain, contentLength=0, receivedDeliveryMode=PERSISTENT, priority=0, redelivered=false, receivedExchange=ps-shipmethodservice, receivedRoutingKey=ps-shipmethodservice, deliveryTag=1, consumerTag=amq.ctag-1egWJoPelY6EmHaHAj_kYg, consumerQueue=ps-shipmethodservice.anonymous.bf6cfAv2T-Soekf_NtRbcw]), contentType=text/plain, timestamp=1611732690649}]
        at org.springframework.cloud.stream.binding.StreamListenerMessageHandler.handleRequestMessage(StreamListenerMessageHandler.java:64)
        at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:134)
        at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:62)
        at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:115)
        at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:133)
        at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:106)
        at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:72)
        at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:570)
        at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:520)
        at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187)
        at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:166)
        at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47)
        at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:109)
        at org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:208)
        at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter.access$1300(AmqpInboundChannelAdapter.java:65)
        at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$Listener.lambda$onMessage$0(AmqpInboundChannelAdapter.java:294)
        at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287)
        at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:180)
        at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$Listener.onMessage(AmqpInboundChannelAdapter.java:290)
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1608)
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1527)
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1515)
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:1506)
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1450)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:976)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:922)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1600(SimpleMessageListenerContainer.java:83)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.mainLoop(SimpleMessageListenerContainer.java:1297)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1203)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.IllegalStateException: argument type mismatch
    Endpoint [org.springframework.cloud.bus.BusAutoConfiguration]
    Method [public void org.springframework.cloud.bus.BusAutoConfiguration.acceptRemote(org.springframework.cloud.bus.event.RemoteApplicationEvent)] with argument values:
     [0] [type=java.lang.String] [value={"type":"RegisterInstanceRemoteApplicationEvent","timestamp":1611732673850,"originService":"ps-shipmethodservice:dit02,rabbitmq,elastic,dit02-elastic,cloud:0","destinationService":"ps-shipmethodservice:**","id":"28831bca-d676-4871-8499-2d837ed31f27","instanceId":"ps-shipmethodservice:dit02,rabbitmq,elastic,dit02-elastic,cloud:0","onInstanceStart":false}] 
        at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:176)
        at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:120)
        at org.springframework.cloud.stream.binding.StreamListenerMessageHandler.handleRequestMessage(StreamListenerMessageHandler.java:55)
        ... 29 more
    Caused by: java.lang.IllegalArgumentException: argument type mismatch
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:171)
        ... 31 more

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题