You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (Jira)" <ji...@apache.org> on 2022/09/09 12:57:00 UTC

[jira] [Comment Edited] (SLING-11572) sling-mock-oak: Calling isResourceType() on service resolver throws Login Failure exception

    [ https://issues.apache.org/jira/browse/SLING-11572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17602321#comment-17602321 ] 

Stefan Seifert edited comment on SLING-11572 at 9/9/22 12:56 PM:
-----------------------------------------------------------------

root cause information from [https://wcm-io.atlassian.net/browse/WTES-44?focusedCommentId=21524:]
{quote}The root cause seem to be here: [https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/ee2a0b2317ec71c3af6e0655cf04487fc7273056/src/main/java/org/apache/sling/resourceresolver/impl/helper/ResourceResolverControl.java#L851]. This block is executed for non admin resource resolvers.

The FrameworkUtil.getBundle(ResourceResolverControl.class) call returns null. As the authenticationInfo contains no other authentication information the processing eventually fail in the [JcrProviderStateFactory|https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/master/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderStateFactory.java#L97]: due to the bundle being null (should be a MockBundle) there will be login attempt on the repository with null Credentials [here|https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/master/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderStateFactory.java#L131].
{quote}


was (Author: sseifert@pro-vision.de):
root cause information from [https://wcm-io.atlassian.net/browse/WTES-44?focusedCommentId=21524:]
{quote}The root cause seem to be here: [https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/master/src/main/java/org/apache/sling/resourceresolver/impl/helper/ResourceResolverControl.java#L851] . This block is executed for non admin resource resolvers.

The FrameworkUtil.getBundle(ResourceResolverControl.class) call returns null. As the authenticationInfo contains no other authentication information the processing eventually fail in the [JcrProviderStateFactory|https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/master/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderStateFactory.java#L97]: due to the bundle being null (should be a MockBundle) there will be login attempt on the repository with null Credentials [here|https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/master/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderStateFactory.java#L131].
{quote}

> sling-mock-oak: Calling isResourceType() on service resolver throws Login Failure exception
> -------------------------------------------------------------------------------------------
>
>                 Key: SLING-11572
>                 URL: https://issues.apache.org/jira/browse/SLING-11572
>             Project: Sling
>          Issue Type: Bug
>          Components: Testing
>    Affects Versions: Testing Sling Mock Oak 3.1.2-1.40.0
>            Reporter: Stefan Seifert
>            Assignee: Stefan Seifert
>            Priority: Major
>             Fix For: Testing Sling Mock Oak 3.1.4-1.40.0, Testing Sling Mock 3.4.2
>
>
> this is a follow-up of https://wcm-io.atlassian.net/browse/WTES-44
> when calling isResourceType within a service resolver i new resource resolver session is tried to create internally - and this currently fails when using the JCR_OAK resource resolver type with an error like this:
> {noformat}
> java.lang.IllegalStateException: Failed to create resource-type ResourceResolver
> at org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.getResourceTypeResourceResolver(ResourceResolverControl.java:707)
> at org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.getParentResourceType(ResourceResolverControl.java:729)
> at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.getParentResourceType(ResourceResolverImpl.java:1028)
> at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.getParentResourceType(ResourceResolverImpl.java:1017)
> at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.isResourceType(ResourceResolverImpl.java:1045)
> at org.apache.sling.api.resource.AbstractResource.isResourceType(AbstractResource.java:121)
> at io.wcm.issues.sampleTests.SampleTest.testIsResourceType(SampleTest.java:39)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
> at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
> 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.junit.runner.JUnitCore.run(JUnitCore.java:137)
> at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
> at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
> at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
> Caused by: org.apache.sling.api.resource.LoginException: Login Failure: all modules ignored
> at org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderStateFactory.getLoginException(JcrProviderStateFactory.java:224)
> at org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderStateFactory.createProviderState(JcrProviderStateFactory.java:135)
> at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.authenticate(JcrResourceProvider.java:304)
> at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.authenticate(JcrResourceProvider.java:76)
> 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:142)
> at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.<init>(ResourceResolverImpl.java:103)
> at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.<init>(ResourceResolverImpl.java:97)
> at org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl.getResourceResolverInternal(CommonResourceResolverFactoryImpl.java:280)
> at org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl.getServiceResourceResolver(CommonResourceResolverFactoryImpl.java:415)
> at org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.getResourceTypeResourceResolver(ResourceResolverControl.java:705)
> ... 34 more
> Caused by: javax.security.auth.login.LoginException: Login Failure: all modules ignored
> at javax.security.auth.login.LoginContext.invoke(LoginContext.java:906)
> at javax.security.auth.login.LoginContext.access$000(LoginContext.java:195)
> at javax.security.auth.login.LoginContext$4.run(LoginContext.java:682)
> at javax.security.auth.login.LoginContext$4.run(LoginContext.java:680)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
> at javax.security.auth.login.LoginContext.login(LoginContext.java:587)
> at org.apache.jackrabbit.oak.core.ContentRepositoryImpl.login(ContentRepositoryImpl.java:163)
> at org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl.login(RepositoryImpl.java:282)
> at org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl.login(RepositoryImpl.java:225)
> at org.apache.sling.testing.mock.sling.oak.OakMockSlingRepository.login(OakMockSlingRepository.java:123)
> at org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderStateFactory.createProviderState(JcrProviderStateFactory.java:132)
> ... 45 more
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)