MySQL and Keycloak setup

China☆狼群 提交于 2021-02-11 17:25:24

问题


Hello I am trying to add mysql database in my Keycloak server.

I've added module.xml and mysql-connector-java-5.1.42-bin.jar under /modules/system/layers/base/com/mysql/main.

When I am running the command to add mysql module, ./jboss-cli.sh, it errors out with

Exception in thread "CLI Terminal Connection (uninterruptable)" java.lang.ArithmeticException: / by zero

And when i am trying to start Keycloak, I am also notified that there is a missing service.

service jboss.jdbc-driver.mysql (missing)

Please help!!


回答1:


There is an error in the Keycloak documentation. Driver should be in the

modules/system/layers/base/com/mysql/driver/main

folder.

The full valid instruction is here

https://github.com/v-ladynev/keycloak-nodejs-example#keycloak-configuration

Also you can use docker images to experiment

https://github.com/v-ladynev/keycloak-nodejs-example#keycloak-docker-image




回答2:


When I am running the command to add mysql module, ./jboss-cli.sh, it errors out with

Can you post your Command? You dont't have to do this with the cli. It's also possible to modify the config in a editor. At least for testing you should try this.

Keycloak docs have a pretty good part about database setup: https://www.keycloak.org/docs/latest/server_installation/index.html#_database

The basic steps are:

  1. Locate and download a JDBC driver for your database
  2. Package the driver JAR into a module and install this module into the server (module.xml)
  3. Declare the JDBC driver in the configuration profile of the server (standalone.xml)
  4. Modify the datasource configuration to use your database’s JDBC driver
  5. Modify the datasource configuration to define the connection parameters to your database


来源:https://stackoverflow.com/questions/53587013/mysql-and-keycloak-setup

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!