sling mocks "Creating resource resolver failed"

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

sling mocks "Creating resource resolver failed"

Santiago García Pimentel
Hello,

Im trying to use sling mocks and Im having problems when creating content when using the JCR_MOCK.

When trying to create a resource with :

    @Rule
    public final SlingContext context = new SlingContext(ResourceResolverType.JCR_MOCK);

and

context.create().resource("/content/web", ImmutableMap.of("jcr:title", "web"));

I get java.lang.RuntimeException: Creating resource resolver failed.
        at org.apache.sling.testing.mock.sling.context.SlingContextImpl.resourceResolver(SlingContextImpl.java:250)
        at org.apache.sling.testing.mock.sling.context.SlingContextImpl.create(SlingContextImpl.java:335)

        …..
Caused by: org.apache.sling.api.resource.LoginException: Calling bundle missing in authentication info
        at org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderStateFactory.createProviderState(JcrProviderStateFactory.java:129)
        at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.authenticate(JcrResourceProvider.java:284)
        at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.authenticate(JcrResourceProvider.java:75)
        at org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.authenticate(ProviderManager.java:161)
        at org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.getOrCreateProvider(ProviderManager.java:87)
        at org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.authenticateAll(ProviderManager.java:129)
        at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.createControl(ResourceResolverImpl.java:154)
        at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.<init>(ResourceResolverImpl.java:116)
        at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.<init>(ResourceResolverImpl.java:110)
        at org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl.getResourceResolverInternal(CommonResourceResolverFactoryImpl.java:257)
        at org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl.getAdministrativeResourceResolver(CommonResourceResolverFactoryImpl.java:140)
        at org.apache.sling.resourceresolver.impl.ResourceResolverFactoryImpl.getAdministrativeResourceResolver(ResourceResolverFactoryImpl.java:107)
        at org.apache.sling.testing.mock.sling.context.SlingContextImpl.resourceResolver(SlingContextImpl.java:248)
        ... 27 more



It seems to be caused by the recent changes in the use of administrative resource resolver, and Im not sure how to make it work. Anyone has a tip on this?

Santiago García Pimentel| Sr Software Engineer
Netcentric Ibérica SLU
M: +34687915463
[hidden email]  | www.netcentric.biz

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: sling mocks "Creating resource resolver failed"

Stefan Seifert
can you provide more details with version of sling mock you are using?
and if you are overrding some of it's dependencies (e.g. org.apache.sling.resourceresolver or org.apache.sling.jcr.resource) with other versions?

you might also try to move sling-mock test dependency to the top in your project POM to avoid conflicting transitive dependency.

stefan

>-----Original Message-----
>From: Santiago Garcia Pimentel [mailto:[hidden email]]
>Sent: Friday, April 28, 2017 12:33 PM
>To: [hidden email]
>Subject: sling mocks "Creating resource resolver failed"
>
>Hello,
>
>Im trying to use sling mocks and Im having problems when creating content
>when using the JCR_MOCK.
>
>When trying to create a resource with :
>
>    @Rule
>    public final SlingContext context = new
>SlingContext(ResourceResolverType.JCR_MOCK);
>
>and
>
>context.create().resource("/content/web", ImmutableMap.of("jcr:title",
>"web"));
>
>I get java.lang.RuntimeException: Creating resource resolver failed.
> at
>org.apache.sling.testing.mock.sling.context.SlingContextImpl.resourceResolv
>er(SlingContextImpl.java:250)
> at
>org.apache.sling.testing.mock.sling.context.SlingContextImpl.create(SlingCo
>ntextImpl.java:335)
>
> …..
>Caused by: org.apache.sling.api.resource.LoginException: Calling bundle
>missing in authentication info
> at
>org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderStateFactory.c
>reateProviderState(JcrProviderStateFactory.java:129)
> at
>org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.authe
>nticate(JcrResourceProvider.java:284)
> at
>org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.authe
>nticate(JcrResourceProvider.java:75)
> at
>org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.a
>uthenticate(ProviderManager.java:161)
> at
>org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.g
>etOrCreateProvider(ProviderManager.java:87)
> at
>org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.a
>uthenticateAll(ProviderManager.java:129)
> at
>org.apache.sling.resourceresolver.impl.ResourceResolverImpl.createControl(R
>esourceResolverImpl.java:154)
> at
>org.apache.sling.resourceresolver.impl.ResourceResolverImpl.<init>(Resource
>ResolverImpl.java:116)
> at
>org.apache.sling.resourceresolver.impl.ResourceResolverImpl.<init>(Resource
>ResolverImpl.java:110)
> at
>org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl.ge
>tResourceResolverInternal(CommonResourceResolverFactoryImpl.java:257)
> at
>org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl.ge
>tAdministrativeResourceResolver(CommonResourceResolverFactoryImpl.java:140)
> at
>org.apache.sling.resourceresolver.impl.ResourceResolverFactoryImpl.getAdmin
>istrativeResourceResolver(ResourceResolverFactoryImpl.java:107)
> at
>org.apache.sling.testing.mock.sling.context.SlingContextImpl.resourceResolv
>er(SlingContextImpl.java:248)
> ... 27 more
>
>
>
>It seems to be caused by the recent changes in the use of administrative
>resource resolver, and Im not sure how to make it work. Anyone has a tip on
>this?
>
>Santiago García Pimentel| Sr Software Engineer
>Netcentric Ibérica SLU
>M: +34687915463
>[hidden email]  | www.netcentric.biz

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sling mocks "Creating resource resolver failed"

Santiago García Pimentel
Hi Stefan,

Sure. I think most of it is in the newest or a very recent version.

Sling-mock 2.2.6
ResourceResolver-mock 1.1.16
sling-mock-oak 2.0.2
jcr-mock 1.2.0
org.apache.sling.jcr.resource 2.9.2

The problem, I think is that sling mocks uses the loginAdministrative when using JCR_MOCK and that doesn't work anymore since it requires to be whitelisted. Im not sure if this is a bug or I have to whitelist it somehow.

Greetings.

Santiago García Pimentel| Sr Software Engineer
Netcentric Ibérica SLU
M: +34687915463
[hidden email] <mailto:[hidden email]>  | www.netcentric.biz <http://www.netcentric.biz/>

> On Apr 28, 2017, at 12:35 PM, Stefan Seifert <[hidden email]> wrote:
>
> can you provide more details with version of sling mock you are using?
> and if you are overrding some of it's dependencies (e.g. org.apache.sling.resourceresolver or org.apache.sling.jcr.resource) with other versions?
>
> you might also try to move sling-mock test dependency to the top in your project POM to avoid conflicting transitive dependency.
>
> stefan
>
>> -----Original Message-----
>> From: Santiago Garcia Pimentel [mailto:[hidden email]]
>> Sent: Friday, April 28, 2017 12:33 PM
>> To: [hidden email]
>> Subject: sling mocks "Creating resource resolver failed"
>>
>> Hello,
>>
>> Im trying to use sling mocks and Im having problems when creating content
>> when using the JCR_MOCK.
>>
>> When trying to create a resource with :
>>
>>   @Rule
>>   public final SlingContext context = new
>> SlingContext(ResourceResolverType.JCR_MOCK);
>>
>> and
>>
>> context.create().resource("/content/web", ImmutableMap.of("jcr:title",
>> "web"));
>>
>> I get java.lang.RuntimeException: Creating resource resolver failed.
>> at
>> org.apache.sling.testing.mock.sling.context.SlingContextImpl.resourceResolv
>> er(SlingContextImpl.java:250)
>> at
>> org.apache.sling.testing.mock.sling.context.SlingContextImpl.create(SlingCo
>> ntextImpl.java:335)
>>
>> …..
>> Caused by: org.apache.sling.api.resource.LoginException: Calling bundle
>> missing in authentication info
>> at
>> org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderStateFactory.c
>> reateProviderState(JcrProviderStateFactory.java:129)
>> at
>> org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.authe
>> nticate(JcrResourceProvider.java:284)
>> at
>> org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.authe
>> nticate(JcrResourceProvider.java:75)
>> at
>> org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.a
>> uthenticate(ProviderManager.java:161)
>> at
>> org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.g
>> etOrCreateProvider(ProviderManager.java:87)
>> at
>> org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.a
>> uthenticateAll(ProviderManager.java:129)
>> at
>> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.createControl(R
>> esourceResolverImpl.java:154)
>> at
>> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.<init>(Resource
>> ResolverImpl.java:116)
>> at
>> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.<init>(Resource
>> ResolverImpl.java:110)
>> at
>> org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl.ge
>> tResourceResolverInternal(CommonResourceResolverFactoryImpl.java:257)
>> at
>> org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl.ge
>> tAdministrativeResourceResolver(CommonResourceResolverFactoryImpl.java:140)
>> at
>> org.apache.sling.resourceresolver.impl.ResourceResolverFactoryImpl.getAdmin
>> istrativeResourceResolver(ResourceResolverFactoryImpl.java:107)
>> at
>> org.apache.sling.testing.mock.sling.context.SlingContextImpl.resourceResolv
>> er(SlingContextImpl.java:248)
>> ... 27 more
>>
>>
>>
>> It seems to be caused by the recent changes in the use of administrative
>> resource resolver, and Im not sure how to make it work. Anyone has a tip on
>> this?
>>
>> Santiago García Pimentel| Sr Software Engineer
>> Netcentric Ibérica SLU
>> M: +34687915463
>> [hidden email]  | www.netcentric.biz
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: sling mocks "Creating resource resolver failed"

Stefan Seifert
and which version of the following bundles are used?

org.apache.sling.resourceresolver
org.apache.sling.api

stefan


>-----Original Message-----
>From: Santiago Garcia Pimentel [mailto:[hidden email]]
>Sent: Friday, April 28, 2017 12:49 PM
>To: [hidden email]
>Subject: Re: sling mocks "Creating resource resolver failed"
>
>Hi Stefan,
>
>Sure. I think most of it is in the newest or a very recent version.
>
>Sling-mock 2.2.6
>ResourceResolver-mock 1.1.16
>sling-mock-oak 2.0.2
>jcr-mock 1.2.0
>org.apache.sling.jcr.resource 2.9.2
>
>The problem, I think is that sling mocks uses the loginAdministrative when
>using JCR_MOCK and that doesn't work anymore since it requires to be
>whitelisted. Im not sure if this is a bug or I have to whitelist it
>somehow.
>
>Greetings.
>
>Santiago García Pimentel| Sr Software Engineer
>Netcentric Ibérica SLU
>M: +34687915463
>[hidden email] <mailto:[hidden email]>
>| www.netcentric.biz <http://www.netcentric.biz/>
>> On Apr 28, 2017, at 12:35 PM, Stefan Seifert <[hidden email]>
>wrote:
>>
>> can you provide more details with version of sling mock you are using?
>> and if you are overrding some of it's dependencies (e.g.
>org.apache.sling.resourceresolver or org.apache.sling.jcr.resource) with
>other versions?
>>
>> you might also try to move sling-mock test dependency to the top in your
>project POM to avoid conflicting transitive dependency.
>>
>> stefan
>>
>>> -----Original Message-----
>>> From: Santiago Garcia Pimentel [mailto:[hidden email]]
>>> Sent: Friday, April 28, 2017 12:33 PM
>>> To: [hidden email]
>>> Subject: sling mocks "Creating resource resolver failed"
>>>
>>> Hello,
>>>
>>> Im trying to use sling mocks and Im having problems when creating
>content
>>> when using the JCR_MOCK.
>>>
>>> When trying to create a resource with :
>>>
>>>   @Rule
>>>   public final SlingContext context = new
>>> SlingContext(ResourceResolverType.JCR_MOCK);
>>>
>>> and
>>>
>>> context.create().resource("/content/web", ImmutableMap.of("jcr:title",
>>> "web"));
>>>
>>> I get java.lang.RuntimeException: Creating resource resolver failed.
>>> at
>>>
>org.apache.sling.testing.mock.sling.context.SlingContextImpl.resourceResolv
>>> er(SlingContextImpl.java:250)
>>> at
>>>
>org.apache.sling.testing.mock.sling.context.SlingContextImpl.create(SlingCo
>>> ntextImpl.java:335)
>>>
>>> …..
>>> Caused by: org.apache.sling.api.resource.LoginException: Calling bundle
>>> missing in authentication info
>>> at
>>>
>org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderStateFactory.c
>>> reateProviderState(JcrProviderStateFactory.java:129)
>>> at
>>>
>org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.authe
>>> nticate(JcrResourceProvider.java:284)
>>> at
>>>
>org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.authe
>>> nticate(JcrResourceProvider.java:75)
>>> at
>>>
>org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.a
>>> uthenticate(ProviderManager.java:161)
>>> at
>>>
>org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.g
>>> etOrCreateProvider(ProviderManager.java:87)
>>> at
>>>
>org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.a
>>> uthenticateAll(ProviderManager.java:129)
>>> at
>>>
>org.apache.sling.resourceresolver.impl.ResourceResolverImpl.createControl(R
>>> esourceResolverImpl.java:154)
>>> at
>>>
>org.apache.sling.resourceresolver.impl.ResourceResolverImpl.<init>(Resource
>>> ResolverImpl.java:116)
>>> at
>>>
>org.apache.sling.resourceresolver.impl.ResourceResolverImpl.<init>(Resource
>>> ResolverImpl.java:110)
>>> at
>>>
>org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl.ge
>>> tResourceResolverInternal(CommonResourceResolverFactoryImpl.java:257)
>>> at
>>>
>org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl.ge
>>>
>tAdministrativeResourceResolver(CommonResourceResolverFactoryImpl.java:140)
>>> at
>>>
>org.apache.sling.resourceresolver.impl.ResourceResolverFactoryImpl.getAdmin
>>> istrativeResourceResolver(ResourceResolverFactoryImpl.java:107)
>>> at
>>>
>org.apache.sling.testing.mock.sling.context.SlingContextImpl.resourceResolv
>>> er(SlingContextImpl.java:248)
>>> ... 27 more
>>>
>>>
>>>
>>> It seems to be caused by the recent changes in the use of administrative
>>> resource resolver, and Im not sure how to make it work. Anyone has a tip
>on
>>> this?
>>>
>>> Santiago García Pimentel| Sr Software Engineer
>>> Netcentric Ibérica SLU
>>> M: +34687915463
>>> [hidden email]  | www.netcentric.biz
>>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sling mocks "Creating resource resolver failed"

Santiago García Pimentel
org.apache.sling.resourceresolver 1.4.8
org.apache.sling.api 2.16.2

I tried updating the resourceresolver version to 1.5.22 but got a different error:

java.lang.RuntimeException: Unable to initialize JCR_MOCK resource resolver factory: Unable to invoke method 'activate' for class org.apache.sling.resourceresolver.impl.ResourceResolverFactoryActivator
        at org.apache.sling.testing.mock.sling.context.ContextResourceResolverFactory.get(ContextResourceResolverFactory.java:66)
        at org.apache.sling.testing.mock.sling.context.SlingContextImpl.newResourceResolverFactory(SlingContextImpl.java:130)
        at org.apache.sling.testing.mock.sling.context.SlingContextImpl.setUp(SlingContextImpl.java:121)
        at org.apache.sling.testing.mock.sling.junit.SlingContext.access$100(SlingContext.java:40)
        at org.apache.sling.testing.mock.sling.junit.SlingContext$1.before(SlingContext.java:127)
        at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.RuntimeException: Unable to invoke method 'activate' for class org.apache.sling.resourceresolver.impl.ResourceResolverFactoryActivator
        at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.invokeMethod(OsgiServiceUtil.java:320)
        at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.invokeLifecycleMethod(OsgiServiceUtil.java:213)
        at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.activateDeactivate(OsgiServiceUtil.java:84)
        at org.apache.sling.testing.mock.osgi.MockOsgi.activate(MockOsgi.java:171)
        at org.apache.sling.testing.mock.sling.ResourceResolverFactoryInitializer.initializeResourceResolverFactoryActivator(ResourceResolverFactoryInitializer.java:129)
        at org.apache.sling.testing.mock.sling.ResourceResolverFactoryInitializer.setUp(ResourceResolverFactoryInitializer.java:74)
        at org.apache.sling.testing.mock.sling.MockSling.newResourceResolverFactory(MockSling.java:75)
        at org.apache.sling.testing.mock.sling.context.ContextResourceResolverFactory.get(ContextResourceResolverFactory.java:45)
        ... 21 more
Caused by: java.lang.UnsupportedOperationException
        at org.apache.sling.testing.mock.osgi.MockBundleContext.getBundle(MockBundleContext.java:454)
        at org.apache.sling.resourceresolver.impl.ResourceResolverFactoryActivator.checkFactoryPreconditions(ResourceResolverFactoryActivator.java:537)
        at org.apache.sling.resourceresolver.impl.ResourceResolverFactoryActivator.access$100(ResourceResolverFactoryActivator.java:72)
        at org.apache.sling.resourceresolver.impl.ResourceResolverFactoryActivator$1.providerAdded(ResourceResolverFactoryActivator.java:382)
        at org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker.register(ResourceProviderTracker.java:200)
        at org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker.access$200(ResourceProviderTracker.java:59)
        at org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker$1.addingService(ResourceProviderTracker.java:128)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
        at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
        at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
        at org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker.activate(ResourceProviderTracker.java:132)
        at org.apache.sling.resourceresolver.impl.ResourceResolverFactoryActivator.activate(ResourceResolverFactoryActivator.java:375)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.invokeMethod(OsgiServiceUtil.java:311)
        ... 28 more

Could it be that sling mocks is not prepared to use the latest resource resolver version?

Thanks for your help.

Santiago García Pimentel| Sr Software Engineer
Netcentric Ibérica SLU
M: +34687915463
[hidden email] <mailto:[hidden email]>  | www.netcentric.biz <http://www.netcentric.biz/>
> On Apr 28, 2017, at 5:08 PM, Stefan Seifert <[hidden email]> wrote:
>
> org.apache.sling.api

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: sling mocks "Creating resource resolver failed"

Stefan Seifert

>I tried updating the resourceresolver version to 1.5.22 but got a different
>error:

just hit this as well - also try osgi-mock 2.2.5-SNAPSHOT with the fix from SLING-6811

stefan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sling mocks "Creating resource resolver failed"

Santiago García Pimentel
thanks Stefan!

latest SNAPSHOT seems to work fine.

Greetings.

Santiago García Pimentel| Sr Software Engineer
Netcentric Ibérica SLU
M: +34687915463
[hidden email] <mailto:[hidden email]>  | www.netcentric.biz <http://www.netcentric.biz/>

> On Apr 28, 2017, at 5:44 PM, Stefan Seifert <[hidden email]> wrote:
>
>
>> I tried updating the resourceresolver version to 1.5.22 but got a different
>> error:
>
> just hit this as well - also try osgi-mock 2.2.5-SNAPSHOT with the fix from SLING-6811
>
> stefan
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sling mocks "Creating resource resolver failed"

Santiago García Pimentel
Hi again,

Coming back a bit on this.

It seems the the point is that the version of the sling api and the resourceResolver you use need to match, and this needs to be done explicitly in your pom.

This is more clear in the sling-mock source code. It has a profiles that uses different versions of the api and the resourceResolver:

for api 2.11 -> RR 1.4.8
for api 2.16 -> RR 1.5.x

I could not find this information in the documentation. I think it would be worth it to explicitly mention it in the documentation since it is not so common to depend directly on the resourceResolver api.

WDYT?

Greetings.


Santiago García Pimentel| Sr Software Engineer
Netcentric Ibérica SLU
M: +34687915463
[hidden email] <mailto:[hidden email]>  | www.netcentric.biz <http://www.netcentric.biz/>

> On Apr 30, 2017, at 11:03 AM, Santiago Garcia Pimentel <[hidden email]> wrote:
>
> thanks Stefan!
>
> latest SNAPSHOT seems to work fine.
>
> Greetings.
>
> Santiago García Pimentel| Sr Software Engineer
> Netcentric Ibérica SLU
> M: +34687915463
> [hidden email] <mailto:[hidden email]>  | www.netcentric.biz <http://www.netcentric.biz/>
>> On Apr 28, 2017, at 5:44 PM, Stefan Seifert <[hidden email] <mailto:[hidden email]>> wrote:
>>
>>
>>> I tried updating the resourceresolver version to 1.5.22 but got a different
>>> error:
>>
>> just hit this as well - also try osgi-mock 2.2.5-SNAPSHOT with the fix from SLING-6811
>>
>> stefan
>>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: sling mocks "Creating resource resolver failed"

Stefan Seifert
using a newer Sling API than that sling-mocks was compiled against is usually no problem, because the API is backwards-compatible.
the problems start if other dependencies esp. org.apache.sling.resourceresolver or org.apache.sling.jcr.resource are updated withouth the other.

this is a sort of dependency hell we cannot solve automatically, because it highly depends on the dependencies already declared in the project poms. some hints are included in this talk
https://adapt.to/2016/en/schedule/unit-testing-with-sling-aem-mocks.html

if you have a proposal for some information added to the sling mocks documentation to make it easier for people to solve these issues i would be glad to add them to the sling site.

stefan


>-----Original Message-----
>From: Santiago Garcia Pimentel [mailto:[hidden email]]
>Sent: Tuesday, May 2, 2017 3:44 PM
>To: [hidden email]
>Subject: Re: sling mocks "Creating resource resolver failed"
>
>Hi again,
>
>Coming back a bit on this.
>
>It seems the the point is that the version of the sling api and the
>resourceResolver you use need to match, and this needs to be done
>explicitly in your pom.
>
>This is more clear in the sling-mock source code. It has a profiles that
>uses different versions of the api and the resourceResolver:
>
>for api 2.11 -> RR 1.4.8
>for api 2.16 -> RR 1.5.x
>
>I could not find this information in the documentation. I think it would be
>worth it to explicitly mention it in the documentation since it is not so
>common to depend directly on the resourceResolver api.
>
>WDYT?
>
>Greetings.
>
>
>Santiago García Pimentel| Sr Software Engineer
>Netcentric Ibérica SLU
>M: +34687915463
>[hidden email] <mailto:[hidden email]>
>| www.netcentric.biz <http://www.netcentric.biz/>
>> On Apr 30, 2017, at 11:03 AM, Santiago Garcia Pimentel
><[hidden email]> wrote:
>>
>> thanks Stefan!
>>
>> latest SNAPSHOT seems to work fine.
>>
>> Greetings.
>>
>> Santiago García Pimentel| Sr Software Engineer
>> Netcentric Ibérica SLU
>> M: +34687915463
>> [hidden email]
><mailto:[hidden email]>  | www.netcentric.biz
><http://www.netcentric.biz/>
>>> On Apr 28, 2017, at 5:44 PM, Stefan Seifert <[hidden email]
><mailto:[hidden email]>> wrote:
>>>
>>>
>>>> I tried updating the resourceresolver version to 1.5.22 but got a
>different
>>>> error:
>>>
>>> just hit this as well - also try osgi-mock 2.2.5-SNAPSHOT with the fix
>from SLING-6811
>>>
>>> stefan
>>>
>>

Loading...