MyEclipse: Spring DataAccessException - detailMessage
email@example.com - Jun 30, 2011 - 07:48 AM
Post subject: Spring DataAccessException - detailMessage
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).
|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 DAOException (id=1823)
detailMessage "There is no statement named GaeTablDgnf.selectDgnfForUserList in this SqlMap." (id=3828)
walkback int (id=1806)
How can I extract this detailMessage? Data acess is via iBatis.
Would appreciate any insight.
jkennedy - Jun 30, 2011 - 09:27 PM
Post subject: RE: Spring DataAccessException - detailMessage
Did you try the getMostSpecificCause method on the wrapped exception.
firstname.lastname@example.org - Jul 01, 2011 - 04:51 AM
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.
jkennedy - Jul 05, 2011 - 08:09 PM
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.
My guess is that what you may actually be seeing is the toString() on the nested exception that is coming from
email@example.com - Jul 06, 2011 - 12:21 PM
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.
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 (id=1806) (I suppose this applies to the stack trace)
I really would like to get this resolved.
jkennedy - Jul 06, 2011 - 02:38 PM
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 firstname.lastname@example.org 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.
All times are GMT - 6 Hours
Powered by PNphpBB2
© 2003-2004 The PNphpBB GroupCredits