11 Replies Latest reply on Jan 2, 2009 7:02 PM by kukeltje.ronald.jbpm.org

    Seam Remoting: No exceptions support!

      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,

        • 1. Re: Seam Remoting: No exceptions support!

          Where was ignored JBSEAM-633 , perhaps JBSEAM-3279 will have success? ;-)

          • 2. Re: Seam Remoting: No exceptions support!
            shane.bryzak

            JBSEAM-633 is still on my list of things to do, it just got pushed to the back burner for a while.  Also I haven't seen a solution that I like enough yet.

            • 3. Re: Seam Remoting: No exceptions support!

              Shane Bryzak wrote on Aug 19, 2008 00:42:


              JBSEAM-633 is still on my list of things to do, it just got pushed to the back burner for a while.  Also I haven't seen a solution that I like enough yet.


              And I guess that you also don't like the idea of leaving that for the DWR guys (as JBSEAM-3279 suggests) ;-). Why DWR can not be extended to support conversations? Has anyone proposed the idea to the DWR guys?

              • 4. Re: Seam Remoting: No exceptions support!
                shane.bryzak

                If the DWR guys would like to suggest a nice solution for handling exceptions in Seam Remoting, that's fine by me ;)

                • 5. Re: Seam Remoting: No exceptions support!

                  Why don't you just deal with exceptions the same way DWR does it (AFAIK)?, (and as initially proposed by the initial poster of JBSEAM-633), by adding an extra callback function that deals with failures, and receives an object with the same information the exception has, treating exceptions as if they were beans (or maps or associative arrays if you prefer). Leave the stacktrace for a later release (or never), but include the causing exceptions in the information sent to the  client)


                  That way, Java code that is already using exceptions can be used transparently from JavaScript, if someone created his custom exception class with special properties, then those would be propagated to Javascript as if they were bean properties. Let this be on  2.1.0.A1 (it would be great if available on 2.0.3.CR1, but that maybe dreaming too much).


                  Worry about stuff like extra internationalization support, hooking custom exceptions handlers, and stacktrace serialization for a later (after 2.0.3.CR1 or in 2.1.0.A1 release).

                  • 6. Re: Seam Remoting: No exceptions support!
                    obfuscator

                    I totally agree with integrating DWR. They did a lot of work on security, and it just works wonders. The scope thinking is already there, they have alternative ways of doing callbacks, a really good debug page, a superb java-js bridge and lots more. Its a mature technology and reinventing it is just silly. It also can't be too hard to integrate, since it already has been adapted for other technologies.

                    • 7. Re: Seam Remoting: No exceptions support!

                      Alexander T wrote on Aug 19, 2008 09:33:


                      I totally agree with integrating DWR.

                      Great, please login to JIRA (it is free) and  vote for JBSEAM-3279 :-)


                      They did a lot of work on security, and it just works wonders. The scope thinking is already there, they have alternative ways of doing callbacks, a really good debug page,


                      One more reason to add support for DWR (or another feature to re-implement for Seam Remoting)


                      a superb java-js bridge and lots more. Its a mature technology and reinventing it is just silly. It also can't be too hard to integrate, since it already has been adapted for other technologies.


                      Please don't get me wrong, Seam Remoting is great work, but DWR is more mature, and Seam already reutilizes a lot of third party frameworks instead of reinventing the wheel (JSF, GWT, iText, JMS, JPA), with that background integrating with DWR seems like logical choice.


                      • 8. Re: Seam Remoting: No exceptions support!
                        obfuscator

                        Has been rejected.

                        • 9. Re: Seam Remoting: No exceptions support!
                          christian.bauer

                          Which doesn't mean that YOU can't write DWR integration for Seam and submit it to the project. I'm sure that when it has the same feature set as Seam Remoting has now, and you also considered a migration path, it won't be a rejected issue.


                          • 10. Re: Seam Remoting: No exceptions support!
                            kukeltje.ronald.jbpm.org

                            I'm currently deciding on whether to remove dwr from a very nice project (this would mean creating a dojo-seam-remoting bridge) or to try to adapt it and make dwr seam aware. I've already experimented with custom servlet filters and adding conversation scope 'awareness' to them. I've looked at how the GWT, and other things are implemented in seam to make those technologies seam aware as well. Since this scope is part of webbeans spec as well, I tend to go for changing DWR. If anybody with some more experience in this area can second my reasoning I'll go for it.

                            • 11. Re: Seam Remoting: No exceptions support!
                              kukeltje.ronald.jbpm.org