0
votes
java - How do I get a ConversationScoped CDI bean from inside a Filter? - Stack Overflow
Asked
Viewed 416 times
0

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"?

    0

    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.

    1
    • Since there seems to be no satisfying solution to the problem, I'll accept your answer.
      – rluba
      Jun 11 2014 at 4:58

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

    Not the answer you're looking for? Browse other questions tagged or ask your own question.

     
    1

    1 Answers

    0
    votes

    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.