Multiple datasources

Hi.

I am trying to use 2 datasources in my standalone keycloak:
             <datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
                <connection-url>jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE</connection-url>
                <driver>h2</driver>
                <security>
                    <user-name>sa</user-name>
                    <password>sa</password>
                </security>
            </datasource>
            <datasource jndi-name="java:jboss/datasources/mykeycloakds" pool-name="mykeycloakds" enabled="true" use-java-context="true">
                <connection-url>jdbc:mysql://localhost:3306/keycloak?useSSL=false&amp;characterEncoding=UTF-8</connection-url>
                <driver>mysql</driver>
                <pool>
                    <min-pool-size>5</min-pool-size>
                    <max-pool-size>15</max-pool-size>
                </pool>
                <security>
                    <user-name>keycloak</user-name>
                    <password>keycloak</password>
                </security>
                <validation>
                    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
                    <validate-on-match>true</validate-on-match>
                    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
                </validation>
            </datasource>

I am successfully add my Custom User Storage Provider to my realm but when I am trying to see users (from my custom storage) I am getting this message:

19:30:21,706 WARN [com.arjuna.ats.arjuna] (default task-1) ARJUNA012141: Multiple last resources have been added to the current transaction. This is transactionally unsafe and should not be relied upon. Current resource is LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl@c4d7468[connectionListener=762fd68a connectionManager=1b6a9d92 warned=false currentXid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff0a040186:-73f92045:5dcd8ce7:22f, node_name=1, branch_uid=0:ffff0a040186:-73f92045:5dcd8ce7:234, subordinatenodename=null, eis_name=java:jboss/datasources/KeycloakDS > productName=H2 productVersion=1.4.193 (2016-10-31) jndiName=java:jboss/datasources/KeycloakDS]))

and my custom User Storage Provider cannot execute the user search against MySQL DB.

Could you help me to solve the problem?

Thank you

1 Like