EventListener

View: New views
5 Messages — Rating Filter:   Alert me  

EventListener

by brco3837 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, apparently I don't have a great understanding of how the
EventListeners work.

I'm trying to register an event listener that will fire any time a
certain file is changed.

 

Unfortunately, when I'm checking in my test case for the event listener,
the method ObservationManager.getRegisteredEventListeners() is throwing
a null pointer.

 

java.lang.NullPointerException

    at
org.apache.jackrabbit.rmi.client.ClientObservationManager.getRegisteredE
ventListeners(ClientObservationManager.java:105)

 

Does anyone know why this is?

 

Also, when I register an EventListener, does it register the event for
the Session, over the entire workspace, or what?

 

Thanks in advance,

Brett


Re: EventListener

by Anup Chatterjee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

brco3837 wrote:
Ok, apparently I don't have a great understanding of how the
EventListeners work.
Hi,

I was going to post another thread but this seems appropriate for my question -

I am having a similar issue trying to get Listener configured with the Webdav servlet. Any hints on how to use Listeners with webdav? I do see there are class files implementing EventListeners but not sure how to use them with the webdav servlet.

Thanks,
Anup

Re: EventListener

by Marcel Reutegger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Conoly, Brett wrote:

> Unfortunately, when I'm checking in my test case for the event listener,
> the method ObservationManager.getRegisteredEventListeners() is throwing
> a null pointer.
>
> java.lang.NullPointerException
>     at
> org.apache.jackrabbit.rmi.client.ClientObservationManager.getRegisteredE
> ventListeners(ClientObservationManager.java:105)
>
> Does anyone know why this is?

this might be a bug in the jackrabbit-rmi module. does it also happen when you
run the code directly on jackrabbit-core without using RMI?

> Also, when I register an EventListener, does it register the event for
> the Session, over the entire workspace, or what?

the event listener is bound to the life cycle of the session that registered the
listener. if you logout the session the listener will not get events anymore.

the exact scope depends on the filter you specify when registering the event
listener [1], but is limited to the workspace the session is logged in.

regards
  marcel


[1]
http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/observation/ObservationManager.html#addEventListener(javax.jcr.observation.EventListener,%20int,%20java.lang.String,%20boolean,%20java.lang.String[],%20java.lang.String[],%20boolean)

RE: EventListener

by brco3837 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Makes sense, but when I have the Listener on my server it works and when
I run it through my test case it fails because of the null pointer.

What I have is just a singleton that reads in a properties file once.
But I'm registering an event listener through the constructor and then
closing the session behind it.

Like I said, this seems to work on my server because when I was
attempting to run my test cases it would pick up on a change and reload
the properties.

I'm using rmi in both my test case and on my server but it is still
throwing the null pointer.  Anyone have any clue why?
Thanks

-----Original Message-----
From: Marcel Reutegger [mailto:marcel.reutegger@...]
Sent: Tuesday, May 13, 2008 6:15 AM
To: users@...
Subject: Re: EventListener

Hi,

Conoly, Brett wrote:
> Unfortunately, when I'm checking in my test case for the event
listener,
> the method ObservationManager.getRegisteredEventListeners() is
throwing
> a null pointer.
>
> java.lang.NullPointerException
>     at
>
org.apache.jackrabbit.rmi.client.ClientObservationManager.getRegisteredE
> ventListeners(ClientObservationManager.java:105)
>
> Does anyone know why this is?

this might be a bug in the jackrabbit-rmi module. does it also happen
when you
run the code directly on jackrabbit-core without using RMI?

> Also, when I register an EventListener, does it register the event for
> the Session, over the entire workspace, or what?

the event listener is bound to the life cycle of the session that
registered the
listener. if you logout the session the listener will not get events
anymore.

the exact scope depends on the filter you specify when registering the
event
listener [1], but is limited to the workspace the session is logged in.

regards
  marcel


[1]
http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/observation/O
bservationManager.html#addEventListener(javax.jcr.observation.EventListe
ner,%20int,%20java.lang.String,%20boolean,%20java.lang.String[],%20java.
lang.String[],%20boolean)

Re: EventListener

by Marcel Reutegger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Brett,

can you please file a jira issue and provide your test case? thanks

regards
  marcel

Conoly, Brett wrote:

> Makes sense, but when I have the Listener on my server it works and when
> I run it through my test case it fails because of the null pointer.
>
> What I have is just a singleton that reads in a properties file once.
> But I'm registering an event listener through the constructor and then
> closing the session behind it.
>
> Like I said, this seems to work on my server because when I was
> attempting to run my test cases it would pick up on a change and reload
> the properties.
>
> I'm using rmi in both my test case and on my server but it is still
> throwing the null pointer.  Anyone have any clue why?
> Thanks
>
> -----Original Message-----
> From: Marcel Reutegger [mailto:marcel.reutegger@...]
> Sent: Tuesday, May 13, 2008 6:15 AM
> To: users@...
> Subject: Re: EventListener
>
> Hi,
>
> Conoly, Brett wrote:
>> Unfortunately, when I'm checking in my test case for the event
> listener,
>> the method ObservationManager.getRegisteredEventListeners() is
> throwing
>> a null pointer.
>>
>> java.lang.NullPointerException
>>     at
>>
> org.apache.jackrabbit.rmi.client.ClientObservationManager.getRegisteredE
>> ventListeners(ClientObservationManager.java:105)
>>
>> Does anyone know why this is?
>
> this might be a bug in the jackrabbit-rmi module. does it also happen
> when you
> run the code directly on jackrabbit-core without using RMI?
>
>> Also, when I register an EventListener, does it register the event for
>> the Session, over the entire workspace, or what?
>
> the event listener is bound to the life cycle of the session that
> registered the
> listener. if you logout the session the listener will not get events
> anymore.
>
> the exact scope depends on the filter you specify when registering the
> event
> listener [1], but is limited to the workspace the session is logged in.
>
> regards
>   marcel
>
>
> [1]
> http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/observation/O
> bservationManager.html#addEventListener(javax.jcr.observation.EventListe
> ner,%20int,%20java.lang.String,%20boolean,%20java.lang.String[],%20java.
> lang.String[],%20boolean)
>
>