You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by majohnst <ma...@lattaoutdoors.com> on 2008/11/25 23:31:28 UTC

Session Closed in Event Listener

I am using Jackrabbit through Spring 2.5.6. I registered an event listener
that will tell a spring bean about the changes to my node. When the bean
gets the call, I try to navigate through the repository using the path from
the event. I am unable to do this because I get an error that the session is
already closed. I pretty much understand why the session is closed because
the event is called after all the changes have been made. 

So my question is how I can get a new jcr session in my spring bean? Am I
going to have to use something like JMS to start a new thread?
-- 
View this message in context: http://www.nabble.com/Session-Closed-in-Event-Listener-tp20690953p20690953.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Session Closed in Event Listener

Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Nov 25, 2008 at 11:31 PM, majohnst <ma...@lattaoutdoors.com> wrote:
> I am using Jackrabbit through Spring 2.5.6. I registered an event listener
> that will tell a spring bean about the changes to my node. When the bean
> gets the call, I try to navigate through the repository using the path from
> the event. I am unable to do this because I get an error that the session is
> already closed. I pretty much understand why the session is closed because
> the event is called after all the changes have been made.
>
> So my question is how I can get a new jcr session in my spring bean? Am I
> going to have to use something like JMS to start a new thread?

No, you have to make sure the session in which the eventlistener was
registered, stays open as long as the eventlistener should be active.
It might be that some of the Spring "magic" closes the session right
after the eventlistener was registered, which will fail.

With JCR it is generally better to directly access the api and avoid
any Spring templates, background-wiring or DAO wrappers...

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com