Uploaded image for project: 'Red Hat build of Keycloak'
  1. Red Hat build of Keycloak
  2. RHBK-2998

Oracle driver problems in keycloak 26.2.1 [GHI#39182]

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      Before reporting an issue

      [x] I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

      Area

      dependencies

      Describe the bug

      I am using kubernetes and have created a minimal image, just adding ojdbc17 and orai18n as described in current documentation, my image is based on the quay.io/keycloak/keycloak:26.2.1-0 image.
      My image starts and seems to work when started using -transaction-xa-enabled false but fails to start when invoked with -transaction-xa-enabled true (In both situations there are more start options mainly --proxy-headers xforwarded and --verbose

      Version

      26.2.1

      Regression

      [ ] The issue is a regression

      Expected behavior

      Pod starts with no errors.

      Actual behavior

      kubectl logs for my test pod contains this message:

      Changes detected in configuration. Updating the server image.
      Updating the configuration and installing your custom providers, if any. Please wait.
      2025-04-24 12:16:13,043 INFO  [io.quarkus.deployment.QuarkusAugmentor] (main) Quarkus augmentation completed in 5081ms
      Server configuration updated and persisted. Run the following command to review the configuration:
      
      

      kc.sh show-config

      Next time you run the server, just run:
      
      

      kc.sh start --proxy-headers=xforwarded --verbose --optimized

      2025-04-24 12:16:16,216 INFO  [com.arjuna.ats.jbossatx] (main) ARJUNA032014: Stopping transaction recovery manager
      ERROR: Failed to start server in (production) mode
      Error details:
      io.quarkus.runtime.configuration.ConfigurationException: Unable to find datasource '<default>' for persistence unit 'keycloak-default': Error creating synthetic bean [sqqLi56D50iCdXmOjyjPSAxbLu0]: java.lang.RuntimeException: Unable to instantiate javax.sql.XADataSource
      

      at io.quarkus.hibernate.orm.runtime.PersistenceUnitUtil.unableToFindDataSource(PersistenceUnitUtil.java:115)
      at io.quarkus.hibernate.orm.runtime.FastBootHibernatePersistenceProvider.injectDataSource(FastBootHibernatePersistenceProvider.java:392)
      at io.quarkus.hibernate.orm.runtime.FastBootHibernatePersistenceProvider.buildRuntimeSettings(FastBootHibernatePersistenceProvider.java:209)
      at io.quarkus.hibernate.orm.runtime.FastBootHibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(FastBootHibernatePersistenceProvider.java:180)
      at io.quarkus.hibernate.orm.runtime.FastBootHibernatePersistenceProvider.createEntityManagerFactory(FastBootHibernatePersistenceProvider.java:66)
      at jakarta.persistence.Persistence.createEntityManagerFactory(Persistence.java:80)
      at jakarta.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
      at io.quarkus.hibernate.orm.runtime.JPAConfig$LazyPersistenceUnit.get(JPAConfig.java:163)
      at io.quarkus.hibernate.orm.runtime.JPAConfig$1.run(JPAConfig.java:63)
      at java.base/java.lang.Thread.run(Thread.java:1583)

      Caused by: jakarta.enterprise.inject.CreationException: Error creating synthetic bean [sqqLi56D50iCdXmOjyjPSAxbLu0]: java.lang.RuntimeException: Unable to instantiate javax.sql.XADataSource
      

      at io.agroal.api.AgroalDataSource_sqqLi56D50iCdXmOjyjPSAxbLu0_Synthetic_Bean.doCreate(Unknown Source)
      at io.agroal.api.AgroalDataSource_sqqLi56D50iCdXmOjyjPSAxbLu0_Synthetic_Bean.create(Unknown Source)
      at io.agroal.api.AgroalDataSource_sqqLi56D50iCdXmOjyjPSAxbLu0_Synthetic_Bean.create(Unknown Source)
      at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:119)
      at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:38)
      at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
      at io.quarkus.arc.generator.Default_jakarta_enterprise_context_ApplicationScoped_ContextInstances.c17(Unknown Source)
      at io.quarkus.arc.generator.Default_jakarta_enterprise_context_ApplicationScoped_ContextInstances.computeIfAbsent(Unknown Source)
      at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:35)
      at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:23)
      at io.agroal.api.AgroalDataSource_sqqLi56D50iCdXmOjyjPSAxbLu0_Synthetic_ClientProxy.arc$delegate(Unknown Source)
      at io.agroal.api.AgroalDataSource_sqqLi56D50iCdXmOjyjPSAxbLu0_Synthetic_ClientProxy.arc_contextualInstance(Unknown Source)
      at io.quarkus.arc.ClientProxy.unwrap(ClientProxy.java:52)
      at io.quarkus.hibernate.orm.runtime.FastBootHibernatePersistenceProvider.injectDataSource(FastBootHibernatePersistenceProvider.java:390)
      ... 8 more

      Caused by: java.lang.RuntimeException: Unable to instantiate javax.sql.XADataSource
      

      at io.agroal.pool.ConnectionFactory.newXADataSource(ConnectionFactory.java:84)
      at io.agroal.pool.ConnectionFactory.<init>(ConnectionFactory.java:60)
      at io.agroal.pool.ConnectionPool.<init>(ConnectionPool.java:112)
      at io.agroal.pool.DataSource.<init>(DataSource.java:37)
      at io.quarkus.agroal.runtime.DataSources.createDataSource(DataSources.java:212)
      at io.quarkus.agroal.runtime.AgroalRecorder$3.apply(AgroalRecorder.java:65)
      at io.quarkus.agroal.runtime.AgroalRecorder$3.apply(AgroalRecorder.java:60)
      at io.agroal.api.AgroalDataSource_sqqLi56D50iCdXmOjyjPSAxbLu0_Synthetic_Bean.createSynthetic(Unknown Source)
      ... 22 more

      Caused by: java.lang.NoSuchMethodException: oracle.jdbc.datasource.OracleXADataSource.<init>()
      

      at java.base/java.lang.Class.getConstructor0(Class.java:3761)
      at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2930)
      at io.agroal.pool.ConnectionFactory.newXADataSource(ConnectionFactory.java:82)
      ... 29 more

      
      

      How to Reproduce?

      1. Build a minimal image containing oracle drivers as described in keycloak documentation.
      2. Start it against an existing keycloak Oracle db with XA transactions disabled, and in verbose mode.
      3. Startup should go ok, unless one or more grants are missing in Oracle (to allow schema update)
      4. Stop keycloak statefulset. (Or similar in docker/podman)
      5. Update configuration to enable XA transactions
      6. Start image again. Observe keycloak logs.

      I am testing against an AWS RDS (Oracle 19c). Oracle 19c as far as I know is the latest currently supported LTS version on AWS RDS.

      Anything else?

      I am using oracle driver jars from maven using maven-dependency-plugin and kubernetes-maven-plugin for the build. The oracle17.jar file I include in the image do contain the OracleXADatasource as expected and the jars are installed in /opt/keycloak/providers with the right user, mode and filenames according to documentation.
      The log messages do indicate that either the driver suddenly isn't in the classpath any longer (Classloader problems but only in XA mode? or that the default constructor is missing for OracleXADatasource either due to problems with the driver or possibly with the Quarkus optimizer.

              Unassigned Unassigned
              pvlha Pavel Vlha
              Keycloak Cloud Native
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: