You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Konrad Windszus <ko...@gmx.de> on 2021/03/19 11:51:06 UTC
Re: [RT] Make bundles with Sling-Initial-Content first-class citizens
in feature model tooling
Today I faced this issue while deploying Composum Nodes to AEMaaCS Publish (https://github.com/ist-dresden/composum-nodes/issues/237 <https://github.com/ist-dresden/composum-nodes/issues/237>):
19.03.2021 02:56:13.558 [cm-p29008-e106842-aem-publish-748769766d-rs4bh] *ERROR* [Apache Sling Repository Startup Thread #1] org.apache.sling.jcr.contentloader.internal.ContentLoaderService Problem loading initial content of bundle com.composum.core.usermgnt (573)
java.lang.UnsupportedOperationException: This builder is read-only.
at org.apache.jackrabbit.oak.spi.state.ReadOnlyBuilder.unsupported(ReadOnlyBuilder.java:44) [org.apache.jackrabbit.oak-store-spi:1.39.0.R1886624]
at org.apache.jackrabbit.oak.spi.state.ReadOnlyBuilder.remove(ReadOnlyBuilder.java:110) [org.apache.jackrabbit.oak-store-spi:1.39.0.R1886624]
at org.apache.jackrabbit.oak.core.SecureNodeBuilder.remove(SecureNodeBuilder.java:166) [org.apache.jackrabbit.oak-core:1.39.0.R1886624]
at org.apache.jackrabbit.oak.plugins.tree.impl.AbstractMutableTree.remove(AbstractMutableTree.java:51) [org.apache.jackrabbit.oak-core:1.39.0.R1886624]
at org.apache.jackrabbit.oak.core.MutableTree.remove(MutableTree.java:184) [org.apache.jackrabbit.oak-core:1.39.0.R1886624]
at org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate.remove(NodeDelegate.java:701) [org.apache.jackrabbit.oak-jcr:1.39.0.R1886624]
at org.apache.jackrabbit.oak.jcr.session.NodeImpl$4.performVoid(NodeImpl.java:242) [org.apache.jackrabbit.oak-jcr:1.39.0.R1886624]
at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:275) [org.apache.jackrabbit.oak-jcr:1.39.0.R1886624]
at org.apache.jackrabbit.oak.jcr.session.NodeImpl.remove(NodeImpl.java:235) [org.apache.jackrabbit.oak-jcr:1.39.0.R1886624]
at org.apache.sling.jcr.contentloader.internal.BundleContentLoader.createFolder(BundleContentLoader.java:509) [org.apache.sling.jcr.contentloader:2.3.0]
at org.apache.sling.jcr.contentloader.internal.BundleContentLoader.installFromPath(BundleContentLoader.java:364) [org.apache.sling.jcr.contentloader:2.3.0]
at org.apache.sling.jcr.contentloader.internal.BundleContentLoader.installContent(BundleContentLoader.java:238) [org.apache.sling.jcr.contentloader:2.3.0]
at org.apache.sling.jcr.contentloader.internal.BundleContentLoader.registerBundleInternal(BundleContentLoader.java:148) [org.apache.sling.jcr.contentloader:2.3.0]
at org.apache.sling.jcr.contentloader.internal.BundleContentLoader.registerBundle(BundleContentLoader.java:95) [org.apache.sling.jcr.contentloader:2.3.0]
at org.apache.sling.jcr.contentloader.internal.ContentLoaderService.activate(ContentLoaderService.java:244) [org.apache.sling.jcr.contentloader:2.3.0]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:244) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:685) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:529) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:318) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:308) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:354) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:115) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:1000) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:973) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:785) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:1271) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:1222) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1200) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1121) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:928) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:864) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1152) [org.apache.felix.scr:2.1.26]
at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:114) [org.apache.felix.scr:2.1.26]
at org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:990)
at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838)
at org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545)
at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4833)
at org.apache.felix.framework.Felix.registerService(Felix.java:3804)
at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:328)
at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.registerService(AbstractSlingRepositoryManager.java:222) [org.apache.sling.jcr.base:3.1.6]
at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.initializeAndRegisterRepositoryService(AbstractSlingRepositoryManager.java:566) [org.apache.sling.jcr.base:3.1.6]
at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.access$300(AbstractSlingRepositoryManager.java:92) [org.apache.sling.jcr.base:3.1.6]
at org.apache.sling.jcr.base.AbstractSlingRepositoryManager$4.run(AbstractSlingRepositoryManager.java:527) [org.apache.sling.jcr.base:3.1.6]
What about extending the Content Loader so that it only overwrites in case the nodes do actually differ?
@Stefan: Have you created any JIRAs about your proposed options?
Konrad
> On 5. Feb 2021, at 08:59, Stefan Seifert <St...@diva-e.com.INVALID> wrote:
>
> discussing the options with carsten off-list a bit there are multiple ideas how bundles with Sling-Initial-Content could be processed:
>
> a) the way I described initially, extending the feature-cpconverter and sling-feature-analyzer to support those bundles and extract the contained Sling-Initial-Content to a content package to be deployed to the immutable part of the repo. probably activated as option in both tools.
>
> b) the same can be done earlier in the build process: when building the individual maven module of a bundle with Sling-Initial-Content a Maven plugin could take this content and create an attached content package artifact (with a classifier) in parallel to the bundle artifact, and remove the Sling-Initial-Content in the same step. in the further deployment steps those two artifacts are treated separately as bundle and content package.
>
> variant b) is probably a bit more easier to achieve or more transparent what's happening. but it does not work for bundles you have no control over that already contain Sling-Initial-Content. in the long-term it might make sense to support both, sharing the same code base for extracting the Sling-Initial-Content to a separate content package.
>
> stefan
>
>
>> -----Original Message-----
>> From: Carsten Ziegeler <cz...@apache.org>
>> Sent: Wednesday, February 3, 2021 3:27 PM
>> To: dev@sling.apache.org
>> Subject: Re: [RT] Make bundles with Sling-Initial-Content first-class
>> citizens in feature model tooling
>>
>> Hi Stefan,
>>
>> I think we have more than two worlds - it's a multi-verse
>>
>> For example, for our projects we don't want to have initial content at
>> all - thats why we need to have an analyser checking for this.
>>
>> If I think about other projects I can envision that some are fine with
>> initial content for an immutable repository - but not for a mutable
>> repository.
>>
>> And others might be fine with whatever they get.
>>
>> I think thats a choice every project should be able to make - it's like
>> some projects like to code OSGi services with Declarative Services, some
>> want to do via framework api, others want to use CDI etc. There is no
>> right or wrong here.
>>
>> So for the analyser we need to have this configurable. We can discuss
>> what we think is the best default for Sling based projects of course.
>>
>> For the cpconverter, I think it depends on where or who is using this.
>> So you might want to enable converting initial content to a content
>> package or you might be fine with ignoring it or you use the "normal"
>> way of the contentloader bundle at runtime. It's again the users choice.
>>
>> Regards
>> Carsten
>>
>> Am 03.02.2021 um 15:12 schrieb Stefan Seifert:
>>> hello carsten.
>>>
>>> can you give some more details about the "setups and requirements" that
>> differ?
>>>
>>> i fear if we introduce a switch to distinguish on those things we create
>> different "worlds" of scenarios which all have to be maintained and tested
>> separately in the already quite complex toolchain around feature models.
>>>
>>> and why is it exactly the Sling-Initial-Content support which will be the
>> pivot that separates one world from the other?
>>>
>>> stefan
>>>
>>>> -----Original Message-----
>>>> From: Carsten Ziegeler <cz...@apache.org>
>>>> Sent: Wednesday, February 3, 2021 6:51 AM
>>>> To: dev@sling.apache.org
>>>> Subject: Re: [RT] Make bundles with Sling-Initial-Content first-class
>>>> citizens in feature model tooling
>>>>
>>>> Hi,
>>>>
>>>> in general, I think those changes make sense. However, project setups
>>>> and requirements differ - so I think it makes sense to have an analyser
>>>> that forbids initial content in bundles. So we either make the existing
>>>> analyser configurable or have two analysers.
>>>>
>>>> I think the same applies to the cpconverter: having a switch which
>>>> either allows initial content and creates the content packages as you
>>>> suggest or fails.
>>>>
>>>> Regards
>>>> Carsten
>>>>
>>>> Am 02.02.2021 um 23:38 schrieb Stefan Seifert:
>>>>> currently, bundles with Sling-Initial-Content have not special support
>> in
>>>> the feature model tooling and when used with composite nodestore.
>> however,
>>>> they work just fine e.g. in AEMaaCS because during the image build phase
>>>> the contained content gets extracted and baked into the docker image. at
>>>> runtime, the Sling JCR content loader produces a warning about the
>> locked
>>>> down /apps folder which can be ignored, because the content is already
>>>> there and does not need to be extracted again. however, it's probably
>>>> currently working only due to "lucky circumstances" in the current
>> process
>>>> of cloud build pipeline.
>>>>>
>>>>> the sling-feature-analyzer [1] is currently looking out for bundles
>> with
>>>> Sling-Initial-Content and produce a warning if it founds any.
>>>>>
>>>>> Sling-Initial-Content is around for years and i would like to make
>>>> bundles with it "first-class citizens" in the world of feature models
>> and
>>>> composite node stores. Without having looked into details of the current
>>>> feature model toolchain a "full support" might look like this:
>>>>>
>>>>> 1. the sling-feature-analyzer should be changed to accept bundles with
>>>> Sling-Initial-Content in general, but check the configured path to make
>>>> sure they point only to immutable areas in the repository.
>>>>>
>>>>> 2. in the feature-cpconverter [2] could be extended to detect bundles
>>>> with Sling-Initial-Content and probably convert the contained content to
>> a
>>>> content package and include it in the feature model for further
>> processing.
>>>>>
>>>>> WDYT?
>>>>>
>>>>> stefan
>>>>>
>>>>> [1] https://github.com/apache/sling-org-apache-sling-feature-analyser/
>>>>> [2] https://github.com/apache/sling-org-apache-sling-feature-
>> cpconverter
>>>>>
>>>>
>>>> --
>>>> --
>>>> Carsten Ziegeler
>>>> Adobe Research Switzerland
>>>> cziegeler@apache.org
>>
>> --
>> --
>> Carsten Ziegeler
>> Adobe Research Switzerland
>> cziegeler@apache.org
RE: [RT] Make bundles with Sling-Initial-Content first-class citizens
in feature model tooling
Posted by Stefan Seifert <St...@diva-e.com.INVALID>.
hello konrad.
yes, this is exactly the error message I'm observing as well with any bundle using Sling-Initial-Content on AEMaaCS.
although it's reported with "ERROR" level it's all running fine, because the instance was already started once during the docker image building process and the content contained in the bundle gets extracted and persisted in the "read-only" part of the repository. but this was probably not by intention, but a (although positive) side-effect of the current docker image building process that is in place.
i had also thought about extending the loader to log this error only in case the content in the bundle is different. but this would be rather complex to implement (have to make a full diff of the repository content and the Sling-Initial-Content), and would more try to cure the symptoms and not the root cause of the problem.
so i think solution should be either 1.+2. from my initial mailing to this thread (for 2. you already created SLING-10243), or following the idea from carsten building a maven plugin that moves the Sling-Initial-Content to a content package during the maven build of the module itself (which would make the handling of the resulting artifacts a bit more complicated downstream as you have to manage two artifacts instead of one from that point on).
stefan
>-----Original Message-----
>From: Konrad Windszus <ko...@gmx.de>
>Sent: Friday, March 19, 2021 12:51 PM
>To: dev@sling.apache.org
>Subject: Re: [RT] Make bundles with Sling-Initial-Content first-class
>citizens in feature model tooling
>
>Today I faced this issue while deploying Composum Nodes to AEMaaCS Publish
>(https://github.com/ist-dresden/composum-nodes/issues/237
><https://github.com/ist-dresden/composum-nodes/issues/237>):
>
>19.03.2021 02:56:13.558 [cm-p29008-e106842-aem-publish-748769766d-rs4bh]
>*ERROR* [Apache Sling Repository Startup Thread #1]
>org.apache.sling.jcr.contentloader.internal.ContentLoaderService Problem
>loading initial content of bundle com.composum.core.usermgnt (573)
>java.lang.UnsupportedOperationException: This builder is read-only.
> at
>org.apache.jackrabbit.oak.spi.state.ReadOnlyBuilder.unsupported(ReadOnlyBui
>lder.java:44) [org.apache.jackrabbit.oak-store-spi:1.39.0.R1886624]
> at
>org.apache.jackrabbit.oak.spi.state.ReadOnlyBuilder.remove(ReadOnlyBuilder.
>java:110) [org.apache.jackrabbit.oak-store-spi:1.39.0.R1886624]
> at
>org.apache.jackrabbit.oak.core.SecureNodeBuilder.remove(SecureNodeBuilder.j
>ava:166) [org.apache.jackrabbit.oak-core:1.39.0.R1886624]
> at
>org.apache.jackrabbit.oak.plugins.tree.impl.AbstractMutableTree.remove(Abst
>ractMutableTree.java:51) [org.apache.jackrabbit.oak-core:1.39.0.R1886624]
> at
>org.apache.jackrabbit.oak.core.MutableTree.remove(MutableTree.java:184)
>[org.apache.jackrabbit.oak-core:1.39.0.R1886624]
> at
>org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate.remove(NodeDelegate.jav
>a:701) [org.apache.jackrabbit.oak-jcr:1.39.0.R1886624]
> at
>org.apache.jackrabbit.oak.jcr.session.NodeImpl$4.performVoid(NodeImpl.java:
>242) [org.apache.jackrabbit.oak-jcr:1.39.0.R1886624]
> at
>org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionD
>elegate.java:275) [org.apache.jackrabbit.oak-jcr:1.39.0.R1886624]
> at
>org.apache.jackrabbit.oak.jcr.session.NodeImpl.remove(NodeImpl.java:235)
>[org.apache.jackrabbit.oak-jcr:1.39.0.R1886624]
> at
>org.apache.sling.jcr.contentloader.internal.BundleContentLoader.createFolde
>r(BundleContentLoader.java:509) [org.apache.sling.jcr.contentloader:2.3.0]
> at
>org.apache.sling.jcr.contentloader.internal.BundleContentLoader.installFrom
>Path(BundleContentLoader.java:364)
>[org.apache.sling.jcr.contentloader:2.3.0]
> at
>org.apache.sling.jcr.contentloader.internal.BundleContentLoader.installCont
>ent(BundleContentLoader.java:238)
>[org.apache.sling.jcr.contentloader:2.3.0]
> at
>org.apache.sling.jcr.contentloader.internal.BundleContentLoader.registerBun
>dleInternal(BundleContentLoader.java:148)
>[org.apache.sling.jcr.contentloader:2.3.0]
> at
>org.apache.sling.jcr.contentloader.internal.BundleContentLoader.registerBun
>dle(BundleContentLoader.java:95) [org.apache.sling.jcr.contentloader:2.3.0]
> at
>org.apache.sling.jcr.contentloader.internal.ContentLoaderService.activate(C
>ontentLoaderService.java:244) [org.apache.sling.jcr.contentloader:2.3.0]
> at
>java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>Method)
> at
>java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethod
>AccessorImpl.java:62)
> at
>java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Delegati
>ngMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> at
>org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod
>.java:244) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.j
>ava:41) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMet
>hod.java:685) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:
>529) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMeth
>od.java:318) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMeth
>od.java:308) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementati
>onObject(SingleComponentManager.java:354) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(Si
>ngleComponentManager.java:115) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleC
>omponentManager.java:1000) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal
>(SingleComponentManager.java:973) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal
>(AbstractComponentManager.java:785) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.
>addedService(DependencyManager.java:1271) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.
>addedService(DependencyManager.java:1222) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(Se
>rviceTracker.java:1200) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(Se
>rviceTracker.java:1121) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAddin
>g(ServiceTracker.java:928) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(Serv
>iceTracker.java:864) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(Ser
>viceTracker.java:1152) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChan
>ged(BundleComponentActivator.java:114) [org.apache.felix.scr:2.1.26]
> at
>org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(Ev
>entDispatcher.java:990)
> at
>org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispat
>cher.java:838)
> at
>org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher
>.java:545)
> at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4833)
> at org.apache.felix.framework.Felix.registerService(Felix.java:3804)
> at
>org.apache.felix.framework.BundleContextImpl.registerService(BundleContextI
>mpl.java:328)
> at
>org.apache.sling.jcr.base.AbstractSlingRepositoryManager.registerService(Ab
>stractSlingRepositoryManager.java:222) [org.apache.sling.jcr.base:3.1.6]
> at
>org.apache.sling.jcr.base.AbstractSlingRepositoryManager.initializeAndRegis
>terRepositoryService(AbstractSlingRepositoryManager.java:566)
>[org.apache.sling.jcr.base:3.1.6]
> at
>org.apache.sling.jcr.base.AbstractSlingRepositoryManager.access$300(Abstrac
>tSlingRepositoryManager.java:92) [org.apache.sling.jcr.base:3.1.6]
> at
>org.apache.sling.jcr.base.AbstractSlingRepositoryManager$4.run(AbstractSlin
>gRepositoryManager.java:527) [org.apache.sling.jcr.base:3.1.6]
>What about extending the Content Loader so that it only overwrites in case
>the nodes do actually differ?
>
>@Stefan: Have you created any JIRAs about your proposed options?
>Konrad