Hmmm... perhaps some sort of callback interface where code that needs to do
something from a separate thread can do something, and the executor can
ensure that a hibernate session is there.

An alternative would be an different hibernate configuration... like
disabling lazy loading which you pay a performance hit for.

I also believe with spring there is a way to proxy in such a way that
creates sessions on demand etc... to be honest i am a bit ignorant when it
comes to hibernate.

On Tue, Jan 24, 2012 at 4:06 PM, Gabriel Roldan <grol...@opengeo.org> wrote:

> On Tue, Jan 24, 2012 at 7:33 PM, Justin Deoliveira <jdeol...@opengeo.org>
> wrote:
> >
> >
> > On Tue, Jan 24, 2012 at 3:26 PM, John Armstrong <john.armstr...@ccri.com
> >
> > wrote:
> >>
> >> On Tue, 24 Jan 2012 15:21:15 -0700, Justin Deoliveira
> >> <jdeol...@opengeo.org> wrote:
> >> > And sorry, by disable i mean remove the jars. Or perhaps just the
> >> diskquota
> >> > jar might do it, not 100% sure.
> >> >
> >> > On Tue, Jan 24, 2012 at 3:20 PM, Justin Deoliveira
> >> > <jdeol...@opengeo.org>wrote:
> >> >
> >> >> Hi John,
> >> >>
> >> >> Unfortunately the dbconfig module is sort of unmaintained at the
> >> moment.
> >> >> That said, it looks like gwc is probably doing some initialization
> in a
> >> >> separate thread, which the hibernate startup does not like.
> >> >>
> >> >> If you don't need geowebcache, i would just disable it for now.
> >> >>
> >> >> -Justin
> >>
> >> Thanks; just to be sure I understand you, you think that it's something
> in
> >> GWC that's conflicting with the Hibernate module?  I'm not sure I
> >> understand where you're getting that, but I'm willing to believe it.
> >
> >
> > Sorry, allow me to explain better. The way hibernate is set up in
> geoserver
> > is that a session is bound to a single request, or thread. If you try to
> > access a hibernate backed bean that has a lazy property from outside that
> > thread/session then you get this exception.
> >
> > Now, during regular geoserver operation this is rarely an issue because
> > essentially there is a filter in place that always set ups and tears down
> > the thread local session, meaning that for the life of a single
> > request/thread a valid session will always be present.
> >
> > However, on startup we don't have this same filter available, so we fake
> it.
> > BAsically the code that loads the configuration creates a session before
> > loading, and tears it down after loading. Again this session is bound to
> the
> > current thread, which means if any components that initialize on startup
> do
> > so in a separate thread, and they access a lazy property of a bean, then
> > this exception occurs.
> >
> > So yes, i am saying that gwc is doing just that, it is using a new
> thread to
> > do some of its initialization on startup. Gabriel should be able to
> verify
> > this but i am pretty sure i have run up against this one before.
> >
> > Hope that makes it a bit clearer.
>
> Right. My understanding is that anything that calls the catalog
> outside an http client request will suffer from this. GWC is an
> example, as it may also do that if you want to seed the cache. Another
> example is could think of, but didn't really tried, is the wps module,
> as it can run async processes.
>
> I don't know what the general practice to avoid that kind of lazy
> initialization errors with hibernate is though.
>
> Cheers,
> Gabriel
> >
> > -Justin
> >
> > --
> > Justin Deoliveira
> > OpenGeo - http://opengeo.org
> > Enterprise support for open source geospatial.
> >
>
>
>
> --
> Gabriel Roldan
> OpenGeo - http://opengeo.org
> Expert service straight from the developers.
>



-- 
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to