[jboss-user] [JBoss Seam] - Re: Missing exceptions within asynchronious methods

gbc@gmx.de do-not-reply at jboss.com
Wed Aug 22 17:40:04 EDT 2007


Ok, full working example code, tested just now. 

First post regarding the missing RuntimeException (Second post follows later after coding example...):

Interface:

  | package org.esit.server.sessionbeans;
  | 
  | import javax.ejb.Local;
  | 
  | @Local
  | public interface Blob {  
  |     
  | 	public boolean isAvailable();
  | 	
  | 	public void raiseBlob();
  | 	
  | 	public void observeBlob();
  | 	
  | 	public void destroy();
  | 	
  | }
  | 

SessionBean:

  | package org.esit.server.sessionbeans;
  | 
  | import javax.ejb.Remove;
  | import javax.ejb.Stateful;
  | 
  | import org.jboss.seam.annotations.Begin;
  | import org.jboss.seam.annotations.End;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Observer;
  | import org.jboss.seam.core.Events;
  | import org.jboss.seam.faces.FacesMessages;
  | 
  | @Stateful
  | @Name("blob")
  | public class BlobAction implements Blob {
  | 
  | 	@In FacesMessages facesMessages;
  | 
  | 	@In Events events;
  | 	
  | 	public boolean isAvailable() {
  | 		boolean out = true;
  | 		facesMessages.add("isAvailable(): #0", out);
  | 		return out;
  | 	}
  | 
  | 	@Begin
  | 	@End
  | 	public void raiseBlob() {
  | 		facesMessages.add("raiseEvent() called");
  | 		events.raiseAsynchronousEvent("blob");
  | 	}
  | 	
  | 	@Observer("blob")
  | 	public void observeBlob() {
  | 		System.out.println("blob");
  | 		throw new RuntimeException("blob");
  | 	}
  | 
  | 	@Remove
  | 	public void destroy() { }
  | }
  | 
  | 

Called by blob.xhtml (seam generated and edited)

  | <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  |                              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  | <ui:composition xmlns="http://www.w3.org/1999/xhtml"
  |                 xmlns:s="http://jboss.com/products/seam/taglib"
  |                 xmlns:ui="http://java.sun.com/jsf/facelets"
  |                 xmlns:f="http://java.sun.com/jsf/core"
  |                 xmlns:h="http://java.sun.com/jsf/html"
  |                 xmlns:rich="http://richfaces.ajax4jsf.org/rich"
  |                 xmlns:a="https://ajax4jsf.dev.java.net/ajax"
  |                 template="layout/template.xhtml">
  |                        
  | <ui:define name="body">
  | 
  |     <h:messages globalOnly="true" styleClass="message"/>
  | 
  |     <rich:panel>
  |         <f:facet name="header">blob</f:facet>
  |     
  |         <h:form id="blobActionForm">
  |         
  |             <h:commandButton id="isAvailable" value="isAvailable!" 
  |                              action="#{blob.isAvailable}"/>     			  
  | 
  |             <h:commandButton id="raiseBlob" value="raiseBlob!" 
  |                              action="#{blob.raiseBlob}"/>     			  
  |         
  |         </h:form>
  |         
  |     </rich:panel>
  | 
  | </ui:define>
  | 
  | </ui:composition>
  | 

Fresh seam-gen project, no further configuration gives only following Server output on JBoss 4.2 (using Java 1.5 Beta 12 and Seam 2.0 Beta1):

  | ...
  | 23:31:40,437 INFO  [STDOUT] blob
  | ...
  | 

But no sign of the RuntimeException. I tried to throw the RuntimeException in method raiseBlob() directly and voilá, there it is as expected.

Missing RuntimeException, where are you?

Note: Just tested without

  | 	@Begin
  | 	@End
  | 
with same effect

Greetz, GHad

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077075#4077075

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077075




More information about the jboss-user mailing list