springwolf-core icon indicating copy to clipboard operation
springwolf-core copied to clipboard

Jar missing version 0.10.3

Open gabryellr opened this issue 1 year ago • 4 comments

Describe the bug When trying to publish a message from the UI we end up with this exception on spring wolf kafka version 0.10.0:

Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `io.github.stavshamir.springwolf.asyncapi.dtos.KafkaMessageDto` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 2]
	at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
	at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1904)
	at com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.java:400)
	at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1349)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1415)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:352)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:185)
	at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4674)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3682)
	at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:380)
	... 107 common frames omitted

This happens because in SpringwolfKafkaController, the method publish() is the method mapped to the POST request. This method receives two arguments, @RequestParam String topic, @RequestBody MessageDto message From the logs we see that the UI seems to send the correct request:

2024-02-20 19:17:55.717 [] DEBUG 20960 --- [nio-8080-exec-1] o.a.coyote.http11.Http11InputBuffer      : Received [POST /springwolf/kafka/publish?topic=topic-name HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 106
sec-ch-ua: "Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"
Accept: application/json, text/plain, */*
Content-Type: application/json
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
sec-ch-ua-platform: "Windows"
Origin: http://localhost:8080
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://localhost:8080/springwolf/asyncapi-ui.html
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9

{"payload":{json body},"headers":{}}]

The problem is KafkaMessageDto does not have a no args constructor and Jackson is unable to deserialize the object

@Data
public class KafkaMessageDto {

    private final Map<String, String> headers;
    private final Map<String, ?> payload;

}

In version 0.10.3 this class seems to be annotated with

@Data
@Builder
@Jacksonized

but only pom was published - maven dependency If I put the dependency in Maven it can't get the jar

*** versions ***

        <!-- Provides the documentation API -->
        <dependency>
            <groupId>io.github.springwolf</groupId>
            <artifactId>springwolf-kafka</artifactId>
            <version>0.10.3</version>
        </dependency>
        <!-- Provides the UI -->
        <dependency>
            <groupId>io.github.springwolf</groupId>
            <artifactId>springwolf-ui</artifactId>
            <version>0.6.0</version>
        </dependency>

I'm limited to use springboot 2 at moment, so I cant upgrade the version

gabryellr avatar Mar 01 '24 10:03 gabryellr

Welcome to Springwolf. Thanks a lot for reporting your first issue. Please check out our contributors guide and feel free to join us on discord.

github-actions[bot] avatar Mar 01 '24 10:03 github-actions[bot]

Hi @gabryellr, Thank you for the detailed issue and great analysis.

After following the link to the maven dependency, I do see the jar artifact. However, it does contain the -plain postfix in its filename. A regression that has been fixed in the next version (see https://github.com/springwolf/springwolf-core/commit/f5c69ef81702442639c3950df4580ee797e4a3e5)

I am not very familiar with maven. Is it possible to overwrite the jar filename to add the -plain postfix manual?

timonback avatar Mar 01 '24 12:03 timonback

@gabryellr We have just released the new 1.0.0 version. Can you upgrade and confirm if you still have the same issue?

ctasada avatar Mar 02 '24 16:03 ctasada

Hi @gabryellr, we made an exception in this case to just republish so that the artifact is usable.

More details: https://github.com/springwolf/springwolf-core/tree/release/0.9.x Versions: https://github.com/springwolf/springwolf-core/commit/edddb2e9d9fda7defc21c17d2d0bd97cf773509d

We do not indent to create further releases, as we do not have the capacity to maintain multiple versions.

timonback avatar Mar 08 '24 17:03 timonback

Closing, as this has been released

timonback avatar Mar 15 '24 12:03 timonback

@gabryellr We have just released the new 1.0.0 version. Can you upgrade and confirm if you still have the same issue?

sorry, I didnt have time yet

gabryellr avatar Mar 27 '24 13:03 gabryellr