Re: Please help: retrieval and proper usage of per thread DataContext

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Nov 29 2005 - 15:38:01 EST

  • Next message: Joseph Hannon: "Re: Please help: retrieval and proper usage of per thread DataContext"

    On Nov 29, 2005, at 9:47 PM, Joseph Hannon wrote:

    >
    > Did a little more testing with my code and based on your suggestion
    > (thanks!). Specifing WebApplicationContextProvider in web.xml, I
    > started calling DataContext.getThreadDataContext() to see what
    > would happen. It would give me an IllegalStateException: Current
    > thread has no bound DataContext in DataContext.java line 223.

    I suggested this as a starting point for your investigation into the
    problem. I really can't tell why some requests would bypass the
    listener and some other will not... Maybe a bug in the container or
    something? Another debugging hint - you can subclass
    WebApplicationContextProvider and override "requestInitialized"
    method to add some debug statements to see whether it is called at all.

    > Only when I would assign a context would this call work, which you
    > mention is not correct. I would generate multiple requests and
    > watched a few threads being used, and none of them had a
    > DataContext. Any ideas?

    You can replace your code with the code I suggested in the previous
    message (the one using ServletUtil). It should be more robust. While
    I still suspect the problem is elsewhere, this may fix it for you in
    the interim.

    Andrus



    This archive was generated by hypermail 2.0.0 : Tue Nov 29 2005 - 15:38:03 EST