You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Costin Leau <co...@gmail.com> on 2005/11/24 16:22:05 UTC

eventconsumer exceptions

Hello,

I'm trying to use EventListener but I keep getting these messages -
sometimes 3, sometimes one and sometimes none.
     [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
itialized
     [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
itialized
     [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
itialized  

I have no idea what causes this messages. I assumed this has something
to do with events being asynchronous. I've added a Thread.sleep but I
still get one (I do get to log the others):

    [mkdir] Created dir: C:\work\study\springmodules-0.2\workspace\springmodules\samples\jcr\.classes\repo
     [java] constructor called
     [java] received events:
     [java] Event[path=/sample node/sample property|type=4|userID=bogus]
     [java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
     [java] Event[path=/sample node|type=1|userID=bogus]
     [java] received events:
     [java] Event[path=/sample node/sample property|type=4|userID=bogus]
     [java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
     [java] Event[path=/sample node|type=1|userID=bogus]
     [java] 2005-11-24 17:14:02,335 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
itialized

What exactly I am doing wrong here. I can provide the source code
however the code is very simple - I get a session and just attach a
listener (which simply logs) to it. Nothing special.

-- 
Best regards,
 Costin Leau                          mailto:costin.leau@gmail.com


Re: Re[2]: eventconsumer exceptions

Posted by Tobias Bocanegra <to...@day.com>.
hi costin,
i think the session you are using is already closed when the events are cosumed.
in this situation, the events should not been sent to the listeners.
this is probably a bug.

i created a jira issue: http://issues.apache.org/jira/browse/JCR-279

thank you for reporting that
regards, toby


On 11/24/05, Costin Leau <co...@gmail.com> wrote:
> Hello Marcel,
>
> > could you please enable debug level for the class
> > org.apache.jackrabbit.core.observation.ObservationManagerFactory and run
> > your code again? you will then see the full stacktrace of the exception
> > that is thrown. that will give us more insight which listener causes the
> > exception and where.
>
> I had some problems with commons-logging but in the end (through some
> hard coding) got some output:
>
> [java] 2005-11-24 22:58:41,764 [ObservationManager] DEBUG org.apache.jackrabbit.core.observation.ObservationManagerFactory - event delivery to 4 consumers started...
> [java] received events:
> [java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
> [java] Event[path=/sample node/sample property|type=4|userID=bogus]
> [java] Event[path=/sample node|type=1|userID=bogus]
> [java] 2005-11-24 22:58:41,764 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
> itialized
> [java] 2005-11-24 22:58:41,764 [ObservationManager] DEBUG org.apache.jackrabbit.core.observation.ObservationManagerFactory - Stacktrace:
> [java] java.lang.IllegalStateException: not initialized
> [java]     at org.apache.jackrabbit.core.security.SimpleAccessManager.isGranted(SimpleAccessManager.java:119)
> [java]     at org.apache.jackrabbit.core.observation.EventConsumer.consumeEvents(EventConsumer.java:231)
> [java]     at org.apache.jackrabbit.core.observation.ObservationManagerFactory.run(ObservationManagerFactory.java:161)
> [java]     at java.lang.Thread.run(Thread.java:595)
> [java] received events:
> [java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
> [java] Event[path=/sample node/sample property|type=4|userID=bogus]
> [java] Event[path=/sample node|type=1|userID=bogus]
> [java] 2005-11-24 22:58:41,764 [ObservationManager] DEBUG org.apache.jackrabbit.core.observation.ObservationManagerFactory - event delivery finished.
>
> For Tobias: my listener is extremly simple (I don't even use
> IllegalStateException):
>
> public class DummyEventListener implements EventListener {
>
>        public DummyEventListener()
>        {
>                System.out.println("constructor called");
>        }
>        /**
>         * @see javax.jcr.observation.EventListener#onEvent(javax.jcr.observation.EventIterator)
>         */
>        public void onEvent(EventIterator iterator) {
>                System.out.println("received events: ");
>                for (; iterator.hasNext();) {
>                        try {
>                                System.out.println(toStringEvent(iterator.nextEvent()));
>                        }
>                        catch (RepositoryException e) {
>                                System.err.println("exception while listnening " + SessionFactoryUtils.translateException(e));
>                        }
>                }
>        }
>
>        private String toStringEvent(Event event) throws RepositoryException
>        {
>            // do some formatting and pretty printing
>            return string;
>        }
> }
>
> For some reason SimpleAccessManager is not initialized but I have no
> idea why this happens - I'm not using any specific JackRabbit API just
> the JSR-170. Considering that the number of WARNs varies, I think it's
> a threading issue.
>
> > Costin Leau wrote:
> >> Hello,
> >>
> >> I'm trying to use EventListener but I keep getting these messages -
> >> sometimes 3, sometimes one and sometimes none.
> >>      [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
> >> itialized
> >>      [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
> >> itialized
> >>      [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
> >> itialized
> >>
> >> I have no idea what causes this messages. I assumed this has something
> >> to do with events being asynchronous. I've added a Thread.sleep but I
> >> still get one (I do get to log the others):
> >>
> >>     [mkdir] Created dir: C:\work\study\springmodules-0.2\workspace\springmodules\samples\jcr\.classes\repo
> >>      [java] constructor called
> >>      [java] received events:
> >>      [java] Event[path=/sample node/sample property|type=4|userID=bogus]
> >>      [java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
> >>      [java] Event[path=/sample node|type=1|userID=bogus]
> >>      [java] received events:
> >>      [java] Event[path=/sample node/sample property|type=4|userID=bogus]
> >>      [java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
> >>      [java] Event[path=/sample node|type=1|userID=bogus]
> >>      [java] 2005-11-24 17:14:02,335 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
> >> itialized
> >>
> >> What exactly I am doing wrong here. I can provide the source code
> >> however the code is very simple - I get a session and just attach a
> >> listener (which simply logs) to it. Nothing special.
> >>
>
>
>
> --
> Best regards,
>  Costin                            mailto:costin.leau@gmail.com
>
>


--
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re[2]: eventconsumer exceptions

Posted by Costin Leau <co...@gmail.com>.
Hello Marcel,

> could you please enable debug level for the class
> org.apache.jackrabbit.core.observation.ObservationManagerFactory and run
> your code again? you will then see the full stacktrace of the exception
> that is thrown. that will give us more insight which listener causes the
> exception and where.

I had some problems with commons-logging but in the end (through some
hard coding) got some output:

[java] 2005-11-24 22:58:41,764 [ObservationManager] DEBUG org.apache.jackrabbit.core.observation.ObservationManagerFactory - event delivery to 4 consumers started...
[java] received events:
[java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
[java] Event[path=/sample node/sample property|type=4|userID=bogus]
[java] Event[path=/sample node|type=1|userID=bogus]
[java] 2005-11-24 22:58:41,764 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
itialized
[java] 2005-11-24 22:58:41,764 [ObservationManager] DEBUG org.apache.jackrabbit.core.observation.ObservationManagerFactory - Stacktrace:
[java] java.lang.IllegalStateException: not initialized
[java]     at org.apache.jackrabbit.core.security.SimpleAccessManager.isGranted(SimpleAccessManager.java:119)
[java]     at org.apache.jackrabbit.core.observation.EventConsumer.consumeEvents(EventConsumer.java:231)
[java]     at org.apache.jackrabbit.core.observation.ObservationManagerFactory.run(ObservationManagerFactory.java:161)
[java]     at java.lang.Thread.run(Thread.java:595)
[java] received events:
[java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
[java] Event[path=/sample node/sample property|type=4|userID=bogus]
[java] Event[path=/sample node|type=1|userID=bogus]
[java] 2005-11-24 22:58:41,764 [ObservationManager] DEBUG org.apache.jackrabbit.core.observation.ObservationManagerFactory - event delivery finished.

For Tobias: my listener is extremly simple (I don't even use
IllegalStateException):

public class DummyEventListener implements EventListener {
        
        public DummyEventListener()
        {
                System.out.println("constructor called");
        }
        /**
         * @see javax.jcr.observation.EventListener#onEvent(javax.jcr.observation.EventIterator)
         */
        public void onEvent(EventIterator iterator) {
                System.out.println("received events: ");
                for (; iterator.hasNext();) {
                        try {
                                System.out.println(toStringEvent(iterator.nextEvent()));
                        }
                        catch (RepositoryException e) {
                                System.err.println("exception while listnening " + SessionFactoryUtils.translateException(e));
                        }
                }
        }

        private String toStringEvent(Event event) throws RepositoryException
        {
            // do some formatting and pretty printing
            return string;
        }
}

For some reason SimpleAccessManager is not initialized but I have no
idea why this happens - I'm not using any specific JackRabbit API just
the JSR-170. Considering that the number of WARNs varies, I think it's
a threading issue.

> Costin Leau wrote:
>> Hello,
>> 
>> I'm trying to use EventListener but I keep getting these messages -
>> sometimes 3, sometimes one and sometimes none.
>>      [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
>> itialized
>>      [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
>> itialized
>>      [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
>> itialized  
>> 
>> I have no idea what causes this messages. I assumed this has something
>> to do with events being asynchronous. I've added a Thread.sleep but I
>> still get one (I do get to log the others):
>> 
>>     [mkdir] Created dir: C:\work\study\springmodules-0.2\workspace\springmodules\samples\jcr\.classes\repo
>>      [java] constructor called
>>      [java] received events:
>>      [java] Event[path=/sample node/sample property|type=4|userID=bogus]
>>      [java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
>>      [java] Event[path=/sample node|type=1|userID=bogus]
>>      [java] received events:
>>      [java] Event[path=/sample node/sample property|type=4|userID=bogus]
>>      [java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
>>      [java] Event[path=/sample node|type=1|userID=bogus]
>>      [java] 2005-11-24 17:14:02,335 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
>> itialized
>> 
>> What exactly I am doing wrong here. I can provide the source code
>> however the code is very simple - I get a session and just attach a
>> listener (which simply logs) to it. Nothing special.
>> 



-- 
Best regards,
 Costin                            mailto:costin.leau@gmail.com


Re: eventconsumer exceptions

Posted by Marcel Reutegger <ma...@day.com>.
Hi Costin,

could you please enable debug level for the class 
org.apache.jackrabbit.core.observation.ObservationManagerFactory and run 
your code again? you will then see the full stacktrace of the exception 
that is thrown. that will give us more insight which listener causes the 
exception and where.

regards
  marcel

Costin Leau wrote:
> Hello,
> 
> I'm trying to use EventListener but I keep getting these messages -
> sometimes 3, sometimes one and sometimes none.
>      [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
> itialized
>      [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
> itialized
>      [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
> itialized  
> 
> I have no idea what causes this messages. I assumed this has something
> to do with events being asynchronous. I've added a Thread.sleep but I
> still get one (I do get to log the others):
> 
>     [mkdir] Created dir: C:\work\study\springmodules-0.2\workspace\springmodules\samples\jcr\.classes\repo
>      [java] constructor called
>      [java] received events:
>      [java] Event[path=/sample node/sample property|type=4|userID=bogus]
>      [java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
>      [java] Event[path=/sample node|type=1|userID=bogus]
>      [java] received events:
>      [java] Event[path=/sample node/sample property|type=4|userID=bogus]
>      [java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
>      [java] Event[path=/sample node|type=1|userID=bogus]
>      [java] 2005-11-24 17:14:02,335 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
> itialized
> 
> What exactly I am doing wrong here. I can provide the source code
> however the code is very simple - I get a session and just attach a
> listener (which simply logs) to it. Nothing special.
> 


Re: eventconsumer exceptions

Posted by Tobias Bocanegra <to...@day.com>.
hi costin,
it seems, that the exception is thrown in your event listener. maybe
you add more error handling to it.

regards, toby


On 11/24/05, Costin Leau <co...@gmail.com> wrote:
> Hello,
>
> I'm trying to use EventListener but I keep getting these messages -
> sometimes 3, sometimes one and sometimes none.
>     [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
> itialized
>     [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
> itialized
>     [java] 2005-11-24 17:05:30,489 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
> itialized
>
> I have no idea what causes this messages. I assumed this has something
> to do with events being asynchronous. I've added a Thread.sleep but I
> still get one (I do get to log the others):
>
>    [mkdir] Created dir: C:\work\study\springmodules-0.2\workspace\springmodules\samples\jcr\.classes\repo
>     [java] constructor called
>     [java] received events:
>     [java] Event[path=/sample node/sample property|type=4|userID=bogus]
>     [java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
>     [java] Event[path=/sample node|type=1|userID=bogus]
>     [java] received events:
>     [java] Event[path=/sample node/sample property|type=4|userID=bogus]
>     [java] Event[path=/sample node/jcr:primaryType|type=4|userID=bogus]
>     [java] Event[path=/sample node|type=1|userID=bogus]
>     [java] 2005-11-24 17:14:02,335 [ObservationManager] WARN  org.apache.jackrabbit.core.observation.ObservationManagerFactory - EventConsumer threw exception: java.lang.IllegalStateException: not in
> itialized
>
> What exactly I am doing wrong here. I can provide the source code
> however the code is very simple - I get a session and just attach a
> listener (which simply logs) to it. Nothing special.
>
> --
> Best regards,
>  Costin Leau                          mailto:costin.leau@gmail.com
>
>


--
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---