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 728 forks source link

Unable to Setup Branding with DB2 Database #18319

Closed NilukaSripalim closed 1 week ago

NilukaSripalim commented 11 months ago

Describe the issue: Issue while attempting to set up branding "Design" in Console with a DB2 database. The UI displays the following error message:

Update Error: An error occurred while updating the Branding preferences for carbon.super.

wso2carbon.log

 [397fa34f-695e-49d3-a0fc-d8881b289e19] ERROR {org.wso2.carbon.identity.api.server.branding.preference.management.v1.core.BrandingPreferenceManagementService} - errorCode: BPM-65004 | message: Error while updating branding preference configurations for organization: %s. org.wso2.carbon.identity.branding.preference.management.core.exception.BrandingPreferenceMgtServerException: Error while getting branding preference configurations for tenant: carbon.super.
    at org.wso2.carbon.identity.branding.preference.management.core.util.BrandingPreferenceMgtUtils.handleServerException(BrandingPreferenceMgtUtils.java:107)
    at org.wso2.carbon.identity.branding.preference.management.core.BrandingPreferenceManagerImpl.getBrandingPreference(BrandingPreferenceManagerImpl.java:169)
    at org.wso2.carbon.identity.branding.preference.management.core.BrandingPreferenceManagerImpl.replaceBrandingPreference(BrandingPreferenceManagerImpl.java:202)
    at org.wso2.carbon.identity.api.server.branding.preference.management.v1.core.BrandingPreferenceManagementService.updateBrandingPreference(BrandingPreferenceManagementService.java:229)
    at org.wso2.carbon.identity.api.server.branding.preference.management.v1.impl.BrandingPreferenceApiServiceImpl.updateBrandingPreference(BrandingPreferenceApiServiceImpl.java:247)
    at org.wso2.carbon.identity.api.server.branding.preference.management.v1.BrandingPreferenceApi.updateBrandingPreference(BrandingPreferenceApi.java:257)
    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.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265)
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:304)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:234)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:558)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:279)
    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.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:661)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:425)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:357)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:294)
    at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:147)
    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:179)
    at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:144)
    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.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.configuration.mgt.core.exception.ConfigurationManagementServerException: Error while retrieving the file: 13dd8c38-9dc4-407e-8e1d-a2eec7ccdbd2.
    at org.wso2.carbon.identity.configuration.mgt.core.util.ConfigurationUtils.handleServerException(ConfigurationUtils.java:105)
    at org.wso2.carbon.identity.configuration.mgt.core.dao.impl.ConfigurationDAOImpl.getFileById(ConfigurationDAOImpl.java:1439)
    at org.wso2.carbon.identity.configuration.mgt.core.dao.impl.CachedBackedConfigurationDAO.getFileById(CachedBackedConfigurationDAO.java:236)
    at org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManagerImpl.getFileById(ConfigurationManagerImpl.java:967)
    at org.wso2.carbon.identity.branding.preference.management.core.BrandingPreferenceManagerImpl.getBrandingPreference(BrandingPreferenceManagerImpl.java:154)
    ... 59 more
Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][10120][11936][4.26.14] Invalid operation: Lob is closed. ERRORCODE=-4470, SQLSTATE=null
    at com.ibm.db2.jcc.am.b7.a(b7.java:794)
    at com.ibm.db2.jcc.am.b7.a(b7.java:66)
    at com.ibm.db2.jcc.am.b7.a(b7.java:107)
    at com.ibm.db2.jcc.am.c6.c(c6.java:67)
    at com.ibm.db2.jcc.am.c7.v(c7.java:204)
    at com.ibm.db2.jcc.am.c7.getBinaryStream(c7.java:108)
    at org.wso2.carbon.identity.configuration.mgt.core.dao.impl.ConfigurationDAOImpl.getFileById(ConfigurationDAOImpl.java:1437)
    ... 62 more

https://github.com/wso2/product-is/assets/39120228/89f4a2d3-94f8-4866-aca7-b48900379ead

How to reproduce: Configure DB2 database in toml. Log in to the console. Navigate to the branding "Design" section. Attempt to update or modify branding preferences. Observe the error message in the UI.

Expected behavior:

Certainly! Here's a template for a Git issue:

Issue Title: Unable to Setup Branding "Design" with DB2 Database

Description:

I am encountering difficulties while attempting to set up branding "Design" in WSO2 Identity Server with a DB2 database. The UI displays the following error message:

rust Copy code Update Error: An error occurred while updating the Branding preferences for carbon.super. Steps to Reproduce:

Configure WSO2 Identity Server to use a DB2 database. Log in to the Identity Server management console. Navigate to the branding "Design" section. Attempt to update or modify branding preferences. Observe the error message in the UI. Expected Behavior:

The branding "Design" should be set up successfully without encountering any errors related to the database, and the UI should reflect the changes made.

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


brionmario commented 11 months ago

@UdeshAthukorala FYI

ZiyamSanthosh commented 11 months ago

The JSON file related to the specific branding preference is being saved in the database as BLOB objects. In DB2 database, the datasource will dynamically determines the most efficient mode to return BLOB or XML data. This step is based on the size of the LOBs or XML objects.

The DB2 JDBC drivers have a parameter named progressiveStreaming to decide how such objects should be returned. If the value is not set or if the value is set to 1, the driver will not load the LOB data into memory all at once, but will instead load it in small chunks as you access the data. This will not be suitable for our implementation. Hence, this parameter has to be specified in the connection string as progressiveStreaming=2 which will disable the progressive streaming.

Since, this doesn't require any code changes, the relevant instructions should be mentioned in the documentation.

Sample configuration to be added to the deployment.toml

type = "db2"
url = "jdbc:db2://localhost:50000/isrc11:progressiveStreaming=2;"
username = "db2inst1"
password = "password"
driver = "com.ibm.db2.jcc.DB2Driver"

[1] https://www.ibm.com/docs/en/db2/11.5?topic=pdsdjs-common-data-server-driver-jdbc-sqlj-properties-all-database-products#:~:text=property%20is%20int.-,progressiveStreaming,-Specifies%20whether%20the [2] https://www.ibm.com/docs/en/db2/11.5?topic=keywords-progressivestreaming [3] https://stackoverflow.com/questions/22659970/lob-is-closed-errorcode-4470-sqlstate-null

https://github.com/wso2/product-is/assets/50801227/b7d42072-1ff1-4210-8325-ddee573fbda8

ZiyamSanthosh commented 11 months ago

We can add the connection string parameter through the infer.json file. So, it is not required to add it through deployment.toml. Hence it is not required to mention in the documentation as well.

NilukaSripalim commented 11 months ago

Functional part is tested and verified, but untill docs update, will keep this issue in an open state

Screenshot 2023-12-13 at 17 35 21
isharak commented 1 week ago

This issue is being closed due to extended inactivity. Please feel free to reopen it if further attention is needed. Thank you for helping us keep the issue list relevant and focused!