Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
18. Aug 2008, 20:38 CET | Link

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,

 
Please don't forget to rate

I believe that imagination is stronger than knowledge -- myth is more potent than history -- dreams are more powerful than facts -- hope always triumphs over experience -- laughter is the cure for grief -- love is stronger than death.

9 Replies:
18. Aug 2008, 21:24 CET | Link

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

 
Please don't forget to rate

I believe that imagination is stronger than knowledge -- myth is more potent than history -- dreams are more powerful than facts -- hope always triumphs over experience -- laughter is the cure for grief -- love is stronger than death.

19. Aug 2008, 00:42 CET | Link

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.

19. Aug 2008, 00:53 CET | Link
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?

 
Please don't forget to rate

I believe that imagination is stronger than knowledge -- myth is more potent than history -- dreams are more powerful than facts -- hope always triumphs over experience -- laughter is the cure for grief -- love is stronger than death.

19. Aug 2008, 01:02 CET | Link

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

19. Aug 2008, 02:12 CET | Link

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).

 
Please don't forget to rate

I believe that imagination is stronger than knowledge -- myth is more potent than history -- dreams are more powerful than facts -- hope always triumphs over experience -- laughter is the cure for grief -- love is stronger than death.

19. Aug 2008, 09:33 CET | Link

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.

19. Aug 2008, 17:17 CET | Link
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.

 
Please don't forget to rate

I believe that imagination is stronger than knowledge -- myth is more potent than history -- dreams are more powerful than facts -- hope always triumphs over experience -- laughter is the cure for grief -- love is stronger than death.

19. Aug 2008, 17:46 CET | Link

Has been rejected.

19. Aug 2008, 18:03 CET | Link

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.

 

Check out my weblog or have a look at the books I wrote.