File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Question about server error handling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Question about server error handling" Watch "Question about server error handling" New topic
Author

Question about server error handling

AutinHorse
Greenhorn

Joined: Jan 14, 2002
Posts: 5
In the "Marking" part on my assignement document, they said they will give score for server error handling, but I can not find any thing special for server to do the error handling. I only catch all the IO or DB exception, new RemoteException and throw them out. In the client side, I catch all exception, for all the exception, I show a message box and then System.exit().
Is it OK or I need do something more?
Thank for any suggestion.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

For the most part, yes. But waht about an exception that occurs when you start up the server. No client has started, so who is it supposed to forward these exceptions too? Let alone if there was many clients, which client gets that error?
So you need the same solution as the client side for the server side for exceptions that occur on the server side, so on that side also have a Message that pops up telling the user the error.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
hao li
Greenhorn

Joined: Jul 24, 2002
Posts: 21
For the most part, yes. But waht about an exception that occurs when you start up the server. No client has started, so who is it supposed to forward these exceptions too? Let alone if there was many clients, which client gets that error?
Hi Mark,
Can you give me more detail about it. I really
don't catch you.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi hao,
I think what Mark is trying to say is there are errors that are specific to the server and errors that are specific to individual clients. For example on server startup a BindException or maybe even MalformedURLException could be thrown. If there were a tricky bug on the client that occasionally creates a poorly formed record for modify and causes a DatabaseException to be thrown, you certainly wouldn't want every connected client to receive that exception.
Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
hao li
Greenhorn

Joined: Jul 24, 2002
Posts: 21
If there were a tricky bug on the client that occasionally creates a poorly formed record for modify and causes a DatabaseException to be thrown, you certainly wouldn't want every connected client to receive that exception.
But in my design, every client has its own remote
database object using singleton pattern, It seems
a DatabaseException of one client will not affect
the other cleint. Is it right?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Hao,

But in my design, every client has its own remote
database object using singleton pattern, It seems
a DatabaseException of one client will not affect
the other cleint. Is it right?

Yep. As long as each client has its own connection object, then RMI will marshall all the exceptions and send them to that client.
Michael Morris
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Question about server error handling