Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi Tenant : createTenant method is creating tenant partially #2733

Open
harishreddy-m opened this issue Dec 16, 2015 · 1 comment
Open

Comments

@harishreddy-m
Copy link

Environment:
Ubuntu 15.04 64 bit
Pentaho-platform 6.1-SNAPSHOT

While Trying to create tenant with

SecurityHelper.getInstance().runAsUser(JcrTenantUtils.getTenantedUser("admin"),new CallableParam<Void>(principleName) {
                        String principleName = this.getParamString();
                        @Override
                        public Void call() throws Exception {
        tenantManager.createTenant(JcrTenantUtils.getDefaultTenant(),principleName,"Administrator", "authenticated", "Anonymous");
                            return null;
                        }
                    });

following errors are logged

org.springframework.extensions.jcr.JcrSystemException: Repository access exception; nested exception is javax.jcr.RepositoryException: Error retrieving RuntimeRoles for folder, folder not found
        at org.springframework.extensions.jcr.SessionFactoryUtils.translateException(SessionFactoryUtils.java:223)
        at org.springframework.extensions.jcr.JcrAccessor.convertJcrAccessException(JcrAccessor.java:58)
        at org.pentaho.platform.repository2.unified.jcr.sejcr.PentahoJcrTemplate.pentahoConvertJcrAccessException(PentahoJcrTemplate.java:103)
        at org.pentaho.platform.repository2.unified.jcr.sejcr.PentahoJcrTemplate.execute(PentahoJcrTemplate.java:69)
        at org.springframework.extensions.jcr.JcrTemplate.execute(JcrTemplate.java:115)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileAclDao.updateAcl(JcrRepositoryFileAclDao.java:363)
        at org.pentaho.platform.repository2.mt.RepositoryTenantManager.createTenant(RepositoryTenantManager.java:236)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at com.sun.proxy.$Proxy150.createTenant(Unknown Source)


Caused by: javax.jcr.RepositoryException: Error retrieving RuntimeRoles for folder, folder not found
        at org.pentaho.platform.security.policy.rolebased.AbstractJcrBackedRoleBindingDao.getRuntimeRolesFolderNode(AbstractJcrBackedRoleBindingDao.java:328)
        at org.pentaho.platform.security.policy.rolebased.AbstractJcrBackedRoleBindingDao.getBoundLogicalRoleNames(AbstractJcrBackedRoleBindingDao.java:166)
        at org.pentaho.platform.security.policy.rolebased.AbstractJcrBackedRoleBindingDao.getBoundLogicalRoleNames(AbstractJcrBackedRoleBindingDao.java:128)
        at org.apache.jackrabbit.core.security.authorization.acl.PentahoEntryCollector.isAllowed(PentahoEntryCollector.java:514)
        at org.apache.jackrabbit.core.security.authorization.acl.PentahoEntryCollector.getAcesIncludingMagicAces(PentahoEntryCollector.java:308)
        at org.apache.jackrabbit.core.security.authorization.acl.PentahoEntryCollector.getEntries(PentahoEntryCollector.java:237)
        at org.apache.jackrabbit.core.security.authorization.acl.CachingPentahoEntryCollector.internalUpdateCache(CachingPentahoEntryCollector.java:175)
        at org.apache.jackrabbit.core.security.authorization.acl.CachingPentahoEntryCollector.throttledUpdateCache(CachingPentahoEntryCollector.java:218)
        at org.apache.jackrabbit.core.security.authorization.acl.CachingPentahoEntryCollector.updateCache(CachingPentahoEntryCollector.java:193)
        at org.apache.jackrabbit.core.security.authorization.acl.CachingPentahoEntryCollector.getEntries(CachingPentahoEntryCollector.java:148)
        at org.apache.jackrabbit.core.security.authorization.acl.PentahoEntryCollector.collectEntries(PentahoEntryCollector.java:470)
        at org.apache.jackrabbit.core.security.authorization.acl.PentahoCompiledPermissionsImpl.buildResult(PentahoCompiledPermissionsImpl.java:104)
        at org.apache.jackrabbit.core.security.authorization.acl.PentahoCompiledPermissionsImpl.buildResult(PentahoCompiledPermissionsImpl.java:218)
        at org.apache.jackrabbit.core.security.authorization.AbstractCompiledPermissions.getResult(AbstractCompiledPermissions.java:55)
        at org.apache.jackrabbit.core.security.authorization.AbstractCompiledPermissions.grants(AbstractCompiledPermissions.java:110)
        at org.apache.jackrabbit.core.security.DefaultAccessManager.isGranted(DefaultAccessManager.java:246)
        at org.apache.jackrabbit.core.security.DefaultAccessManager.isGranted(DefaultAccessManager.java:254)
        at org.apache.jackrabbit.core.ProtectedItemModifier.checkPermission(ProtectedItemModifier.java:175)
        at org.apache.jackrabbit.core.ProtectedItemModifier.addNode(ProtectedItemModifier.java:74)
        at org.apache.jackrabbit.core.ProtectedItemModifier.addNode(ProtectedItemModifier.java:70)
        at org.apache.jackrabbit.core.security.authorization.acl.ACLEditor.setPolicy(ACLEditor.java:205)
        at org.apache.jackrabbit.core.security.DefaultAccessManager.setPolicy(DefaultAccessManager.java:361)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileAclDao.internalUpdateAcl(JcrRepositoryFileAclDao.java:437)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileAclDao$6.doInJcr(JcrRepositoryFileAclDao.java:367)
        at org.pentaho.platform.repository2.unified.jcr.sejcr.PentahoJcrTemplate.execute(PentahoJcrTemplate.java:64)
        ... 106 more
Caused by: javax.jcr.PathNotFoundException: /pentaho/tenant0/anyTenantName
        at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:552)
        at org.apache.jackrabbit.core.session.SessionItemOperation$4.perform(SessionItemOperation.java:97)
        at org.apache.jackrabbit.core.session.SessionItemOperation$4.perform(SessionItemOperation.java:93)
        at org.apache.jackrabbit.core.session.SessionItemOperation.perform(SessionItemOperation.java:187)
        at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216)
        at org.apache.jackrabbit.core.SessionImpl.perform(SessionImpl.java:361)
        at org.apache.jackrabbit.core.SessionImpl.getItem(SessionImpl.java:786)
        at org.pentaho.platform.security.policy.rolebased.AbstractJcrBackedRoleBindingDao.getRuntimeRolesFolderNode(AbstractJcrBackedRoleBindingDao.java:326)
        ... 130 more






java.lang.RuntimeException: Error creating initial tenant folders
        at org.pentaho.platform.repository2.mt.RepositoryTenantManager.createTenant(RepositoryTenantManager.java:249)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at com.sun.proxy.$Proxy150.createTenant(Unknown Source)
        at com.ccclogic.pentaho.mt.action.CCCLogicTenantManagementService$1.call(CCCLogicTenantManagementService.java:124)
        at com.ccclogic.pentaho.mt.action.CCCLogicTenantManagementService$1.call(CCCLogicTenantManagementService.java:117)
        at org.pentaho.platform.engine.security.SecurityHelper.runAsUser(SecurityHelper.java:173)
        at org.pentaho.platform.engine.security.SecurityHelper.runAsUser(SecurityHelper.java:162)


Caused by: org.springframework.extensions.jcr.JcrSystemException: Repository access exception; nested exception is javax.jcr.RepositoryException: Failed to list child nodes of node /pentaho/tenant0/anyTenantName/rep:policy
        at org.springframework.extensions.jcr.SessionFactoryUtils.translateException(SessionFactoryUtils.java:223)
        at org.springframework.extensions.jcr.JcrAccessor.convertJcrAccessException(JcrAccessor.java:58)
        at org.pentaho.platform.repository2.unified.jcr.sejcr.PentahoJcrTemplate.pentahoConvertJcrAccessException(PentahoJcrTemplate.java:103)
        at org.pentaho.platform.repository2.unified.jcr.sejcr.PentahoJcrTemplate.execute(PentahoJcrTemplate.java:69)
        at org.springframework.extensions.jcr.JcrTemplate.execute(JcrTemplate.java:115)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileAclDao.getAcl(JcrRepositoryFileAclDao.java:336)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileDao$4.doInJcr(JcrRepositoryFileDao.java:390)

        at org.pentaho.platform.repository2.unified.jcr.sejcr.PentahoJcrTemplate.execute(PentahoJcrTemplate.java:64)
        at org.springframework.extensions.jcr.JcrTemplate.execute(JcrTemplate.java:115)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileDao.internalGetFileById(JcrRepositoryFileDao.java:381)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileDao.getFileById(JcrRepositoryFileDao.java:338)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileDao.internalCreateFolder(JcrRepositoryFileDao.java:136)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileDao.access$400(JcrRepositoryFileDao.java:73)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileDao$2.doInJcr(JcrRepositoryFileDao.java:328)
        at org.pentaho.platform.repository2.unified.jcr.sejcr.PentahoJcrTemplate.execute(PentahoJcrTemplate.java:64)
        at org.springframework.extensions.jcr.JcrTemplate.execute(JcrTemplate.java:115)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileDao.createFolder(JcrRepositoryFileDao.java:325)
        at org.pentaho.platform.repository2.mt.RepositoryTenantManager.createPublicFolder(RepositoryTenantManager.java:463)
        at org.pentaho.platform.repository2.mt.RepositoryTenantManager.createInitialTenantFolders(RepositoryTenantManager.java:530)
        at org.pentaho.platform.repository2.mt.RepositoryTenantManager.createTenant(RepositoryTenantManager.java:247)
        ... 103 more
Caused by: javax.jcr.RepositoryException: Failed to list child nodes of node /pentaho/tenant0/anyTenantName/rep:policy
        at org.apache.jackrabbit.core.NodeImpl$9.perform(NodeImpl.java:2208)
        at org.apache.jackrabbit.core.NodeImpl$9.perform(NodeImpl.java:2202)
        at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216)
        at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91)
        at org.apache.jackrabbit.core.NodeImpl.getNodes(NodeImpl.java:2202)
        at org.apache.jackrabbit.core.security.authorization.acl.ACLTemplate.<init>(ACLTemplate.java:141)
        at org.apache.jackrabbit.core.security.authorization.acl.ACLEditor.getACL(ACLEditor.java:92)
        at org.apache.jackrabbit.core.security.authorization.acl.ACLEditor.getPolicies(ACLEditor.java:106)
        at org.apache.jackrabbit.core.security.DefaultAccessManager.getPolicies(DefaultAccessManager.java:314)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileAclDao.getAccessControlList(JcrRepositoryFileAclDao.java:326)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileAclDao.toAcl(JcrRepositoryFileAclDao.java:208)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileAclDao.access$300(JcrRepositoryFileAclDao.java:71)
        at org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileAclDao$4.doInJcr(JcrRepositoryFileAclDao.java:339)
        at org.pentaho.platform.repository2.unified.jcr.sejcr.PentahoJcrTemplate.execute(PentahoJcrTemplate.java:64)
        ... 119 more
Caused by: javax.jcr.ItemNotFoundException: d400f494-186f-4ec1-b937-894248325883
        at org.apache.jackrabbit.core.ItemManager.getItemData(ItemManager.java:384)
        at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:328)
        at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:622)
        at org.apache.jackrabbit.core.security.authorization.acl.PentahoCompiledPermissionsImpl.canRead(PentahoCompiledPermissionsImpl.java:277)
        at org.apache.jackrabbit.core.security.DefaultAccessManager.canRead(DefaultAccessManager.java:265)
        at org.apache.jackrabbit.core.ItemManager.canRead(ItemManager.java:438)
        at org.apache.jackrabbit.core.ItemManager.getItemData(ItemManager.java:395)
        at org.apache.jackrabbit.core.ItemManager.getItemData(ItemManager.java:349)
        at org.apache.jackrabbit.core.ItemManager.getChildNodes(ItemManager.java:744)
        at org.apache.jackrabbit.core.NodeImpl$9.perform(NodeImpl.java:2206)
        ... 132 more

But when same code is executed second time, pentaho throws AlreadyExistsException.

When I try to create folder, I am getting

javax.jcr.PathNotFoundException: /pentaho/tenant0/anyTenantName

I debugged and found that
doInJcr method is using following session
type:
session XASessionImpl (id=247)
sessionName "session-admin-%2Fpentaho%2Ftenant0-289" (id=267)

@harishreddy-m
Copy link
Author

Jackrabbit-core version : 2.10.1
I enabled DEBUG level logging for jacrabbit logs.
Attaching the logs.

jackrabbit-2.10.1.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant