You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Carlos Villegas <ca...@uniscope.jp> on 2006/02/22 10:26:09 UTC

setProperty ItemNotFoundException

Hi,

I'm new to this list, and JIRA is very slow...

I having a trouble in which sometimes Node.setProperty throws an
ItemNotFoundException. It seems the node is corrupted, that property was
set previously and something went wrong. Now it throws ItemNotFound. I
try to trace the exception, and found that the id exists, so it seems
the property is defined somewhere but it gives the error when it tries
to retrieve the item state. So I tried to delete the node and recreate
it but it gives me the same error, I can't delete it.
Well, to make the deletion work, I did the following on
NodeImpl.onRemove()


        // remove properties
        // use temp set to avoid ConcurrentModificationException
        HashSet tmp = new HashSet(thisState.getPropertyNames());
        for (Iterator iter = tmp.iterator(); iter.hasNext();) {
            QName propName = (QName) iter.next();
            // remove the property entry
            thisState.removePropertyName(propName);
            // remove property
            PropertyId propId = new PropertyId(thisState.getNodeId(),
propName);
            try {
                itemMgr.getItem(propId).setRemoved();
            } catch (ItemNotFoundException ne) {
                // ignore it!!!!?????
            }
        }

Note the try/catch statement.
This works, I can now delete the node and recreate it. But I don't know
if this is correct or if it leaves garbage in the persistence storage.
Also I don't know how the node got to that state. But I need to do some
recovery.

Any thoughts?


Carlos

Re: setProperty ItemNotFoundException

Posted by Carlos Villegas <ca...@uniscope.jp>.
Yes, I agree. There must be a bug somewhere else. The problem is, I
don't know how the node got corrupted in the first place, but it's
happenning quite often. I'm adding more logging to the application to
see if I can detect the cause of this problem. I'll have to modify the
RMI client to send more info about exceptions, I'm missing info like the
complete server stack trace when using the RMI client.
The other issue is, once the repository is inconsistent, should
Jackrabbit try to deal with these inconsistencies cleanly. It seems that
it cannot recover from some errors. My application is detecting that the
node is not behaving properly, so it tries to delete it but it can't.
This is the easiest solution I found so my application can continue
running. The other place to deal with the inconsistency is in the
setProperty operation, I'll try that next.

Carlos

Tobias Bocanegra wrote:
> hi carlos,
> i would be good, if you could figure out some test-case or test-code
> that reproduces the behaviour you've seen. if the itegrity of the
> repository is corrupted, there must be a bug somewhere else. i don't
> think covering the exception does any good to this :-)
> 
> regards, toby
> 
> On 2/22/06, Carlos Villegas <ca...@uniscope.jp> wrote:
> 
>>Hi,
>>
>>I'm new to this list, and JIRA is very slow...
>>
>>I having a trouble in which sometimes Node.setProperty throws an
>>ItemNotFoundException. It seems the node is corrupted, that property was
>>set previously and something went wrong. Now it throws ItemNotFound. I
>>try to trace the exception, and found that the id exists, so it seems
>>the property is defined somewhere but it gives the error when it tries
>>to retrieve the item state. So I tried to delete the node and recreate
>>it but it gives me the same error, I can't delete it.
>>Well, to make the deletion work, I did the following on
>>NodeImpl.onRemove()
>>
>>
>>       // remove properties
>>       // use temp set to avoid ConcurrentModificationException
>>       HashSet tmp = new HashSet(thisState.getPropertyNames());
>>       for (Iterator iter = tmp.iterator(); iter.hasNext();) {
>>           QName propName = (QName) iter.next();
>>           // remove the property entry
>>           thisState.removePropertyName(propName);
>>           // remove property
>>           PropertyId propId = new PropertyId(thisState.getNodeId(),
>>propName);
>>           try {
>>               itemMgr.getItem(propId).setRemoved();
>>           } catch (ItemNotFoundException ne) {
>>               // ignore it!!!!?????
>>           }
>>       }
>>
>>Note the try/catch statement.
>>This works, I can now delete the node and recreate it. But I don't know
>>if this is correct or if it leaves garbage in the persistence storage.
>>Also I don't know how the node got to that state. But I need to do some
>>recovery.
>>
>>Any thoughts?
>>
>>
>>Carlos
>>
> 
> 
> 
> --
> -----------------------------------------< 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: setProperty ItemNotFoundException

Posted by Tobias Bocanegra <to...@day.com>.
hi carlos,
i would be good, if you could figure out some test-case or test-code
that reproduces the behaviour you've seen. if the itegrity of the
repository is corrupted, there must be a bug somewhere else. i don't
think covering the exception does any good to this :-)

regards, toby

On 2/22/06, Carlos Villegas <ca...@uniscope.jp> wrote:
> Hi,
>
> I'm new to this list, and JIRA is very slow...
>
> I having a trouble in which sometimes Node.setProperty throws an
> ItemNotFoundException. It seems the node is corrupted, that property was
> set previously and something went wrong. Now it throws ItemNotFound. I
> try to trace the exception, and found that the id exists, so it seems
> the property is defined somewhere but it gives the error when it tries
> to retrieve the item state. So I tried to delete the node and recreate
> it but it gives me the same error, I can't delete it.
> Well, to make the deletion work, I did the following on
> NodeImpl.onRemove()
>
>
>        // remove properties
>        // use temp set to avoid ConcurrentModificationException
>        HashSet tmp = new HashSet(thisState.getPropertyNames());
>        for (Iterator iter = tmp.iterator(); iter.hasNext();) {
>            QName propName = (QName) iter.next();
>            // remove the property entry
>            thisState.removePropertyName(propName);
>            // remove property
>            PropertyId propId = new PropertyId(thisState.getNodeId(),
> propName);
>            try {
>                itemMgr.getItem(propId).setRemoved();
>            } catch (ItemNotFoundException ne) {
>                // ignore it!!!!?????
>            }
>        }
>
> Note the try/catch statement.
> This works, I can now delete the node and recreate it. But I don't know
> if this is correct or if it leaves garbage in the persistence storage.
> Also I don't know how the node got to that state. But I need to do some
> recovery.
>
> Any thoughts?
>
>
> Carlos
>


--
-----------------------------------------< 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 >---