I need to inject a ConversationScoped
bean into a servlet. i use the standard simple @Inject
tag and I invoke the servlet with the cid parameter but when it invokes any method in the injected bean I get the following error:
org.jboss.weld.context.ContextNotActiveException
:WELD-001303
No active contexts for scope typejavax.enterprise.context.ConversationScoped
Can I inject these beans in servlets or I can inject only Session and Request scoped beans?
What is the equivalent of ConversationContext proposed in the previous answer in Java EE if we don't use Weld?
In a servlet the context is application context that's why you loose conversation scope. Here is a small utility class that you can use as an anonymous class and wrap the request with if you want conversation scope support in servlets...