Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Springwolf-Kafka Protobuf Exception #341

Closed
kaant2 opened this issue Aug 31, 2023 · 3 comments
Closed

Springwolf-Kafka Protobuf Exception #341

kaant2 opened this issue Aug 31, 2023 · 3 comments
Labels
bug Something isn't working staged for release

Comments

@kaant2
Copy link

kaant2 commented Aug 31, 2023

Describe the bug
When working with protobufs, ExampleJsonGenerator class throws NullPointerException for type google.protobuf.Timestamp

Dependencies and versions used
springwolf-kafka version 0.13.0.
spring-boot version 3.1.2

Code example

syntax = "proto3"; message AProto { string a = 1; string b = 2; string c = 3; string d = 4; google.protobuf.Timestamp e = 5; int64 f = 6; string g = 7; }

Stack trace and error logs

`org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springwolfInitApplicationListener' defined in URL [jar:file:/C:/Users/kaan/.m2/repository/io/github/springwolf/springwolf-core/0.13.0/springwolf-core-0.13.0.jar!/io/github/stavshamir/springwolf/asyncapi/SpringwolfInitApplicationListener.class]: Error occured during creation of AsyncAPI
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
at com.kaan.starter.common.factory.TimedDefaultListableBeanFactory.doGetBean(TimedDefaultListableBeanFactory.java:67)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:942)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:608)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:436)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
at com.kaan.starter.common.util.ApplicationSupport.run(ApplicationSupport.java:20)
at com.kaan.file.FileServiceApplication.main(FileServiceApplication.java:11)
Caused by: java.lang.RuntimeException: Error occured during creation of AsyncAPI
at io.github.stavshamir.springwolf.asyncapi.DefaultAsyncApiService.getAsyncAPI(DefaultAsyncApiService.java:45)
at io.github.stavshamir.springwolf.asyncapi.SpringwolfInitApplicationListener.afterPropertiesSet(SpringwolfInitApplicationListener.java:39)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1817)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766)
... 16 common frames omitted
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Map.entrySet()" because "properties" is null
at io.github.stavshamir.springwolf.schemas.example.ExampleJsonGenerator.handleObject(ExampleJsonGenerator.java:134)
at io.github.stavshamir.springwolf.schemas.example.ExampleJsonGenerator.buildSchema(ExampleJsonGenerator.java:69)
at io.github.stavshamir.springwolf.schemas.example.ExampleJsonGenerator.buildSchema(ExampleJsonGenerator.java:61)
at io.github.stavshamir.springwolf.schemas.example.ExampleJsonGenerator.lambda$handleObject$0(ExampleJsonGenerator.java:140)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at io.github.stavshamir.springwolf.schemas.example.ExampleJsonGenerator.handleObject(ExampleJsonGenerator.java:144)
at io.github.stavshamir.springwolf.schemas.example.ExampleJsonGenerator.buildSchema(ExampleJsonGenerator.java:69)
at io.github.stavshamir.springwolf.schemas.example.ExampleJsonGenerator.buildSchema(ExampleJsonGenerator.java:61)
at io.github.stavshamir.springwolf.schemas.example.ExampleJsonGenerator.lambda$handleObject$0(ExampleJsonGenerator.java:140)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at io.github.stavshamir.springwolf.schemas.example.ExampleJsonGenerator.handleObject(ExampleJsonGenerator.java:144)
at io.github.stavshamir.springwolf.schemas.example.ExampleJsonGenerator.buildSchema(ExampleJsonGenerator.java:69)
at io.github.stavshamir.springwolf.schemas.example.ExampleJsonGenerator.fromSchema(ExampleJsonGenerator.java:39)
at io.github.stavshamir.springwolf.schemas.DefaultSchemasService.generateExampleWhenMissing(DefaultSchemasService.java:89)
at java.base/java.util.HashMap.forEach(HashMap.java:1421)
at io.github.stavshamir.springwolf.schemas.DefaultSchemasService.finalizeDefinitions(DefaultSchemasService.java:45)
at io.github.stavshamir.springwolf.schemas.DefaultSchemasService.getDefinitions(DefaultSchemasService.java:39)
at io.github.stavshamir.springwolf.asyncapi.DefaultAsyncApiService.initAsyncAPI(DefaultAsyncApiService.java:71)
at io.github.stavshamir.springwolf.asyncapi.DefaultAsyncApiService.getAsyncAPI(DefaultAsyncApiService.java:39)
... 19 common frames omitted

`

@kaant2 kaant2 added the bug Something isn't working label Aug 31, 2023
@github-actions
Copy link

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.

@timonback
Copy link
Member

Hi @kaant2,

Thank you for the report.

Luckily, this is a duplicate of #314 and has been fixed in the current -SNAPSHOT version.

We do not use protobuf (google.protobuf.Timestamp) in this project, but like to support it/fix issues when there is an easy way.

I keep this open until the next release.
Feel free to re-open & comment if the issue persists in the next release.

@timonback
Copy link
Member

timonback commented Sep 2, 2023

Thank your for the report, the issue has been addressed in the new release.

Feel free to reopen this issue if there is still something missing.

Also, please participate in #342 if you can :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working staged for release
Projects
None yet
Development

No branches or pull requests

2 participants