[opencms-dev] CmsLockException when updating content

Vaclav Balak shmoula at gmail.com
Mon Nov 23 10:28:42 CET 2009


Thanks for your response, guys!
  I should have to write more info about my solution, because I
figured out that it's maybe not impossible to do it this way. My
action is triggered by Action Listener, so 'inside publishing
process'. I have 'output' directory, where I'm trying to generate
files based on 'templates' after Publish. So when those files are
generated, they're also not published, so I'm getting inside
recursion-like loop :-(. So I have to get some workaround of 'publish
lock', which Christian mentioned. My another question is: is it
possible to access folder/file 'outside the publication process'? Or
is there some simple way to write content to file while publishing and
mark that file as published? (cmsObject.publishResource is deprecated,
will it work?)

Thanks in advance
Vaclav Balak

On Sat, Nov 21, 2009 at 9:38 AM, Christian Steinert
<christian_steinert at web.de> wrote:
> Vaclav Balak wrote:
>> 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?
>>
> Dear Vaclav
>
> You can only unlock a file, when the current user is the one that has
> locked it before.
> If another user has locked the file, you first need to steal the lock.
>
> There is still one situation when you cannot unlock a resource: if the
> resource is in the process of being published. At that time the resource
> is blocked by opencms itself and cannot be unlocked by normal means.
> This seems to be a conscious design decision of the opencms developers -
> if there is a publish lock, then there is nothing you can do.
>
> Roman wrote that they had lock errors that were unexpected but so far,
> all the locking and unlocking behavior that I have seen in opencms made
> complete sense to me
>
> -----
> So before you try to unlock a resource, just try the following:
>
> // check, if the resource is locked at all and if the resource has no
> publish lock
> // ...
>
> try{
>  //take over lock from another user
>  cmsObject.changeLock( resourcePath );
> }catch(CmsException e) {
>  //resource was not locked by another user
> }
>
> // unlock the resource
> // ...
>
> Kind regards
> Christian
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>



More information about the opencms-dev mailing list