[webbeans-issues] [JBoss JIRA] Created: (WBRI-401) For Transaction Events: Event Firing Before Transaction Completes Causes Exception

Roger Kitain (JIRA) jira-events at lists.jboss.org
Tue Sep 29 10:04:49 EDT 2009


For Transaction Events: Event Firing Before Transaction Completes Causes Exception
----------------------------------------------------------------------------------

                 Key: WBRI-401
                 URL: https://jira.jboss.org/jira/browse/WBRI-401
             Project: Web Beans
          Issue Type: Bug
          Components: Events
    Affects Versions: 1.0.0.CR1
         Environment: Mac OS X, GlassFish V3
            Reporter: Roger Kitain
            Assignee: David Allen
             Fix For: 1.0.0.CR1


Simple web application:
- ui has a single button "Save"
- one Web Bean uses javax.transaction.UserTranaction to begin() and commit() transaction:

@Named
@ApplicationScoped
public class Bean implements Serializable {
   private static final long serialVersionUID = 1L;

   @Resource private UserTransaction utx;
   @Inject @Any Event<String> event1;

   public Bean() {
   }

   public String save() {
       try {
           utx.begin();
           event1.select(new AnnotationLiteral<Updated>(){}).fire("Fired using Event Interface with AnnotationLiteral.");
           utx.commit();
       } catch (Exception e) {
       }
       return null;
   }
 
   public void eventObserver(@Observes(during=TransactionPhase.AFTER_COMPLETION) @Updated String s) {
       FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("AfterCompletion Event Recieved!"));
   }
} 

The fact that the firing of the event happens before utx.commit() causes this exception:

Sep 28, 2009 11:50:58 PM org.apache.catalina.core.StandardWrapperValve log
WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
javax.enterprise.context.ContextNotActiveException: No active contexts for scope type javax.enterprise.context.RequestScoped
   at org.jboss.webbeans.BeanManagerImpl.getContext(BeanManagerImpl.java:860)
   at org.jboss.webbeans.bean.proxy.ClientProxyMethodHandler.getProxiedInstance(ClientProxyMethodHandler.java:137)
   at org.jboss.webbeans.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:96)
   at org.jboss.webbeans.conversation.ConversationImpl_$$_javassist_12.toString(ConversationImpl_$$_javassist_12.java)
   at java.lang.String.valueOf(String.java:2827)
   at java.lang.StringBuilder.append(StringBuilder.java:115)
   at org.jboss.webbeans.conversation.AbstractConversationManager.cleanupConversation(AbstractConversationManager.java:131)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.jboss.webbeans.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:110)
   at org.jboss.webbeans.conversation.ServletConversationManager_$$_javassist_11.cleanupConversation(ServletConversationManager_$$_javassist_11.java)
   at org.jboss.webbeans.jsf.WebBeansPhaseListener.afterRenderResponse(WebBeansPhaseListener.java:128)
   at org.jboss.webbeans.jsf.WebBeansPhaseListener.afterPhase(WebBeansPhaseListener.java:99)
   at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:179)
   at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:103)
   at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:311) 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the weld-issues mailing list