我正在尝试将 postgres 与 keycloak 一起使用。下列的Doc https://www.keycloak.org/docs/latest/server_installation/#_database
$ ls keycloak-9.0.0/modules/system/layers/keycloak/org/postgresql/main
config.xml postgresql-42.2.10.jar
这是 config.xml 文件。配置文件
<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.3" name="org.postgresql">
<resources>
<resource-root path="postgresql-42.2.10.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
这些是我在standalone.xml中所做的更改独立.xml
<datasources>
<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
<connection-url>jdbc:postgresql://localhost:5432/test</connection-url>
<driver>postgresql</driver>
<pool>
<max-pool-size>20</max-pool-size>
</pool>
<security>
<user-name>postgres</user-name>
<password>StrongPassword</password>
</security>
</datasource>
<drivers>
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
<default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/KeycloakDS">
我收到的错误。error
06:13:39,430 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 32) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "postgresql")
]) - failure description: "WFLYJCA0115: Module for driver [org.postgresql] or one of it dependencies is missing: [org.postgresql]"
我该如何解决这个问题?
我可以建议另一种不太可能出现问题的配置方法吗?我使用以下命令来配置 PostgreSQL 和 Keycloak,并且运行良好。关键是针对已停止的 Keycloak 运行此命令(使用全新安装)。将下面的内容保存为类似的内容setup-keycloak.cli
:
embed-server --server-config=standalone.xml --std-out=echo
batch
#
# remove the default provided datasource
#
/subsystem=datasources/data-source=KeycloakDS/:remove
#
# add them
#
module add --name=org.postgres --resources=/path/to/postgresql-42.2.10.jar --dependencies=javax.api,javax.transaction.api
/subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgres",driver-class-name=org.postgresql.Driver)
/subsystem=datasources/data-source=KeycloakDS/:add(connection-url=jdbc:postgresql://localhost:5432/keycloak_database,driver-name=postgres,jndi-name=java:jboss/datasources/KeycloakDS,initial-pool-size=4,max-pool-size=64,min-pool-size=4,password=keycloak_user,user-name=keycloak_pass)
run-batch
然后运行这个$KEYCLOAK_HOME/bin/jboss.sh --file=setup-keycloak.cli
。这将删除 KeycloakDS 数据源,添加 PostgreSQL 模块,并使用您的参数重新创建 KeycloakDS 数据源。只要您有 PostgreSQL JDBC 驱动程序的本地副本,您就可以随时使用它来重现配置。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)