错误[org.jboss.as.controller.management operation]操作(“添加”)失败地址:([(“子系统”=>“度量”)):java.lang.nullpointerexception

vlf7wbxs  于 2021-08-20  发布在  Java
关注(0)|答案(0)|浏览(182)

我正在尝试使用mysql在本地pc上部署KeyClope
但是,当我尝试运行standalone.sh时,会出现以下错误:

这是我做的数据库配置

<spi name="connectionsJpa">
            <provider name="default" enabled="true">
                <properties>
                    <property name="dataSource" value="java:jboss/datasources/KeycloakDS"/>
                   <!-- <property name="initializeEmpty" value="true"/> -->
                   <!-- <property name="migrationStrategy" value="update"/> -->
                    <property name="initializeEmpty" value="false"/>
                    <property name="migrationStrategy" value="manual"/>
                   <property name="migrationExport" value="${jboss.home.dir}/keycloak- 
                database-update.sql"/>
                </properties>
            </provider>
        </spi>

KeyClope数据源更改:-

<datasources>
            <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" 
          enabled="true" use-java-context="true" statistics- 
       enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics- 
       enabled:false}}">
                <connection- 
      url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                <driver>h2</driver>
                <security>
                    <user-name>sa</user-name>
                    <password>sa</password>
                </security>
            </datasource>
             <!--- <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>  -->
            <!-- mysql -->
            <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:mysql://localhost:3306/keycloakdata? 
               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>user</user-name>
                  <password>user</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>

声明并加载jdbc驱动程序

<drivers>
                <driver name="h2" module="com.h2database.h2">
                    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                </driver>
                  <driver name="mysql" module="com.mysql">
              <driver-class>com.mysql.jdbc.Driver</driver-class>
          </driver> 
            </drivers>

我还将模块及其依赖项添加到jboss(jboss cli.sh)

module add --name=com.mysql --resources=/keycloak- 
13.0.1/modules/system/layers/keycloak/com/mysql/main/mysql-connector-java-8.0.23.jar -- 
dependencies=javax.api,javax.transaction.api

增加keyclaok服务器的超时时间

<local-cache name="actionTokens">
                <heap-memory size="-1"/>
                <expiration max-idle="-1" interval="900000"/>
              </local-cache>

        <session-bean>
            <stateless>
                <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
            </stateless>
            <stateful default-access-timeout="20000" cache-ref="simple" passivation-disabled- 
       cache-ref="simple"/>
            <singleton default-access-timeout="20000"/>
        </session-bean>

        <pools>
            <bean-instance-pools>
                <strict-max-pool name="mdb-strict-max-pool" derive-size="from-cpu-count" 
                instance-acquisition-timeout="20" instance-acquisition-timeout- 
                unit="MINUTES"/>
                <strict-max-pool name="slsb-strict-max-pool" derive-size="from-worker-pools" 
               instance-acquisition-timeout="20" instance-acquisition-timeout-unit="MINUTES"/>
            </bean-instance-pools>
        </pools>

我在尝试将mysql服务器连接到KeyClope时参考了以下文章,在《服务器安装和配置指南》中使用mysql数据库和关系数据库设置单独设置KeyClope
完整堆栈跟踪如下所示:


暂无答案!

目前还没有任何答案,快来回答吧!

相关问题