wso2 / product-is

Welcome to the WSO2 Identity Server source code! For info on working with the WSO2 Identity Server repository and contributing code, click the link below.
http://wso2.github.io/
Apache License 2.0
748 stars 729 forks source link

Error while creating tenant #20208

Closed darshanasbg closed 7 months ago

darshanasbg commented 7 months ago

Describe the issue: Getting following error when running tests with framework version 7.1.21.

TID: [-1234] [TenantMgtAdminService] [2024-04-17 11:46:43,665] [6600902e-2564-4313-8e0f-773608ab94e2] ERROR {org.wso2.carbon.identity.application.mgt.dao.impl.CacheBackedApplicationDAO} - Error occurred while retrieving the application, wso2carbon-local-sp org.wso2.carbon.identity.application.common.IdentityApplicationManagementException: Error while retrieving associated roles for application ID: 0e65e210-09c0-463e-a835-58f131281854
    at org.wso2.carbon.identity.application.mgt.dao.impl.ApplicationDAOImpl.getAssociatedRoles(ApplicationDAOImpl.java:2300)
    at org.wso2.carbon.identity.application.mgt.dao.impl.ApplicationDAOImpl.getApplication(ApplicationDAOImpl.java:2229)
    at org.wso2.carbon.identity.application.mgt.dao.impl.ApplicationDAOImpl.getApplication(ApplicationDAOImpl.java:1828)
    at org.wso2.carbon.identity.application.mgt.dao.impl.CacheBackedApplicationDAO.getApplication(CacheBackedApplicationDAO.java:96)
    at org.wso2.carbon.identity.application.mgt.ApplicationManagementServiceImpl.getServiceProvider(ApplicationManagementServiceImpl.java:1246)
    at org.wso2.carbon.identity.provisioning.OutboundProvisioningManager.provision(OutboundProvisioningManager.java:362)
    at org.wso2.carbon.identity.provisioning.listener.DefaultInboundUserProvisioningListener.doPreSetUserClaimValues(DefaultInboundUserProvisioningListener.java:208)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.setUserClaimValues(AbstractUserStoreManager.java:4506)
    at org.wso2.carbon.tenant.mgt.util.TenantMgtUtil.addClaimsToUserStoreManager(TenantMgtUtil.java:504)
    at org.wso2.carbon.tenant.mgt.services.TenantMgtAdminService.registerTenant(TenantMgtAdminService.java:101)
    at org.wso2.carbon.tenant.mgt.services.TenantMgtAdminService.addTenant(TenantMgtAdminService.java:62)
    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.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
    at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
    at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:173)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:148)
    at org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:238)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:555)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
    at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
    at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
    at org.owasp.csrfguard.CsrfGuardFilter.doFilter(CsrfGuardFilter.java:88)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
    at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:129)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
    at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:65)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
    at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:129)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:168)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
    at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:119)
    at org.wso2.carbon.identity.context.rewrite.valve.OrganizationContextRewriteValve.invoke(OrganizationContextRewriteValve.java:123)
    at org.wso2.carbon.tomcat.ext.valves.SameSiteCookieValve.invoke(SameSiteCookieValve.java:38)
    at org.wso2.carbon.identity.cors.valve.CORSValve.invoke(CORSValve.java:83)
    at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:211)
    at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:120)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:110)
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:71)
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:152)
    at org.wso2.carbon.extension.identity.x509Certificate.valve.X509CertificateAuthenticationValve.invoke(X509CertificateAuthenticationValve.java:59)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:670)
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:63)
    at org.wso2.carbon.tomcat.ext.valves.RequestEncodingValve.invoke(RequestEncodingValve.java:49)
    at org.wso2.carbon.tomcat.ext.valves.RequestCorrelationIdValve.invoke(RequestCorrelationIdValve.java:137)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:390)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:928)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1794)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.wso2.carbon.identity.role.v2.mgt.core.exception.IdentityRoleManagementServerException: Error while retrieving the organization name for the given id: 924167b5-e7e1-405d-a9fc-61aee22c81e7
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.getOrganizationName(RoleDAOImpl.java:2301)
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.getAudienceName(RoleDAOImpl.java:2282)
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.buildRolesList(RoleDAOImpl.java:2541)
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.processListRolesQuery(RoleDAOImpl.java:2507)
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.getFilteredRolesBasicInfo(RoleDAOImpl.java:360)
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.getRoles(RoleDAOImpl.java:332)
    at org.wso2.carbon.identity.role.v2.mgt.core.RoleManagementServiceImpl.getRoles(RoleManagementServiceImpl.java:216)
    at org.wso2.carbon.identity.application.mgt.dao.impl.ApplicationDAOImpl.getAssociatedRoles(ApplicationDAOImpl.java:2286)
    ... 77 more
Caused by: org.wso2.carbon.identity.organization.management.service.exception.OrganizationManagementClientException: Unable to retrieve the organization name
    at org.wso2.carbon.identity.organization.management.service.util.Utils.handleClientException(Utils.java:95)
    at org.wso2.carbon.identity.organization.management.service.OrganizationManagerImpl.lambda$getOrganizationNameById$0(OrganizationManagerImpl.java:217)
    at java.base/java.util.Optional.orElseThrow(Optional.java:408)
    at org.wso2.carbon.identity.organization.management.service.OrganizationManagerImpl.getOrganizationNameById(OrganizationManagerImpl.java:216)
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.getOrganizationName(RoleDAOImpl.java:2298)
    ... 84 more

How to reproduce: Update framework version 7.1.21 or later (current latest 7.1.23) and try to create a tenant, it throws above error.

Expected behavior: Tenant should get created without any issues.

Environment information (Please complete the following information; remove any unnecessary fields) :

darshanasbg commented 7 months ago

Updated product-is framework version with: https://github.com/wso2/product-is/pull/20205