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:[EMAIL PROTECTED]