• Post Reply Bookmark Topic Watch Topic
  • New Topic

TUSC Tutorial's DAO Implementation's Exception Handling Bad?

 
Ken Loh
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Chapter 3 of TUSC Tutorial shows how a DAO can be used behind a session facade.

However, the exceptions that could happen in the DAO implementation once caught are neither rethrown or act upon besides being printed to System.out . Meaning:



What is the good practice for handling exception in a DAO implementation class ?

Any help would be very much appreciated.
[ April 12, 2005: Message edited by: Ken Loh ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
408
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ken,
The best practice is for the DAO to log the exception and the rethrow it for the session bean to handle. This allows any client of the DAO to respond appropriately. It's not the DAOs decision that the exception should be ignored.
 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ken for your reply to me on other post.

I hope you help me resolve my problem below.

I am trying for the same assignment at TUSC.

But having trouble with setup.
I could run Jboss successfully from command prompt, run the Database scripts as per the steps given in the tutorial.
Then I have installed Lomboz with necesory changes inthe setup file.

but when I go to next step i.e. Configure JBOSS to run from within Eclipse. I am having some problems.

I am using windows.
Used eclipse-SDK-2.1-win32.zip to install Eclipse 2.1
Which seem to be having bit different options than seen in the tutorial.

Here is where I am seeing some differences which might be causing problem.-

Go to the Lomboz node under the Preferences window. Make sure JDK Tools.jar is set to $JAVA_HOME/lib/tools.jar

I have set up
JDK Tools.jar to C:\Sun\AppServer\jdk\lib\toos.jar
As I have
set JAVA_HOME=C:\Sun\AppServer\jdk
set CLASSPATH=C:\Sun\AppServer\jdk\lib\tools.jar

Next step is --
Go to the server definitions sub node under Lomboz node.
Here I see my Eclipse is having 4 tabs wheras tutorial is refering to only 2.
Anyway everything is filled in properly with no red cross marks.

Next Step is --
And now verify your 'Classpath Variables'.
Go to Window > Preferences > Java > Classpath Variables

JRE_LIB(reserved) C:\ProgramFiles\Java\j2re1.4.2_08\lib\rt.jar
JRE_SRC(reserved) empty
JRE_SRCROOT empty

Where as as per the tutorial-
JRE_LIB(reserved) usr/java/j2sdk1.4.1_02/jre/lib/rt.jar
JRE_SRC(reserved) usr/java/j2sdk1.4.1_02/src.zip
JRE_SRCROOT empty

I assigned value for JRE_LIB by searching for rt.jar file.
No src.zip file is found on my machine , so I could not assign value to JRE_SRC

Please help me resolve this.

Thanks for your patience.
Gemini
 
Ken Loh
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd got the same problem before.

The problem vanished when I copied "mysql-connector-java-3.0.14-production-bin.jar" from [my module]/WEB-INF/lib to my JBoss /lib and /server/deploy/lib to solve another problem.

Could it be that when I started my JBoss, an error occurred but not displayed ? I don't have an answer as the problem was gone without me consciously doing something about it. I was prepared to settle to start JBoss from the command prompt then.

In retrospect, I think what you could try* is to have all the lib folders having the same jar files and see what happens. Then, using binary elimination, you can remove some jar files to eliminate non-solutions.

A better solution is to try installing Sysdeo's Tomcat Plugin and/or JBoss-IDE Plugin. Either of them should be able to get rid of your problem.

* - Back up your JBoss and your project workspace before making any change !

Originally posted by Gemini Moses:
Thanks Ken for your reply to me on other post.

I hope you help me resolve my problem below.

I am trying for the same assignment at TUSC.

But having trouble with setup.
I could run Jboss successfully from command prompt, run the Database scripts as per the steps given in the tutorial.
Then I have installed Lomboz with necesory changes inthe setup file.

but when I go to next step i.e. Configure JBOSS to run from within Eclipse. I am having some problems.

I am using windows.
Used eclipse-SDK-2.1-win32.zip to install Eclipse 2.1
Which seem to be having bit different options than seen in the tutorial.

Here is where I am seeing some differences which might be causing problem.-

Go to the Lomboz node under the Preferences window. Make sure JDK Tools.jar is set to $JAVA_HOME/lib/tools.jar

I have set up
JDK Tools.jar to C:\Sun\AppServer\jdk\lib\toos.jar
As I have
set JAVA_HOME=C:\Sun\AppServer\jdk
set CLASSPATH=C:\Sun\AppServer\jdk\lib\tools.jar

Next step is --
Go to the server definitions sub node under Lomboz node.
Here I see my Eclipse is having 4 tabs wheras tutorial is refering to only 2.
Anyway everything is filled in properly with no red cross marks.

Next Step is --
And now verify your 'Classpath Variables'.
Go to Window > Preferences > Java > Classpath Variables

JRE_LIB(reserved) C:\ProgramFiles\Java\j2re1.4.2_08\lib\rt.jar
JRE_SRC(reserved) empty
JRE_SRCROOT empty

Where as as per the tutorial-
JRE_LIB(reserved) usr/java/j2sdk1.4.1_02/jre/lib/rt.jar
JRE_SRC(reserved) usr/java/j2sdk1.4.1_02/src.zip
JRE_SRCROOT empty

I assigned value for JRE_LIB by searching for rt.jar file.
No src.zip file is found on my machine , so I could not assign value to JRE_SRC

Please help me resolve this.

Thanks for your patience.
Gemini
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!