Solace Spring Cloud processor app issues after the upgrade of the Spring libraries
Previously, before the upgrade of Spring libraries we used:
org.springframework.boot:spring-boot-gradle-plugin:3.3.5
org.springframework.integration:spring-integration-core:6.3.2
org.springframework.cloud:spring-cloud-function-context:4.1.3
Now, after the upgrade we use:
org.springframework.boot:spring-boot-gradle-plugin:3.4.1
org.springframework.integration:spring-integration-core:6.4.1
org.springframework.cloud:spring-cloud-function-context:4.2.0
The logging from the Spring Cloud consumer was:
WARN c.s.s.c.s.b.p.SolaceQueueProvisioner [main] Adding destination as subscription was disabled, queue clientName.serviceProvider.securities will not be subscribed to topic clientName.serviceProvider.securities
INFO c.s.s.c.s.b.i.JCSMPInboundChannelAdapter [main] started com.solace.spring.cloud.stream.binder.inbound.JCSMPInboundChannelAdapter@1ccce165
INFO c.t.m.e.Application [main] Started Application in 6.787 seconds (process running for 7.376)
INFO c.t.m.e.EventConsumer [pool-7-thread-1] Received message with header properties [id=ffc98948-b10f-741e-4bdb-309e03c43d1b,endpoint=clientName/serviceProvider/securities,sender=null,sender-timestamp=null
INFO c.t.m.e.h.SecurityHandler [pool-3-thread-1] Received message contains 810 security updates
After the upgrade:
WARN c.s.s.c.s.b.p.SolaceQueueProvisioner [main] Adding destination as subscription was disabled, queue clientName.serviceProvider.securities will not be subscribed to topic clientName.serviceProvider.securities
INFO c.s.s.c.s.b.i.JCSMPInboundChannelAdapter [main] started com.solace.spring.cloud.stream.binder.inbound.JCSMPInboundChannelAdapter@72ad577b
INFO c.t.m.e.Application [main] Started Application in 6.059 seconds (process running for 6.644)
WARN c.s.s.c.s.b.i.JCSMPInboundChannelAdapter [pool-8-thread-1] Failed to consume a message from destination clientName.serviceProvider.securities - attempt 1
ERROR o.s.i.h.LoggingHandler [pool-8-thread-1] org.springframework.messaging.MessagingException: 'org.springframework.integration.support.MessageBuilder org.springframework.integration.support.MessageBuilder.removeHeader(java.lang.String)'
Please could you advise how to prevent the above error.
Best Answers
-
@MickeyZ This is an issue with your Spring versions, not the Solace binder.
Caused by: java.lang.NoSuchMethodError: 'org.springframework.integration.support.MessageBuilder org.springframework.integration.support.MessageBuilder.removeHeader(java.lang.String)' at org.springframework.cloud.stream.function.FunctionConfiguration.sanitize(FunctionConfiguration.java:408)
This error originates from code in Spring Cloud Stream (SCSt), and I had to jump back to at least SCSt
4.1.0
to find aMessageBuilder.removeHeader()
call on line 408.As per the Spring Cloud Supported Versions page, SCSt
4.1.0
corresponds to a dependency from Spring Cloud2023.0.x
, which is incompatible with both Spring Boot3.4.x
and other dependencies within Spring Cloud2024.0.x
(which is whatspring-cloud-function-context:4.2.0
is a part of).By any chance, are you already using the Spring Boot BOM (
spring-boot-dependencies
) and Spring Cloud BOM (spring-cloud-dependencies
) in your application? If not, then I'd highly suggest that you use the them for some stability during Spring upgrades:
Spring Boot BOM:- Typically inherited from spring-boot-starter-parent
- Otherwise, manually import spring-boot-dependencies
Spring Cloud BOM:
- Manually import spring-cloud-dependencies
By doing this, you won't need to manually specify the versions of each individual Spring dependencies, and would only need to manage the versions of the two high-level BOMs.
2
Answers
-
What version of Solace Spring Cloud are you using?
It looks like the latest is using Boot 3.3.5 so it may not have been officially tested vs. 3.4.1 yet. But since this is just a minor version upgrade by Spring it should still work. Were you able to debug it at all and see if there is a specific header causing the issue or anything like that? Interesting that it's calling "removeHeader"…any idea why?
0 -
Stacktrace from @MickeyZ (shared via dm):
2025-01-07 15:36:29,802 ERROR o.s.i.h.LoggingHandler [pool-8-thread-1] org.springframework.messaging.MessagingException: 'org.springframework.integration.support.MessageBuilder org.springframework.integration.support.MessageBuilder.removeHeader(java.lang.String)' at org.springframework.integration.core.ErrorMessagePublisher.determinePayload(ErrorMessagePublisher.java:186) at org.springframework.integration.core.ErrorMessagePublisher.publish(ErrorMessagePublisher.java:162) at org.springframework.integration.handler.advice.ErrorMessageSendingRecoverer.recover(ErrorMessageSendingRecoverer.java:83) at com.solace.spring.cloud.stream.binder.inbound.RetryableInboundXMLMessageListener.lambda$handleMessage$3(RetryableInboundXMLMessageListener.java:75) at org.springframework.retry.support.RetryTemplate.handleRetryExhausted(RetryTemplate.java:573) at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:418) at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:246) at com.solace.spring.cloud.stream.binder.inbound.RetryableInboundXMLMessageListener.handleMessage(RetryableInboundXMLMessageListener.java:69) at com.solace.spring.cloud.stream.binder.inbound.InboundXMLMessageListener.processMessage(InboundXMLMessageListener.java:166) at com.solace.spring.cloud.stream.binder.inbound.InboundXMLMessageListener.receive(InboundXMLMessageListener.java:152) at com.solace.spring.cloud.stream.binder.inbound.InboundXMLMessageListener.run(InboundXMLMessageListener.java:97) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:840) Caused by: java.lang.NoSuchMethodError: 'org.springframework.integration.support.MessageBuilder org.springframework.integration.support.MessageBuilder.removeHeader(java.lang.String)' at org.springframework.cloud.stream.function.FunctionConfiguration.sanitize(FunctionConfiguration.java:408) at org.springframework.cloud.stream.function.FunctionConfiguration$FunctionWrapper.apply(FunctionConfiguration.java:823) at org.springframework.cloud.stream.function.FunctionConfiguration$FunctionToDestinationBinder$1.handleMessageInternal(FunctionConfiguration.java:661) at org.springframework.integration.handler.AbstractMessageHandler.doHandleMessage(AbstractMessageHandler.java:105) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73) at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:132) at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148) at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121) at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:72) at org.springframework.integration.channel.AbstractMessageChannel.sendInternal(AbstractMessageChannel.java:390) at org.springframework.integration.channel.AbstractMessageChannel.sendWithMetrics(AbstractMessageChannel.java:361) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:331) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:304) 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.lambda$sendMessage$1(MessageProducerSupport.java:261) at io.micrometer.observation.Observation.observe(Observation.java:498) at org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:261) at com.solace.spring.cloud.stream.binder.inbound.JCSMPInboundChannelAdapter.lambda$buildListener$2(JCSMPInboundChannelAdapter.java:266) at com.solace.spring.cloud.stream.binder.inbound.InboundXMLMessageListener.sendToConsumer(InboundXMLMessageListener.java:270) at com.solace.spring.cloud.stream.binder.inbound.InboundXMLMessageListener.sendOneToConsumer(InboundXMLMessageListener.java:256) at com.solace.spring.cloud.stream.binder.inbound.InboundXMLMessageListener.lambda$processMessage$2(InboundXMLMessageListener.java:167) at com.solace.spring.cloud.stream.binder.inbound.RetryableInboundXMLMessageListener.lambda$handleMessage$2(RetryableInboundXMLMessageListener.java:71) at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:357) ... 11 more
0 -
@MickeyZ This is an issue with your Spring versions, not the Solace binder.
Caused by: java.lang.NoSuchMethodError: 'org.springframework.integration.support.MessageBuilder org.springframework.integration.support.MessageBuilder.removeHeader(java.lang.String)' at org.springframework.cloud.stream.function.FunctionConfiguration.sanitize(FunctionConfiguration.java:408)
This error originates from code in Spring Cloud Stream (SCSt), and I had to jump back to at least SCSt
4.1.0
to find aMessageBuilder.removeHeader()
call on line 408.As per the Spring Cloud Supported Versions page, SCSt
4.1.0
corresponds to a dependency from Spring Cloud2023.0.x
, which is incompatible with both Spring Boot3.4.x
and other dependencies within Spring Cloud2024.0.x
(which is whatspring-cloud-function-context:4.2.0
is a part of).By any chance, are you already using the Spring Boot BOM (
spring-boot-dependencies
) and Spring Cloud BOM (spring-cloud-dependencies
) in your application? If not, then I'd highly suggest that you use the them for some stability during Spring upgrades:
Spring Boot BOM:- Typically inherited from spring-boot-starter-parent
- Otherwise, manually import spring-boot-dependencies
Spring Cloud BOM:
- Manually import spring-cloud-dependencies
By doing this, you won't need to manually specify the versions of each individual Spring dependencies, and would only need to manage the versions of the two high-level BOMs.
2