[keycloak-user] Error with Postgres datasource

sesnor.silva at sapo.pt sesnor.silva at sapo.pt
Tue May 9 11:35:29 EDT 2017


Hello,

Thank you for your reply,

Sadly it doesn't seem to budge. Even by copy-pasting your exact  
configuration (changing the username/password for postgres of course).

What I find especially strange is the following part of the error:  
"Caused by: javax.naming.NameNotFoundException: datasources/KeycloakDS  
[Root exception is java.lang.IllegalStateException]"

Also, I'm running on Windows 8.1 64-bit currently.

What else could I try?

My best regards,
Silva
 

Citando Bruno Oliveira <bruno at abstractj.org>:

> I just ran the entire DB setup from scratch with KC 3.1.0 and got
> postgresql working with no issues.
>
> Looking at your config, you do not specify PostgreSQL TCP port, plus
> make sure you have the proper permissions into pg_hba.conf and of
> course, the database.
> I'm sending gist[1] with my configuration, to get you started. I hope it
> helps.
>
> [1] - https://gist.github.com/abstractj/a154e452ed63c9ccab9578a713955670
>
> On 2017-05-08, sesnor.silva at sapo.pt wrote:
>> Hello,
>>
>> I'm trying to configure Keycloak 3.1 to use Postgres 9.4 using the
>> documentation provided here:
>> https://keycloak.gitbooks.io/documentation/server_installation/topics/database.html
>>
>> However, running in standalone operation mode, I get the following error:
>>   2017-05-08 17:47:49,096 ERROR [org.jboss.msc.service.fail]
>> (ServerService Thread Pool -- 48) 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:85)
>>     at  
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>>     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>     at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>     at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>     at java.lang.Thread.run(Thread.java:745)
>>     at org.jboss.threads.JBossThread.run(JBossThread.java:320)
>> 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:2209)
>>     at
>> org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:299)
>>     at
>> org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:240)
>>     at
>> org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:113)
>>     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:231)
>>     at
>> io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:132)
>>     at
>> io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:526)
>>     at
>> org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)
>>     at
>> org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
>>     ... 6 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:543)
>>     at
>> org.keycloak.connections.jpa.updater.liquibase.lock.LiquibaseDBLockProvider.waitForLock(LiquibaseDBLockProvider.java:95)
>>     at
>> org.keycloak.services.resources.KeycloakApplication$1.run(KeycloakApplication.java:136)
>>     at
>> org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:227)
>>     at
>> org.keycloak.services.resources.KeycloakApplication.<init>(KeycloakApplication.java:129)
>>     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)
>>     ... 19 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:237)
>>     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)
>>     ... 31 more
>> Caused by: java.lang.IllegalStateException
>>     at org.jboss.msc.value.InjectedValue.getValue(InjectedValue.java:47)
>>     at
>> org.jboss.as.naming.service.BinderService.getValue(BinderService.java:138)
>>     at
>> org.jboss.as.naming.service.BinderService.getValue(BinderService.java:46)
>>     at
>> org.jboss.msc.service.ServiceControllerImpl.getValue(ServiceControllerImpl.java:1158)
>>     at
>> org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:131)
>>     ... 40 more
>>
>> And I'm at a stalemate with the configuration, because I have no idea
>> what I'm doing wrong.
>>
>> I've configured the postgres driver module in
>> keycloak-3.1.0.Final\modules\system\layers\keycloak\org\postgres\main
>> as (postgresql-9.4.1210.jar is present as well):
>> https://pastebin.com/pjwn09gX
>>
>> My standalone.xml is as follows:
>> https://pastebin.com/ggDHZFJx
>>
>> Does anyone have any idea what I could be doing wrong? Did I miss
>> anything on my configuration?
>>
>> Thank you very much for your time,
>>
>> My best regards,
>> Silva
>>
>>  
>> _______________________________________________
>> keycloak-user mailing list
>> keycloak-user at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
> --
> abstractj

 


More information about the keycloak-user mailing list