Andrus,
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. 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?
Thanks,
Joseph
On 11/29/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
>
> > if (dataContext == null)
> > {
> > log.info ("Current thread has NULL DataContext- Creating.") ;
> > dataContext = DataContext.createDataContext() ;
> > DataContext.bindThreadDataContext(dataContext) ;
> > }
>
> The code above will NOT do the right thing. Instead you may use a new
> ServletUtil class to make sure the context is not only bound to the
> thread, but also to the current session:
>
> if (dataContext == null)
> {
> log.info ("Current thread has NULL DataContext- Creating.") ;
>
> // how you get a hold of HttpSession - I don't know...
> // I know next to nothing about HiveMind
> dataContext = ServletUtil.getSessionContext(session);
> DataContext.bindThreadDataContext(dataContext) ;
> }
>
>
> Still consider that WebApplicationContextProvider would always create
> a new session if one doesn't yet exist. So I don't understand why
> would null thread DataContext ever occur. Maybe you should remove the
> try/catch and let the exception be thrown and then investigate why it
> happens?
>
> Andrus
>
>
This archive was generated by hypermail 2.0.0 : Tue Nov 29 2005 - 13:47:57 EST