[opencms-dev] CmsLockException when updating content

Vaclav Balak shmoula at gmail.com
Fri Nov 20 14:40:15 CET 2009


Hi,
  I'm trying to create (or alter) content, like this:

try{
    System.out.println("Creating new layout...");
    cmsObject.createResource(newResname, resTypeId,
content.getBytes(), properties);
}catch(Exception e){
    System.out.println("Rewriting existing layout...");
    String parentResname =
cmsObject.getRequestContext().getFileTranslator().translateResource(
					CmsResource.getParentFolder(newResname));
    cmsObject.unlockResource(parentResname);
    cmsObject.replaceResource(newResname, resTypeId,
content.getBytes(), properties);
}

I tried to unlock file itself, but it always was the same: Error
unlocking resource "/sites/..." by current user "Admin" - Resource
"/sites/..." is not locked by current user "Admin". When I use
browser, it tells me 'No exclusive locks found! ', so where can be
problem?

In wiki is just 'Writing content' article, not 'Editing' :-( (
http://opencms-wiki.org/Creating_and_editing_files ).

So, how can I edit (or delete) file?

Thanks in advance,
shMoula



More information about the opencms-dev mailing list