Hi!

I get a NoSuchElementException running the following code

QueryResult result = QueryHelper.query(session, qstr.toString(), "xpath");
NodeIterator ni = result.getNodes();
while (ni.hasNext())
    {
      Node newsitem = ni.nextNode(); // ***
      // ...
    }

The row marked with *** throws the following:

java.util.NoSuchElementException
        at 
org.apache.jackrabbit.core.query.lucene.NodeIteratorImpl.nextNodeImpl(NodeIteratorImpl.java:164)
        at 
org.apache.jackrabbit.core.query.lucene.NodeIteratorImpl.nextNode(NodeIteratorImpl.java:72)
        at com.clarmont.cms.jcr.beans.NewsManagerBean.listNews(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)

Seems like the index is not coherent with the data stored. I am really
confused by this error, any ideas?
(Is it possible that unclosed sessions cause this error?)

Thank you in advance:
Miklos Pocsaji

Reply via email to