You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Andy Bowes <an...@scientiasolutions.com> on 2004/10/29 10:58:24 UTC

Error Deleting Item

Hi Guys

I am using the Slide API directly rather than via the WebDav layer and I am
encountering an error that has had me baffled for quite a few days.

If I attempt to delete an item after fetching content then I get the
following error (after it seems to hang for ages):

29 Oct 2004 09:51:30 -
org.apache.slide.store.txfile.rm.impl.FileResourceManager - WARNING - Could
not commit tx main-1099039880546-8, rolling back instead
29 Oct 2004 09:51:30 -
org.apache.slide.store.txfile.rm.impl.FileResourceManager - WARNING -
org.apache.slide.store.txfile.rm.ResourceManagerException:
main-1099039880546-8: Could not upgrade to commit lock for resource at
'/testfolder/myTestItem_1.0' (ERR_NO_LOCK)
org.apache.slide.store.txfile.rm.ResourceManagerException:
main-1099039880546-8: Could not upgrade to commit lock for resource at
'/testfolder/myTestItem_1.0' (ERR_NO_LOCK)
	at
org.apache.slide.store.txfile.rm.impl.FileResourceManager$TransactionContext
.upgradeLockToCommit(FileResourceManager.java:1434)
	at
org.apache.slide.store.txfile.rm.impl.FileResourceManager$TransactionContext
.commit(FileResourceManager.java:1383)
	at
org.apache.slide.store.txfile.rm.impl.FileResourceManager.commitTransaction(
FileResourceManager.java:616)
	at
org.apache.slide.store.txfile.AbstractTxFileStoreService.commit(AbstractTxFi
leStoreService.java:248)
	at
org.apache.slide.transaction.SlideTransaction.commit(SlideTransaction.java:3
01)
	at
org.apache.slide.transaction.SlideTransactionManager.commit(SlideTransaction
Manager.java:187)
	at
org.apache.slide.common.NamespaceAccessTokenImpl.commit(NamespaceAccessToken
Impl.java:412)


I have extracted the key parts of my calls to the Slide API into a single
method (as show below) so that I can reproduce this error.  If I remove the
call to contentHelper.retrieve() then it all works fine.

Can anyone out there enlighten me ?

Thanks

Andy Bowes

p.s. I am using v2.0 and I have encountered this issue on both the Text &
JDBC File Stores.



 private void testSlideCreation(SlideToken slideToken,
                               NamespaceAccessToken accessToken,
                               String itemUri) throws Exception {
        Content contentHelper = accessToken.getContentHelper();
        Structure structureHelper = accessToken.getStructureHelper();

    	// Start the Transaction
        accessToken.begin();

        structureHelper.create(slideToken, new SubjectNode(), itemUri);

        NodeRevisionDescriptor revisionDesc =  new NodeRevisionDescriptor();

	    Date now = new Date();
        revisionDesc.setCreationDate(now);
        revisionDesc.setCreationUser("root");
        revisionDesc.setLastModified(now);
        revisionDesc.setModificationDate(now);
        revisionDesc.setModificationUser("root");
        revisionDesc.setResourceType("scientia:test");

        String contents = "Test Binary Contents";
        revisionDesc.setContentLength(contents.length());
        revisionDesc.setContentType("application/pdf");
        revisionDesc.setContentLanguage("en");

        NodeRevisionContent revisionContent = new NodeRevisionContent();
        revisionContent.setContent(contents.getBytes());

	    contentHelper.create(slideToken, itemUri, revisionDesc,
revisionContent );

        // Commit the Creation Transaction
        accessToken.commit();

    	// Fetch the Created Item
        ObjectNode itemNode = structureHelper.retrieve(slideToken, itemUri);
        NodeRevisionDescriptors revisions =
contentHelper.retrieve(slideToken, itemUri);

        // Get the latest revision of this Content
        NodeRevisionDescriptor currentRevision =
contentHelper.retrieve(slideToken, revisions);

	    // Get the Content of the Current Revision
    	NodeRevisionContent content = contentHelper.retrieve(slideToken,
itemUri, currentRevision);

    	// Delete the Created Item
	accessToken.begin();
        Macro macroHelper = accessToken.getMacroHelper();
        macroHelper.delete(slideToken, itemUri);
        accessToken.commit();
}

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: Error Deleting Item

Posted by Oliver Zeigermann <ol...@gmail.com>.
The error tells you that you still have a temporary read lock on the
resource to delete. Either execute contentHelper.retrieve(slideToken,
itemUri, currentRevision); in a transaction or get the stream from it
and close it (or access the content in any other way).

Oliver


On Fri, 29 Oct 2004 09:58:24 +0100, Andy Bowes
<an...@scientiasolutions.com> wrote:
> Hi Guys
> 
> I am using the Slide API directly rather than via the WebDav layer and I am
> encountering an error that has had me baffled for quite a few days.
> 
> If I attempt to delete an item after fetching content then I get the
> following error (after it seems to hang for ages):
> 
> 29 Oct 2004 09:51:30 -
> org.apache.slide.store.txfile.rm.impl.FileResourceManager - WARNING - Could
> not commit tx main-1099039880546-8, rolling back instead
> 29 Oct 2004 09:51:30 -
> org.apache.slide.store.txfile.rm.impl.FileResourceManager - WARNING -
> org.apache.slide.store.txfile.rm.ResourceManagerException:
> main-1099039880546-8: Could not upgrade to commit lock for resource at
> '/testfolder/myTestItem_1.0' (ERR_NO_LOCK)
> org.apache.slide.store.txfile.rm.ResourceManagerException:
> main-1099039880546-8: Could not upgrade to commit lock for resource at
> '/testfolder/myTestItem_1.0' (ERR_NO_LOCK)
>         at
> org.apache.slide.store.txfile.rm.impl.FileResourceManager$TransactionContext
> .upgradeLockToCommit(FileResourceManager.java:1434)
>         at
> org.apache.slide.store.txfile.rm.impl.FileResourceManager$TransactionContext
> .commit(FileResourceManager.java:1383)
>         at
> org.apache.slide.store.txfile.rm.impl.FileResourceManager.commitTransaction(
> FileResourceManager.java:616)
>         at
> org.apache.slide.store.txfile.AbstractTxFileStoreService.commit(AbstractTxFi
> leStoreService.java:248)
>         at
> org.apache.slide.transaction.SlideTransaction.commit(SlideTransaction.java:3
> 01)
>         at
> org.apache.slide.transaction.SlideTransactionManager.commit(SlideTransaction
> Manager.java:187)
>         at
> org.apache.slide.common.NamespaceAccessTokenImpl.commit(NamespaceAccessToken
> Impl.java:412)
> 
> I have extracted the key parts of my calls to the Slide API into a single
> method (as show below) so that I can reproduce this error.  If I remove the
> call to contentHelper.retrieve() then it all works fine.
> 
> Can anyone out there enlighten me ?
> 
> Thanks
> 
> Andy Bowes
> 
> p.s. I am using v2.0 and I have encountered this issue on both the Text &
> JDBC File Stores.
> 
>  private void testSlideCreation(SlideToken slideToken,
>                                NamespaceAccessToken accessToken,
>                                String itemUri) throws Exception {
>         Content contentHelper = accessToken.getContentHelper();
>         Structure structureHelper = accessToken.getStructureHelper();
> 
>         // Start the Transaction
>         accessToken.begin();
> 
>         structureHelper.create(slideToken, new SubjectNode(), itemUri);
> 
>         NodeRevisionDescriptor revisionDesc =  new NodeRevisionDescriptor();
> 
>             Date now = new Date();
>         revisionDesc.setCreationDate(now);
>         revisionDesc.setCreationUser("root");
>         revisionDesc.setLastModified(now);
>         revisionDesc.setModificationDate(now);
>         revisionDesc.setModificationUser("root");
>         revisionDesc.setResourceType("scientia:test");
> 
>         String contents = "Test Binary Contents";
>         revisionDesc.setContentLength(contents.length());
>         revisionDesc.setContentType("application/pdf");
>         revisionDesc.setContentLanguage("en");
> 
>         NodeRevisionContent revisionContent = new NodeRevisionContent();
>         revisionContent.setContent(contents.getBytes());
> 
>             contentHelper.create(slideToken, itemUri, revisionDesc,
> revisionContent );
> 
>         // Commit the Creation Transaction
>         accessToken.commit();
> 
>         // Fetch the Created Item
>         ObjectNode itemNode = structureHelper.retrieve(slideToken, itemUri);
>         NodeRevisionDescriptors revisions =
> contentHelper.retrieve(slideToken, itemUri);
> 
>         // Get the latest revision of this Content
>         NodeRevisionDescriptor currentRevision =
> contentHelper.retrieve(slideToken, revisions);
> 
>             // Get the Content of the Current Revision
>         NodeRevisionContent content = contentHelper.retrieve(slideToken,
> itemUri, currentRevision);
> 
>         // Delete the Created Item
>         accessToken.begin();
>         Macro macroHelper = accessToken.getMacroHelper();
>         macroHelper.delete(slideToken, itemUri);
>         accessToken.commit();
> }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org