11 Replies Latest reply on Jan 2, 2009 7:02 PM by Ronald van Kuijk

    Seam Remoting: No exceptions support!

    Francisco Jose Peredo Noguez Master

      Hi!


      As I maybe mentioned in a another post I am trying to migrate a DWR/Spring application into Seam Remoting, and  I have to say that I am again... shocked, I thought this was going to be easy to do, but it is turning into really hard thing to do due to Seam Remoting limitations, first because of the lack of support for associative arrays (first show stopper) and now, because of the lack of support for exception propagation (second show stopper), I read all the documentation on remoting and it doesn't  mention exception handling/propagation, not even once.


      I found this thread Seam Remoting and exception propagation, but JBSEAM-633 the main JIRA issue it references looks somewhat abandoned, it is marked as optional, last comment was in 01/Dec/07 , it hasn't been solved since 1.1.0.GA and Time Traking and Fix Version/s are both unspecified.


      On the other hand exception propagation in DWR can be enabled in a really easy way (by writing the following in the spring context configuration file:


       <dwr:convert class="java.lang.Exception" type="exception"/>
      




      It is also really easy to use, one just have to pass another callback function as a parameter (BTW in this case I use the log4js to log in case of an error) :


          remoteService.isUserEnabled(form.username.value,form.passwd.value,
                      {
                          callback:function(disabled) { 
                              if(disabled){
                                  alert("The user is disabled");
                              }
                              else{                                                
                                  alert("The user is enabled");
                              }
                          },
                          errorHandler:function(errorString, exception) { 
                              log.debug(errorString);
                              log.debug(exception.message);            
                              log.debug(exception.javaClassName);                        
                          }
                      });
      



      and it is even able to propagate the stack trace to JavaScript for debugging purposes:


       <dwr:convert class="java.lang.StackTraceElement" type="bean"/>
      



      I really think JBSEAM-633, should be given more priority, I really think I shouldn't need to change the API of my services to support exceptions, since even the much dreaded SOAP web services support them!


      Again, on the other hand, if this really is not a priority, I think that if (and I really hope I don't offend anyone by writing this) with Hibernate, whenever someone suggested something that would have transformed it in something different from a POJO persistence service, the answer was always pretty much hibernate is designed to do one thing, and only one thing very well: be a persistence service for POJOs, I think that perhaps Seam should follow a similar principle and offer integration with DWR, that way, it would give the job of handling remoting to DWR (in that way DWR guys can concentrate in what they do best (remoting), and Seam guys can concentrate in what Seam does best: integration of different technologies), as it did by integrating with JSF, GWT, iText, JMS, JPA, etc, instead of reinventing them.


      Regards,