[keycloak-user] Error Being Thrown with MySql

Vlasta Ramik vramik at redhat.com
Tue Nov 6 18:41:54 EST 2018


The issue might be in driver definition. Can you check that, please? See 
inline.

On 11/7/18 12:38 AM, Nathan McBride wrote:
>
> Yes there is. Here is the parts of my configuration that pertain to mysql.
>
> I’m not worried about the passwords on here as it’s a lab box and will 
> be changed anyway.
>
> <subsystem xmlns="urn:jboss:domain:datasources:5.0">
>
>             <datasources>
>
>                 <datasource 
> jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" 
> enabled="true" use-java-context="true">
>
> <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">
>
> <connection-url>jdbc:mysql://localhost:3306/keycloak?useSSL=false&amp;amp;useLegacyDatetimeCode=false&amp;amp;serverTimezone=Europe/Amsterdam&amp;amp;characterEncoding=UTF-8</connection-url>
>
> <driver>org.mysql</driver>
>
driver should be "mysql", not "org.mysql", it refers to driver name 
attribute below
>
>                     <security>
>
> <user-name>keycloak</user-name>
>
> <password>38Je*T/kGk]hVEU;86D6{BPUx</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.MySQLValidConnectionChecker"/>
>
>                     </validation>
>
>                 </datasource>
>
>                 <drivers>
>
>                     <driver name="h2" module="com.h2database.h2">
>
> <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
>
>                     </driver>
>
>                     <driver name="mysql" module="org.mysql">
>
> <driver-class>com.mysql.jdbc.Driver</driver-class>
>
>                     </driver>
>
>                 </drivers>
>
>             </datasources>
>
>         </subsystem>
>
> Thank you.
>
> Nate
>
> *From: *Vlasta Ramik <vramik at redhat.com>
> *Date: *Tuesday, November 6, 2018 at 6:02 PM
> *To: *Nathan McBride <nomb85 at gmail.com>
> *Cc: *<keycloak-user at lists.jboss.org>
> *Subject: *Re: [keycloak-user] Error Being Thrown with MySql
>
> Hello,
>
> Can you check $JBOSS_HOME/standalone/configuration/standalone.xml if 
> there is something like this
>
> <datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
>
> within datasources subsystem?
>
> On 11/6/18 9:31 PM, Nathan McBride wrote:
>
>     Hello everyone,
>
>       
>
>     Thank you for taking the time to read this and trying to help me. I’m new to KeyCloak as well as JBOSS.
>
>       
>
>     I created an AWS Lightsail account, the $5 / month plan, and am trying to use it for a KeyCloak server. I chose CentOS 7 as the operating system.
>
>       
>
>     I have been following the guide located here:http://www.pimwiddershoven.nl/entry/install-keycloak-on-centos-7-with-mysql-backend
>
>       
>
>     I have followed all the steps and am at the point where KeyCloak is supposed to be started. But when I start it, it errors and it looks like it is a problem with the mysql connection. However, I have tested the credentials both locally and connecting remote with DataGrip and I’m not really sure what I did wrong.
>
>       
>
>     Any help is greatly appreciated.
>
>     Thank you,
>
>     Nate
>
>       
>
>     Here are the errors:
>
>       
>
>     20:26:28,925 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 56) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./auth: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./auth: java.lang.RuntimeException: RESTEASY003325: Failed to construct public org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)
>
>                      at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81)
>
>                      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>
>                      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>
>                      at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
>
>                      at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
>
>                      at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
>
>                      at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
>
>                      at java.lang.Thread.run(Thread.java:748)
>
>                      at org.jboss.threads.JBossThread.run(JBossThread.java:485)
>
>     Caused by: java.lang.RuntimeException: RESTEASY003325: Failed to construct public org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)
>
>                      at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:162)
>
>                      at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2676)
>
>                      at org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:361)
>
>                      at org.jboss.resteasy.spi.ResteasyDeployment.startInternal(ResteasyDeployment.java:274)
>
>                      at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:86)
>
>                      at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:119)
>
>                      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
>
>                      at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
>
>                      at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
>
>                      at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
>
>                      at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:300)
>
>                      at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:140)
>
>                      at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:584)
>
>                      at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:555)
>
>                      at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
>
>                      at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
>
>                      at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
>
>                      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1514)
>
>                      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1514)
>
>                      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1514)
>
>                      at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1514)
>
>                      at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:597)
>
>                      at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:97)
>
>                      at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78)
>
>                      ... 8 more
>
>     Caused by: java.lang.RuntimeException: Failed to connect to database
>
>                      at org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.getConnection(DefaultJpaConnectionProviderFactory.java:373)
>
>                      at org.keycloak.connections.jpa.updater.liquibase.lock.LiquibaseDBLockProvider.lazyInit(LiquibaseDBLockProvider.java:65)
>
>                      at org.keycloak.connections.jpa.updater.liquibase.lock.LiquibaseDBLockProvider.lambda$waitForLock$0(LiquibaseDBLockProvider.java:97)
>
>                      at org.keycloak.models.utils.KeycloakModelUtils.suspendJtaTransaction(KeycloakModelUtils.java:611)
>
>                      at org.keycloak.connections.jpa.updater.liquibase.lock.LiquibaseDBLockProvider.waitForLock(LiquibaseDBLockProvider.java:95)
>
>                      at org.keycloak.services.resources.KeycloakApplication$1.run(KeycloakApplication.java:143)
>
>                      at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:227)
>
>                      at org.keycloak.services.resources.KeycloakApplication.<init>(KeycloakApplication.java:136)
>
>                      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>
>                      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>
>                      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>
>                      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>
>                      at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:150)
>
>                      ... 31 more
>
>     Caused by: javax.naming.NameNotFoundException: datasources/KeycloakDS [Root exception is java.lang.IllegalStateException]
>
>                      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:153)
>
>                      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:83)
>
>                      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
>
>                      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
>
>                      at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:239)
>
>                      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:193)
>
>                      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:189)
>
>                      at javax.naming.InitialContext.lookup(InitialContext.java:417)
>
>                      at javax.naming.InitialContext.lookup(InitialContext.java:417)
>
>                      at org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.getConnection(DefaultJpaConnectionProviderFactory.java:366)
>
>                      ... 43 more
>
>     Caused by: java.lang.IllegalStateException
>
>                      at org.jboss.msc.value.InjectedValue.getValue(InjectedValue.java:50)
>
>                      at org.jboss.as.naming.service.BinderService.getValue(BinderService.java:148)
>
>                      at org.jboss.as.naming.service.BinderService.getValue(BinderService.java:46)
>
>                      at org.jboss.msc.service.ServiceControllerImpl.getValue(ServiceControllerImpl.java:1110)
>
>                      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:131)
>
>                      ... 52 more
>
>       
>
>     20:26:28,938 INFO  [org.jboss.as.server] (Thread-2) WFLYSRV0220: Server shutdown has been requested via an OS signal
>
>     20:26:28,953 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0019: Stopped Driver service with driver-name = mysql
>
>     20:26:28,991 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "keycloak-server.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./auth" => "java.lang.RuntimeException: RESTEASY003325: Failed to construct public org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)
>
>          Caused by: java.lang.RuntimeException: RESTEASY003325: Failed to construct public org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)
>
>          Caused by: java.lang.RuntimeException: Failed to connect to database
>
>          Caused by: javax.naming.NameNotFoundException: datasources/KeycloakDS [Root exception is java.lang.IllegalStateException]
>
>          Caused by: java.lang.IllegalStateException"}}
>
>     20:26:29,011 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0008: Undertow HTTPS listener https suspending
>
>     20:26:29,014 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0007: Undertow HTTPS listener https stopped, was bound to 0.0.0.0:8443
>
>     20:26:29,017 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0019: Host default-host stopping
>
>     20:26:29,021 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0010: Unbound data source [java:jboss/datasources/ExampleDS]
>
>     20:26:29,029 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 54) WFLYCLINF0003: Stopped realms cache from keycloak container
>
>     20:26:29,030 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 58) WFLYCLINF0003: Stopped offlineClientSessions cache from keycloak container
>
>     20:26:29,030 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 50) WFLYCLINF0003: Stopped users cache from keycloak container
>
>     20:26:29,031 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 57) WFLYCLINF0003: Stopped clientSessions cache from keycloak container
>
>     20:26:29,032 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 48) WFLYCLINF0003: Stopped authenticationSessions cache from keycloak container
>
>     20:26:29,032 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 46) WFLYCLINF0003: Stopped sessions cache from keycloak container
>
>     20:26:29,033 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 47) WFLYCLINF0003: Stopped authorization cache from keycloak container
>
>     20:26:29,034 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 51) WFLYCLINF0003: Stopped loginFailures cache from keycloak container
>
>     20:26:29,034 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 52) WFLYCLINF0003: Stopped actionTokens cache from keycloak container
>
>     20:26:29,035 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 55) WFLYCLINF0003: Stopped offlineSessions cache from keycloak container
>
>     20:26:29,038 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 55) WFLYCLINF0003: Stopped keys cache from keycloak container
>
>     20:26:29,062 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 59) WFLYCLINF0003: Stopped work cache from keycloak container
>
>     20:26:29,068 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0019: Stopped Driver service with driver-name = h2
>
>     20:26:29,088 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0008: Undertow HTTP listener default suspending
>
>     20:26:29,089 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 56) WFLYCLINF0003: Stopped client-mappings cache from ejb container
>
>     20:26:29,089 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0007: Undertow HTTP listener default stopped, was bound to 0.0.0.0:8080
>
>     20:26:29,091 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0004: Undertow 2.0.9.Final stopping
>
>     20:26:29,100 INFO  [org.jboss.as.clustering.infinispan] (MSC service thread 1-1) WFLYCLINF0003: Stopped authorizationRevisions cache from keycloak container
>
>     20:26:29,106 INFO  [org.jboss.as.clustering.infinispan] (MSC service thread 1-1) WFLYCLINF0003: Stopped realmRevisions cache from keycloak container
>
>     20:26:29,110 INFO  [org.jboss.as.clustering.infinispan] (MSC service thread 1-1) WFLYCLINF0003: Stopped userRevisions cache from keycloak container
>
>     20:26:29,111 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0028: Stopped deployment keycloak-server.war (runtime-name: keycloak-server.war) in 170ms
>
>     20:26:29,149 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 37) WFLYSRV0010: Deployed "keycloak-server.war" (runtime-name : "keycloak-server.war")
>
>     20:26:29,282 ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: java.lang.NullPointerException
>
>                      at org.jboss.as.controller.AbstractControllerService.finishBoot(AbstractControllerService.java:534)
>
>                      at org.jboss.as.server.ServerService.finishBoot(ServerService.java:418)
>
>                      at org.jboss.as.server.ServerService.boot(ServerService.java:388)
>
>                      at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:372)
>
>                      at java.lang.Thread.run(Thread.java:748)
>
>       
>
>     _______________________________________________
>
>     keycloak-user mailing list
>
>     keycloak-user at lists.jboss.org  <mailto:keycloak-user at lists.jboss.org>
>
>     https://lists.jboss.org/mailman/listinfo/keycloak-user
>


More information about the keycloak-user mailing list