Closed LaurineLeNet closed 11 months ago
Do you have the following on your classpath?
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
Closing due to no activity. Feel free to re-open if there is a need. Otherwise, please follow the recommendation from @olegz above.
@sobychacko I am comment the issue because I am having exactly the same problem but for the Eventhubs binder.
I have opened an issue here but I am not sure if the problem is with Azure but with the ObjectMapper configured for the actuator.
I have tried to configure it in several ways by extending the actuator but I still have the same problem.
To reproduce it just follow the steps in the other issue.
In the project that I give as an example in the issue, there is the dependency jackson-datatype-jsr310
.
Sorry, I missed the comment, yes I have the dependency jackson in my pom
@sobychacko Any thoughts on this?
@ferblaca provided a reproducer case and he said the project has already the jackson-datatype-jsr310
dependency
I will take a look today. First, I want to see if this is any binder-specific or a general issue.
@juliojgd @ferblaca Before I proceed, did you try it with one of the out-of-the-box binders (Kafka, rabbit, or Pulsar) and see if the issue happens there? If not, could you try that first? That way, we can isolate the issue.
@juliojgd @ferblaca Before I proceed, did you try it with one of the out-of-the-box binders (Kafka, rabbit, or Pulsar) and see if the issue happens there? If not, could you try that first? That way, we can isolate the issue.
Hi @sobychacko, this only occurs for eventhubs binder. For example, the Kafka binder works correctly.
The problem is that the ObjectMapper configured for the actuator bindings is not capable of serializing data of type Duration used for the eventhubs bindings, even with the jackson-datatype-jsr310 dependency at the classpath.
As a workaround to the problem, can you create a custom ObjectMapper
bean in your application as below and see if that fixes the problem?
@Bean
public ObjectMapper objectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JavaTimeModule());
return objectMapper;
}
When you provide a custom ObjectMapper
bean in the application, Spring Cloud Stream will use that instead of creating one.
See this SO thread for more details. If it works, we will incorporate this change into the framework.
Hi @sobychacko ,
I have tested the workaround but the same problem remains.
@ferblaca The binder runs in a child context, and that's the reason why you can't add that bean from the application. I didn't think about that when I made the suggestion. My apologies. To look into this, I created an issue in the backlog.
In the meantime, I think I fixed the issue by directly modifying the custom ObjectMapper
in AMCB. Please take a look at the commits mentioned above. The changes are in the main branch (4.1.1-SNAPSHOT
) and cherry-picked to 4.0.x
. You might want to upgrade your spring-cloud version, as the one you are using (2021) may already be out of the OSS support. The Spring Cloud Stream version corresponding to that spring cloud version is 3.2.x
.
@ferblaca The binder runs in a child context, and that's the reason why you can't add that bean from the application. I didn't think about that when I made the suggestion. My apologies. To look into this, I created an issue in the backlog.
In the meantime, I think I fixed the issue by directly modifying the custom
ObjectMapper
in AMCB. Please take a look at the commits mentioned above. The changes are in the main branch (4.1.1-SNAPSHOT
) and cherry-picked to4.0.x
. You might want to upgrade your spring-cloud version, as the one you are using (2021) may already be out of the OSS support. The Spring Cloud Stream version corresponding to that spring cloud version is3.2.x
.
@sobychacko Indeed, with SCS version 4.1.1-SNAPSHOT the problem is fixed 👍
Good to hear that, @ferblaca.
Good to hear that, @ferblaca.
hi, im sorry for wake this closed issue, but i have same error at ChannelsEndpoint on SCS version 4.0.4. and i guess maybe it should be fix like this?
Describe the issue Hi, I saw that you closed this issue : https://github.com/spring-cloud/spring-cloud-stream/issues/2272 I am using spring-cloud-stream with rabbit and azure servicebus and I am still facing that issue for servicebus bindings.
To Reproduce Steps to reproduce the behavior:
Version of the framework Spring Cloud version : 2021.0.8 Azure service bus version : 4.10.0