MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
seps@wanadoo.es
Post subject: Spring DataAccessException - detailMessage  PostPosted: Jun 30, 2011 - 07:48 AM
Registered Member
Registered Member


Joined: Jul 21, 2010
Posts: 15

Hi,

I've got a small problem that I havenĀ“t been able to resolve. I've got a class that handles Spring DataAccessException (which is wrapped by a client specific class DAOException).

Code:
public class DAOException extends DataAccessException


On certain errors, as shown below, the cause is null and any getMessage returns null. However, as can be seen below (which is a paste from what I see in the Variables window of the debugger), one can see a detailMessage field that explains the error.

ex DAOException (id=1823)
cause null
cause DAOException (id=1823)
detailMessage "There is no statement named GaeTablDgnf.selectDgnfForUserList in this SqlMap." (id=3828)
stackTrace null
walkback int[56] (id=1806)

How can I extract this detailMessage? Data acess is via iBatis.

Would appreciate any insight.

Thanks,
Bill
 
 View user's profile Send private message  
Reply with quote Back to top
jkennedy
Post subject: RE: Spring DataAccessException - detailMessage  PostPosted: Jun 30, 2011 - 09:27 PM



Joined: Jan 27, 2010
Posts: 245

Bill,
Did you try the getMostSpecificCause method on the wrapped exception.

http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/core/NestedRuntimeException.html#getMostSpecificCause()

Thanks,
Jack
 
 View user's profile Send private message  
Reply with quote Back to top
seps@wanadoo.es
Post subject:   PostPosted: Jul 01, 2011 - 04:51 AM
Registered Member
Registered Member


Joined: Jul 21, 2010
Posts: 15

Hi Jack,

I tried every method that returns a String all the way up the hierarchy through RuntimeException and even up to Throwable. Either I missed one or you guys are doing something undocumented to show this "detailMessage" in the debugger variables.

Bill
 
 View user's profile Send private message  
Reply with quote Back to top
jkennedy
Post subject:   PostPosted: Jul 05, 2011 - 08:09 PM



Joined: Jan 27, 2010
Posts: 245

Hey Bill,
We are not doing anything specific in the debugger window.
I believe the default debugger view will simply call toString on the object.
You can confirm this by opening the "Display" view, and typing in code that would be something like: myObject.toString().
Highlight this code and right click and choose "display" and see what it returns.
Try executing various methods on the Object in the display view to see if you can get to one that returns this string.
Also, let me know if you are able to see this description on the Root exception or one of the Nested exceptions. What does the Object hierarchy look like.
I believe that what you are seeing is the toString on the lowest level exception in the stack which is likely being hit through the toString() and getMessage() calls in the Object hierarchy.

Thanks,
Jack
My guess is that what you may actually be seeing is the toString() on the nested exception that is coming from
 
 View user's profile Send private message  
Reply with quote Back to top
seps@wanadoo.es
Post subject:   PostPosted: Jul 06, 2011 - 12:21 PM
Registered Member
Registered Member


Joined: Jul 21, 2010
Posts: 15

Hi Jack,

I've tried toString and of course it just returns the class name and instance ref; retried a bunch of other stuff too with the same results. Just in case my previous explanation was less than adequate, I took a screen shot of exactly what I see and wanted to attach it but I don't know how. It looks like I need to put it on a http server that has public access which mine doesn't. Is there any way to attach a file directly? Can I send it to you by e-mail?

So I'll try to repeat the information with some additional clarification.

Code:

ex DAOException (has exactly the same info available as Spring's DataAccessException)
cause null  (this is the pointer I need to getMessage, ... etc.)
cause DAOException (id=1823)  (this is some kind of strange nesting of exactly the same info and it looks like it goes on forever)
detailMessage "There is no statement named GaeTablDgnf.selectDgnfForUserList in this SqlMap." (id=3828)  (THIS IS WHAT I WANT)
stackTrace null  (no idea why this is null, I can print a stack trrace but it doesn't clarify nything)
walkback int[56] (id=1806)  (I suppose this applies to the stack trace)



I really would like to get this resolved.

Thanks,
Bill
 
 View user's profile Send private message  
Reply with quote Back to top
jkennedy
Post subject:   PostPosted: Jul 06, 2011 - 02:38 PM



Joined: Jan 27, 2010
Posts: 245

Bill,
Your message was clear, but thank you for the additional clarification.

I was trying to offer guidance as to how you may want to try to get into the Object graph such that you could discover the origination of the DetailMessage string since this is not really a tooling issue.

You can send me an email at jkennedy@skywaysoftware.com and I will take a look, but ultimately, you may need to load the source for the Object Graph into your IDE and put breakpoints in to find the "public" path in the Exception graph to the message you are looking for. I understand that it is frustrating to be able to see something you need in the debugger and not find a public path to that information.

Thanks,
Jack
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits