J’ai du mal à comprendre pourquoi mon installation Keycloak ne fonctionne pas avec MySQL lors de l’utilisation de l’utilisateur Keycloak, mais cela fonctionne lorsque je le démarre manuellement avec sudo. Veuillez consulter les détails ci-dessous. Je serais très reconnaissant si quelqu’un avait des conseils.

Groupe et utilisateurs créés avec celui-ci lors de l’installation de Keycloak:

sudo groupadd -r keycloak
sudo useradd -m -d /var/lib/keycloak -s /sbin/nologin -r -g keycloak keycloak

Ensuite, la propriété du dossier Keycloak a été modifiée et le service a été activé:

sudo chown keycloak: -R /opt/keycloak

Ensuite, MySQL a été installé, la base de données créée et quand j’utilise

cd /opt/keycloak/current/bin
sudo ./standalone.sh -b 0.0.0.0

Le serveur démarre sans aucun problème et je peux me connecter à la console d’administration.

Mais quand j’utilise:

sudo systemctl start keycloak

J’obtiens cette erreur. Je pense que c’est une question de permission pour l’utilisateur Keycloak:

WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (Timer-2) IJ000621: Destroying connection that could not be validated: org[email protected]7fe854b0[state=NORMAL managed conn[email protected]38cec5e6 connection handles=0 lastReturned=1616418652723 lastValidated=1616413701246 lastCheckedOut=1616418652707 trackByTx=false [email protected]3862b427 [email protected][pool=KeycloakDS] [email protected][connectionListener=7fe854b0 connectionManager=6fc765a0 warned=false currentXid=null productName=MySQL productVersion=8.0.23-0ubuntu0.20.04.1 jndiName=java:jboss/datasources/KeycloakDS] txSync=null] 
2021-03-22 13:21:50,382 INFO [org.jboss.as.ejb3] (Thread-2) WFLYEJB0493: EJB subsystem suspension complete 
2021-03-22 13:21:51,013 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (Timer-2) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: IJ031084: Unable to create connection at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:345) 
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:352) 
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:287) 
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.createConnectionEventListener(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1322) 
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.getConnection(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:499) 
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getTransactionNewConnection(AbstractPool.java:714) 
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:613) 
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:624) 
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:440) 
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:789) 
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:151) at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:64) 
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) 
at org.hibernate.internal.NonContextualJdbcConnectionAccess.obtainConnection(NonContextualJdbcConnectionAccess.java:35) 
at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:106) 
at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:136) 
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:50) 
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:149) 
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:176) 
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:151) 
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:2082) 
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:2012) 
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1990) 
at org.hibernate.loader.Loader.scroll(Loader.java:2863) 
at org.hibernate.loader.hql.QueryLoader.scroll(QueryLoader.java:574) 
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.scroll(QueryTranslatorImpl.java:447) 
at org.hibernate.engine.query.spi.HQLQueryPlan.performScroll(HQLQueryPlan.java:354)
at org.hibernate.internal.SessionImpl.scroll(SessionImpl.java:1658) 
at org.hibernate.query.internal.AbstractProducedQuery.doScroll(AbstractProducedQuery.java:1537) 
at org.hibernate.query.internal.AbstractProducedQuery.scroll(AbstractProducedQuery.java:1523) 
at org.hibernate.query.internal.AbstractProducedQuery.stream(AbstractProducedQuery.java:1547) 
at org.hibernate.query.Query.getResultStream(Query.java:1107) 
at org.keycloak.models.jpa.JpaRealmProvider.getRealms(JpaRealmProvider.java:130) 
at org.keycloak.models.jpa.JpaRealmProvider.getRealmsStream(JpaRealmProvider.java:126) 
at org.keycloak.models.cache.infinispan.RealmCacheSession.getRealmsStream(RealmCacheSession.java:478) 
at org.keycloak.services.scheduled.ClearExpiredEvents.run(ClearExpiredEvents.java:33) 
at org.keycloak.services.scheduled.ClusterAwareScheduledTaskRunner$1.call(ClusterAwareScheduledTaskRunner.java:56) 
at org.keycloak.services.scheduled.ClusterAwareScheduledTaskRunner$1.call(ClusterAwareScheduledTaskRunner.java:52) 
at org.keycloak.cluster.infinispan.InfinispanClusterProvider.executeIfNotExecuted(InfinispanClusterProvider.java:78) 
at org.keycloak.services.scheduled.ClusterAwareScheduledTaskRunner.runTask(ClusterAwareScheduledTaskRunner.java:52) 
at org.keycloak.services.scheduled.ScheduledTaskRunner.run(ScheduledTaskRunner.java:45) 
at org.keycloak.timer.basic.BasicTimerProvider$1.run(BasicTimerProvider.java:51) 
at java.util.TimerThread.mainLoop(Timer.java:555) 
at java.util.TimerThread.run(Timer.java:505) 
Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure



Source link

Recent Posts