Question

Getting a @SessionScoped CDI bean from inside a Filter is relatively easy. But trying to inject a @ConversationScoped bean throws the following error:

org.jboss.weld.context.ContextNotActiveException:
WELD-001303 No active contexts for scope type javax.enterprise.context.ConversationScoped

This is independent of whether or not a conversation is currently active. It seems like CDI can not determine whether a transient or active conversation should be used because my filter happens before whatever provides the context for @ConversationScoped beans.

What kind of filter / interception mechanism could be used that happens "late enough"?

Was it helpful?

Solution

I'm not sure how other implementations do this, but at least Weld uses a Filter itself to handle conversations, so your filter would need to be after that one in the filter chain.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top