1 Reply Latest reply on Mar 24, 2011 4:46 PM by alots

    ConversationScoped org.jboss.weld.context.ContextNotActiveException with JSF2

    alots

      Hi, i looked over internet and here at seam forum about jsf2 and ConversationScoped context. I'm trying to emulate a viewscoped context with the Conversation. It's like a shopping cart view, after the first adding i begin the conversation. When the client finalize, i call the end() method. I can add the fisrt item, but after the first request i'm getting:


      Sorry, i tried but i was doing some stupid thing and code blocks did not work.


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



      My code is simple:


      @Named
      @ConversationScoped
      public class NotaFiscalBean implements Serializable{
              private Item item;
              private NotaFiscal notaFiscal;
              @Inject
              private Conversation conversation;


              public void adicionaItem() {
                      if(conversation.isTransient()) {
                              conversation.begin();
                      }
                      item.setProduto(produto);              
                      notaFiscal.adicionaItem(item);
               }


              public void adiciona() {
                      dao.adiciona(notaFiscal);
                      conversation.end();



      What am i missing?


      tks,


      Alberto