facebook

Spring DataAccessException – detailMessage

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #317846 Reply

    Bill
    Participant

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

    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

    #317864 Reply

    jkennedy
    Member

    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

    #317871 Reply

    Bill
    Participant

    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

    #317959 Reply

    jkennedy
    Member

    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

    #317977 Reply

    Bill
    Participant

    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.

    
    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

    #317992 Reply

    jkennedy
    Member

    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

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Spring DataAccessException – detailMessage

You must be logged in to post in the forum log in