You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Sandro Boehme <sa...@gmx.de> on 2014/10/08 15:39:19 UTC
UnsupportedOperationException: JcrNodeResourceMetadata is locked
Hello,
when I call a resource using my custom ResourceProvider [1] I get a
server error (500) saying "java.lang.UnsupportedOperationException:
JcrNodeResourceMetadata is locked" [3]. At the moment I don't see a way
to get around that and it would be great if someone has a hint on what
to do.
In my ResEditorResourceProvider.java:61 [1] I return a resource that I
get from a ResourceResolver. While resolving, the
'ResourceDecoratorTracker.decorate(Resource)' method
'result.getResourceMetadata().lock()' is called and after I returned my
resource 'ResourceResolverImpl.getAbsoluteResourceInternal(String path,
boolean isResolve)' calls
'resource.getResourceMetadata().setResolutionPath(path)' which triggers
the exception. You can see that in the stack trace [3].
++ Background ++
I'm working on a custom ResourceProvider [1] for the Sling Resource
Editor [2] that returns a wrapped resource for every Sling resource.
This wrapped resource will later get the resource type for the Resource
Editor set. That way the Resource Editor script would get called for all
resources.
[1] -
https://github.com/sandroboehme/resourceeditor/blob/master/src/main/java/org/apache/sling/reseditor/ResEditorResourceProvider.java
[2] - https://issues.apache.org/jira/browse/SLING-4001
[3] -
java.lang.UnsupportedOperationException: JcrNodeResourceMetadata is locked
at
org.apache.sling.api.resource.ResourceMetadata.checkReadOnly(ResourceMetadata.java:310)
at
org.apache.sling.api.resource.ResourceMetadata.put(ResourceMetadata.java:322)
at
org.apache.sling.api.resource.ResourceMetadata.setResolutionPath(ResourceMetadata.java:254)
at
org.apache.sling.resourceresolver.impl.ResourceResolverImpl.getAbsoluteResourceInternal(ResourceResolverImpl.java:955)
at
org.apache.sling.resourceresolver.impl.ResourceResolverImpl.resolveInternal(ResourceResolverImpl.java:810)
at
org.apache.sling.resourceresolver.impl.ResourceResolverImpl.resolveInternal(ResourceResolverImpl.java:327)
at
org.apache.sling.resourceresolver.impl.ResourceResolverImpl.resolve(ResourceResolverImpl.java:225)
at
org.apache.sling.engine.impl.request.RequestData.initResource(RequestData.java:223)
at
org.apache.sling.engine.impl.SlingRequestProcessorImpl.doProcessRequest(SlingRequestProcessorImpl.java:142)
at
org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:217)
Thanks!
Sandro
Re: UnsupportedOperationException: JcrNodeResourceMetadata is locked
Posted by Sandro Boehme <sa...@gmx.de>.
Sorry for the noise. I posted that to the wrong list. It is re-posted
to the users list now.
Best,
Sandro
Am Wed Oct 8 15:39:19 2014 schrieb Sandro Boehme:
> Hello,
>
> when I call a resource using my custom ResourceProvider [1] I get a
> server error (500) saying "java.lang.UnsupportedOperationException:
> JcrNodeResourceMetadata is locked" [3]. At the moment I don't see a
> way to get around that and it would be great if someone has a hint on
> what to do.
>
> In my ResEditorResourceProvider.java:61 [1] I return a resource that I
> get from a ResourceResolver. While resolving, the
> 'ResourceDecoratorTracker.decorate(Resource)' method
> 'result.getResourceMetadata().lock()' is called and after I returned
> my resource 'ResourceResolverImpl.getAbsoluteResourceInternal(String
> path, boolean isResolve)' calls
> 'resource.getResourceMetadata().setResolutionPath(path)' which
> triggers the exception. You can see that in the stack trace [3].
>
> ++ Background ++
> I'm working on a custom ResourceProvider [1] for the Sling Resource
> Editor [2] that returns a wrapped resource for every Sling resource.
> This wrapped resource will later get the resource type for the
> Resource Editor set. That way the Resource Editor script would get
> called for all resources.
>
> [1] -
> https://github.com/sandroboehme/resourceeditor/blob/master/src/main/java/org/apache/sling/reseditor/ResEditorResourceProvider.java
>
> [2] - https://issues.apache.org/jira/browse/SLING-4001
> [3] -
> java.lang.UnsupportedOperationException: JcrNodeResourceMetadata is
> locked
> at
> org.apache.sling.api.resource.ResourceMetadata.checkReadOnly(ResourceMetadata.java:310)
>
> at
> org.apache.sling.api.resource.ResourceMetadata.put(ResourceMetadata.java:322)
>
> at
> org.apache.sling.api.resource.ResourceMetadata.setResolutionPath(ResourceMetadata.java:254)
>
> at
> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.getAbsoluteResourceInternal(ResourceResolverImpl.java:955)
>
> at
> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.resolveInternal(ResourceResolverImpl.java:810)
>
> at
> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.resolveInternal(ResourceResolverImpl.java:327)
>
> at
> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.resolve(ResourceResolverImpl.java:225)
>
> at
> org.apache.sling.engine.impl.request.RequestData.initResource(RequestData.java:223)
>
> at
> org.apache.sling.engine.impl.SlingRequestProcessorImpl.doProcessRequest(SlingRequestProcessorImpl.java:142)
>
> at
> org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:217)
>
>
> Thanks!
>
> Sandro
>