You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"No active contexts for scope type javax.enterprise.context.RequestScoped" seen when using Fault Tolerance annotations and Request Scope in Helidon MP application.
Full stack trace:
2022.01.14 20:25:01 WARNING io.helidon.microprofile.server.JaxRsCdiExtension Thread[helidon-1,5,server]: Internal server error
org.jboss.weld.contexts.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.enterprise.context.RequestScoped
at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:647)
at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.getIfExists(ContextualInstanceStrategy.java:89)
at org.jboss.weld.bean.ContextualInstanceStrategy$CachingContextualInstanceStrategy.getIfExists(ContextualInstanceStrategy.java:164)
at org.jboss.weld.bean.ContextualInstance.getIfExists(ContextualInstance.java:63)
at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:87)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:131)
at io.helidon.examples.quickstart.mp.ResponseWriterInterceptor$Proxy$_$$_WeldClientProxy.aroundWriteTo(Unknown Source)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:139)
at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:85)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:139)
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:61)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:139)
at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1116)
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:635)
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:373)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:363)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:258)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:684)
at io.helidon.webserver.jersey.JerseySupport$JerseyHandler.lambda$doAccept$4(JerseySupport.java:326)
at io.helidon.common.context.Contexts.runInContext(Contexts.java:117)
at io.helidon.common.context.ContextAwareExecutorImpl.lambda$wrap$7(ContextAwareExecutorImpl.java:154)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Steps to reproduce
Create a JAXRS Application:
@ApplicationScoped
@ApplicationPath("/")
public class TestApplication extends Application {
@Override
public Set<Class<?>> getClasses() {
return Set.of(TestResource.class, ResponseWriterInterceptor.class);
}
}
Create a Resource class with Fault Tolerance annotation on an endpoint:
@Path("/test")
public class TestResource {
@Timeout
@GET
public String getTenantResource() throws Exception {
return "some string";
}
}
WriterInterceptor:
@Provider
@RequestScoped
public class ResponseWriterInterceptor implements WriterInterceptor {
@Override
public void aroundWriteTo(WriterInterceptorContext writerInterceptorContext) {
System.out.println("some string");
}
}
Hit endpoint, observe error when WriterInterceptor is invoked.
If we remove the @timeout annotation we don't see the error.
We actually see the error in our service code called by the endpoint in our app, and also in a request scoped writer interceptor during the same request. I wasn't able to recreate the issue in code called by the endpoint in a simple app, but could get it with the WriterInterceptor setup. So not necessarily tied to use of a request scoped interceptor, but just the simplest app I could recreate with.
The text was updated successfully, but these errors were encountered:
@gmpatter I'm able to reproduce the problem: I see that I need both the FT annotation and the interceptor in request scope. Without one of those, I don't see the error. Will investigate.
Environment Details
Problem Description
"No active contexts for scope type javax.enterprise.context.RequestScoped" seen when using Fault Tolerance annotations and Request Scope in Helidon MP application.
Full stack trace:
Steps to reproduce
Create a JAXRS Application:
Create a Resource class with Fault Tolerance annotation on an endpoint:
WriterInterceptor:
Hit endpoint, observe error when WriterInterceptor is invoked.
If we remove the @timeout annotation we don't see the error.
We actually see the error in our service code called by the endpoint in our app, and also in a request scoped writer interceptor during the same request. I wasn't able to recreate the issue in code called by the endpoint in a simple app, but could get it with the WriterInterceptor setup. So not necessarily tied to use of a request scoped interceptor, but just the simplest app I could recreate with.
The text was updated successfully, but these errors were encountered: