Kafka Streams binder: IllegalAccessException in non-public classes with StreamListener method
See original GitHub issueorg.springframework.beans.factory.BeanInitializationException: Cannot setup StreamListener for public void wc.WordsConsumer.process(org.apache.kafka.streams.kstream.KStream); nested exception is java.lang.IllegalAccessException: Class org.springframework.cloud.stream.binder.kafka.streams.KafkaStreamsStreamListenerSetupMethodOrchestrator can not access a member of class wc.WordsConsumer with modifiers "public"
at org.springframework.cloud.stream.binder.kafka.streams.KafkaStreamsStreamListenerSetupMethodOrchestrator.orchestrateStreamListenerSetupMethod(KafkaStreamsStreamListenerSetupMethodOrchestrator.java:195) ~[spring-cloud-stream-binder-kafka-streams-2.0.0.RC3.jar:2.0.0.RC3]
at org.springframework.cloud.stream.binding.StreamListenerAnnotationBeanPostProcessor.doPostProcess(StreamListenerAnnotationBeanPostProcessor.java:195) ~[spring-cloud-stream-2.0.0.RC3.jar:2.0.0.RC3]
at org.springframework.cloud.stream.binding.StreamListenerAnnotationBeanPostProcessor.lambda$postProcessAfterInitialization$0(StreamListenerAnnotationBeanPostProcessor.java:167) ~[spring-cloud-stream-2.0.0.RC3.jar:2.0.0.RC3]
at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_151]
at org.springframework.cloud.stream.binding.StreamListenerAnnotationBeanPostProcessor.injectAndPostProcessDependencies(StreamListenerAnnotationBeanPostProcessor.java:285) ~[spring-cloud-stream-2.0.0.RC3.jar:2.0.0.RC3]
at org.springframework.cloud.stream.binding.StreamListenerAnnotationBeanPostProcessor.afterSingletonsInstantiated(StreamListenerAnnotationBeanPostProcessor.java:105) ~[spring-cloud-stream-2.0.0.RC3.jar:2.0.0.RC3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:777) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at wc.WordCountApplication.main(WordCountApplication.java:51) [classes/:na]
Caused by: java.lang.IllegalAccessException: Class org.springframework.cloud.stream.binder.kafka.streams.KafkaStreamsStreamListenerSetupMethodOrchestrator can not access a member of class wc.WordsConsumer with modifiers "public"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102) ~[na:1.8.0_151]
at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:296) ~[na:1.8.0_151]
at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:288) ~[na:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:491) ~[na:1.8.0_151]
at org.springframework.cloud.stream.binder.kafka.streams.KafkaStreamsStreamListenerSetupMethodOrchestrator.orchestrateStreamListenerSetupMethod(KafkaStreamsStreamListenerSetupMethodOrchestrator.java:159) ~[spring-cloud-stream-binder-kafka-streams-2.0.0.RC3.jar:2.0.0.RC3]
... 15 common frames omitted
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Spring Cloud Stream Kafka - Method must be Declarative
I am trying to work on a KStream but I keep getting error "java.lang.IllegalArgumentException: Method must be declarative". Can someone help me ...
Read more >16. Apache Kafka Streams Binder - Spring
This application consumes data from a Kafka topic (e.g., words ), computes word count for each unique word in a 5 seconds time...
Read more >spring-cloud/spring-cloud-stream - Gitter
So i have an app with 3 Spring Cloud Stream Consumer beans which connects to kafka binders. Now i am trying to implement...
Read more >org.apache.kafka.streams.processor.ProcessorContext
This page shows Java code examples of org.apache.kafka.streams.processor. ... Source Project: spring-cloud-stream-binder-kafka Author: spring-cloud File: ...
Read more >Part 2: Apache Kafka and Spring Cloud Stream - Confluent
The Kafka binder extends on the solid foundations of Spring Boot, ... notice that the method is annotated with @StreamListener , which is ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Still bogus IMHO.
You need to use
ReflectionUtils.makeAccessible(method)
beforemethod.invoke()
.