question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Quarkus startup fails, if jaxrs filter injects a mp reactive messaging emitter

See original GitHub issue

Describe the bug If Quarkus uses MicroProfile Reactive Messaging with incoming and outgoing topics and a JAXRS javax.ws.rs.container.ContainerRequestFilter injects (indirectly) an org.eclipse.microprofile.reactive.messaging.Emitter, than startup fails with java.lang.ExceptionInInitializerError caused by ‘Unable to find a emitter with the name <topicname>, available emitters are: []’.

Expected behavior Successful quarkus startup.

Actual behavior Exception in thread “main” java.lang.ExceptionInInitializerError

To Reproduce Steps to reproduce the behavior:

  1. Clone project https://github.com/TobiWeier/quarkus-emitter-jaxrsfilter-failure.git
  2. Build project mvn clean package
  3. Start kafka cluster on minikube (described here https://strimzi.io/quickstarts/) or with docker-compose (described here https://github.com/wurstmeister/kafka-docker)
  4. Start quarkus java -jar target/emitter-jaxrsfilter-1.0-SNAPSHOT-runner.jar

Configuration

kafka.bootstrap.servers=localhost:9092
mp.messaging.outgoing.outtopic.connector=smallrye-kafka
mp.messaging.outgoing.outtopic.value.serializer=org.apache.kafka.common.serialization.StringSerializer
mp.messaging.incoming.intopic.connector=smallrye-kafka
mp.messaging.incoming.intopic.value.deserializer=org.apache.kafka.common.serialization.StringDeserializer
mp.messaging.incoming.intopic.group.id=emitter-jaxrsfilter

Screenshots

java -jar target/emitter-jaxrsfilter-1.0-SNAPSHOT-runner.jar
Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at java.base/java.lang.Class.newInstance(Class.java:584)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:60)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
        at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
Caused by: java.lang.RuntimeException: Failed to start quarkus
        at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:166)
        ... 9 more
Caused by: java.lang.RuntimeException: Error injecting org.acme.messaging.controller.MessageSender org.acme.messaging.filter.RequestFilter.controller
        at org.acme.messaging.filter.RequestFilter_Bean.create(RequestFilter_Bean.zig:148)
        at org.acme.messaging.filter.RequestFilter_Bean.create(RequestFilter_Bean.zig:171)
        at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:79)
        at io.quarkus.arc.impl.ComputingCache$CacheFunction.lambda$apply$0(ComputingCache.java:99)
        at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
        at io.quarkus.arc.impl.ComputingCache.getValue(ComputingCache.java:41)
        at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:25)
        at org.acme.messaging.filter.RequestFilter_Bean.get(RequestFilter_Bean.zig:203)
        at org.acme.messaging.filter.RequestFilter_Bean.get(RequestFilter_Bean.zig:219)
        at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:380)
        at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:393)
        at io.quarkus.arc.impl.ArcContainerImpl$1.get(ArcContainerImpl.java:244)
        at io.quarkus.arc.impl.ArcContainerImpl$1.get(ArcContainerImpl.java:241)
        at io.quarkus.arc.runtime.ArcRecorder$2$1.create(ArcRecorder.java:84)
        at io.quarkus.resteasy.common.runtime.QuarkusConstructorInjector.construct(QuarkusConstructorInjector.java:39)
        at org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl.injectedInstance(ResteasyProviderFactoryImpl.java:1398)
        at org.jboss.resteasy.core.interception.jaxrs.JaxrsInterceptorRegistryImpl$AbstractInterceptorFactory.createInterceptor(JaxrsInterceptorRegistryImpl.java:150)
        at org.jboss.resteasy.core.interception.jaxrs.JaxrsInterceptorRegistryImpl$OnDemandInterceptorFactory.initialize(JaxrsInterceptorRegistryImpl.java:168)
        at org.jboss.resteasy.core.interception.jaxrs.JaxrsInterceptorRegistryImpl$OnDemandInterceptorFactory.checkInitialize(JaxrsInterceptorRegistryImpl.java:183)
        at org.jboss.resteasy.core.interception.jaxrs.JaxrsInterceptorRegistryImpl$OnDemandInterceptorFactory.getInterceptor(JaxrsInterceptorRegistryImpl.java:194)
        at org.jboss.resteasy.core.interception.jaxrs.JaxrsInterceptorRegistryImpl$AbstractInterceptorFactory.postMatch(JaxrsInterceptorRegistryImpl.java:124)
        at org.jboss.resteasy.core.interception.jaxrs.JaxrsInterceptorRegistryImpl.postMatch(JaxrsInterceptorRegistryImpl.java:283)
        at org.jboss.resteasy.core.interception.jaxrs.ContainerRequestFilterRegistryImpl.postMatch(ContainerRequestFilterRegistryImpl.java:30)
        at org.jboss.resteasy.core.interception.jaxrs.ContainerRequestFilterRegistryImpl.postMatch(ContainerRequestFilterRegistryImpl.java:12)
        at org.jboss.resteasy.core.ResourceMethodInvoker.<init>(ResourceMethodInvoker.java:139)
        at org.jboss.resteasy.core.ResourceMethodRegistry.processMethod(ResourceMethodRegistry.java:382)
        at org.jboss.resteasy.core.ResourceMethodRegistry.register(ResourceMethodRegistry.java:309)
        at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:260)
        at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:227)
        at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:208)
        at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:192)
        at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:175)
        at org.jboss.resteasy.core.ResourceMethodRegistry.addPerRequestResource(ResourceMethodRegistry.java:87)
        at org.jboss.resteasy.core.ResteasyDeploymentImpl.registerResources(ResteasyDeploymentImpl.java:513)
        at org.jboss.resteasy.core.ResteasyDeploymentImpl.registration(ResteasyDeploymentImpl.java:470)
        at org.jboss.resteasy.core.ResteasyDeploymentImpl.startInternal(ResteasyDeploymentImpl.java:160)
        at org.jboss.resteasy.core.ResteasyDeploymentImpl.start(ResteasyDeploymentImpl.java:117)
        at io.quarkus.resteasy.runtime.standalone.ResteasyStandaloneRecorder.staticInit(ResteasyStandaloneRecorder.java:86)
        at io.quarkus.deployment.steps.ResteasyStandaloneBuildStep$staticInit-210558872.deploy_0(ResteasyStandaloneBuildStep$staticInit-210558872.zig:749)
        at io.quarkus.deployment.steps.ResteasyStandaloneBuildStep$staticInit-210558872.deploy(ResteasyStandaloneBuildStep$staticInit-210558872.zig:36)
        at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:141)
        ... 9 more
Caused by: java.lang.RuntimeException: Error injecting org.eclipse.microprofile.reactive.messaging.Emitter<java.lang.String> org.acme.messaging.controller.MessageSender.emitter
        at org.acme.messaging.controller.MessageSender_Bean.create(MessageSender_Bean.zig:248)
        at org.acme.messaging.controller.MessageSender_Bean.get(MessageSender_Bean.zig:286)
        at org.acme.messaging.controller.MessageSender_Bean.get(MessageSender_Bean.zig:321)
        at org.acme.messaging.filter.RequestFilter_Bean.create(RequestFilter_Bean.zig:131)
        ... 49 more
Caused by: java.lang.IllegalStateException: Unable to find a emitter with the name outtopic, available emitters are: []
        at io.smallrye.reactive.messaging.extension.ChannelProducer.getEmitter(ChannelProducer.java:191)
        at io.smallrye.reactive.messaging.extension.ChannelProducer.produceEmitter(ChannelProducer.java:139)
        at io.smallrye.reactive.messaging.extension.ChannelProducer_ProducerMethod_produceEmitter_86c8bb1e4975aaf33dff96bec0d2fc8fa44920ab_Bean.create(ChannelProducer_ProducerMethod_produceEmitter_86c8bb1e4975aaf33dff96bec0d2fc8fa44920ab_Bean.zig:247)
        at io.smallrye.reactive.messaging.extension.ChannelProducer_ProducerMethod_produceEmitter_86c8bb1e4975aaf33dff96bec0d2fc8fa44920ab_Bean.get(ChannelProducer_ProducerMethod_produceEmitter_86c8bb1e4975aaf33dff96bec0d2fc8fa44920ab_Bean.zig:277)
        at io.smallrye.reactive.messaging.extension.ChannelProducer_ProducerMethod_produceEmitter_86c8bb1e4975aaf33dff96bec0d2fc8fa44920ab_Bean.get(ChannelProducer_ProducerMethod_produceEmitter_86c8bb1e4975aaf33dff96bec0d2fc8fa44920ab_Bean.zig:312)
        at io.quarkus.arc.impl.CurrentInjectionPointProvider.get(CurrentInjectionPointProvider.java:53)
        at org.acme.messaging.controller.MessageSender_Bean.create(MessageSender_Bean.zig:231)
        ... 52 more

Environment (please complete the following information):

  • Output of uname -a or ver: Linux 5.4.0-37-generic #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • Output of java -version: openjdk version “11.0.7” 2020-04-14 OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1) OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)
  • GraalVM version (if different from Java):
  • Quarkus version or git rev: 1.5.2.Final
  • Build tool (ie. output of mvnw --version or gradlew --version): Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)

Additional context

  • If there is no receiver method with @Incoming annotation, quarkus starts without error.
  • If JAXRS ContainerRequestFilter don’t inject a controller with injected MicroProfile Messaging Emitter, quarkus starts without error.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
geoandcommented, Jul 14, 2020

So can we close this one as a proper workaround exists? Maybe we need to add some sort of documentation?

0reactions
geoandcommented, Oct 8, 2021

I am going to close this because for RESTEasy Classic the workaround Martin mentions above works and for RESTEasy Reactive there is no such limitation as the JAX-RS Filter lifecycle is completely controlled by CDI

Read more comments on GitHub >

github_iconTop Results From Across the Web

All configuration options - Quarkus
AWS Lambda Type Default AWS Lambda Common Type Default AWS Lambda Gateway REST API Type Default Agroal ‑ Database connection pool Type Default
Read more >
Getting Started to Quarkus Reactive Messaging with Apache ...
Apache Kafka is a stream-processing platform for storing, consuming, and processing data streams in real-time. In this post, we'll learn how ...
Read more >
Home of Quarkus Cheat-Sheet - GitHub Pages
Quarkus is a Kubernetes Native Java stack tailored for GraalVM & OpenJDK HotSpot, crafted from the best of breed Java libraries and standards....
Read more >
RESTEasy JAX-RS - JBoss.org
RESTEasy modules in WildFly. In WildFly, RESTEasy and the JAX-RS API are automatically loaded into your deployment's classpath if and only if you...
Read more >
For Use with JBoss EAP XP 4.0.0 - Red Hat Customer Portal
MicroProfile JWT; MicroProfile Metrics; MicroProfile OpenAPI; MicroProfile OpenTracing; MicroProfile REST Client; MicroProfile Reactive Messaging. Note. The ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found