[jboss-user] [JBoss Seam] - Re: handling exceptions

efabiano do-not-reply at jboss.com
Thu Feb 1 11:28:23 EST 2007


Well, I´ve tried to reproduce this behavior using a seam booking example project 
and the same error happened (I coudn´t catch the correct exception using exception.xml)

The steps I did were:

1. First, I installed a new Jboss AS 4.05 instalation with EJB 3.0
2. I downloaded new seam 1.1.5 
3. I deployed contatc list and booking example aplications on new jboss
4. Using contact list, exception handling with exceptions.xml worked perfectly
5. I changed booking example (which my application was based) in order to use exception.xml
	
	a) first I created exception.xml in the correct folder
	
	b) then, I changed booking example so I could test referencial integrety exceptions
	
	In main.xhtml I included this lines for hotels grid

		<h:column>
  | 			<f:facet name="header">remove</f:facet>
  | 			<s:link id="remove" value="remove" action="#{hotelBooking.removeHotel(hot)}"/>
  | 		</h:column>

	In HotelBookingAction I added this method:
 
		   public void removeHotel(Hotel selectedHotel)
  | 		   {
  | 		      em.remove(em.merge(selectedHotel));
  | 		      hotel = new Hotel();
  | 		   }

	My exceptions.xml file:

	< exceptions>
  | 		   
  | 		   < exception class="javax.persistence.PersistenceException">
  | 		      <redirect view-id="/register.xhtml">Unexpected failure persistence</redirect>
  | 		      <end-conversation/>
  | 		   < /exception>
  | 		   
  | 		   < exception class="org.jboss.seam.framework.EntityNotFoundException">
  | 		      <redirect view-id="/register.xhtml">Unexpected failure entity no found</redirect>
  | 		      <end-conversation/>
  | 		   < /exception>
  | 		   
  | 		   < exception class="org.hibernate.exception.GenericJDBCException">
  | 		      <redirect view-id="/register.xhtml">Unexpected generic</redirect>
  | 		      <end-conversation/>
  | 		   < /exception>		
  | 		
  | 		   <exception class="org.jboss.tm.JBossRollbackException">
  | 		      <redirect view-id="/register.xhtml">Unexpected failure rollback</redirect>
  | 		      <end-conversation/>
  | 		   </exception>
  | 		
  | 		
  | 		   <exception class="java.lang.RuntimeException">
  | 		      <redirect view-id="/register.xhtml">Unexpected failure run time</redirect>
  | 		      <end-conversation/>
  | 		   </exception>
  | 		
  | 		
  | 		   <exception >
  | 		      <redirect view-id="/register.xhtml">Unexpected failure geral</redirect>
  | 		      <end-conversation/>
  | 		   </exception>
  | 		</exceptions>
	c) then, I run booking application and added some hotels bookings.

	d) Finally, I tried remove a hotel with bookings in order to raise a referencial integrety exception. The exception.xml file was read by seam,
	   but the exception captured was java.lang.RuntimeException!!!


What do I need to do for seam exception handling works in this example?

tks in advance

emerson fabiano




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

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




More information about the jboss-user mailing list