Correct, still see the error when starting Keycloak 1.9.0 with empty MySQL DB.
I’m confounded as Keycloak 1.5.x, 1.6.x, 1.7x. and 1.8.0 all work just fine with the same
MySQL instance, only 1.8.1 and 1.9.0 have the issue. And I’m using the same version of
the MySql JDBC driver in all cases (5.1.33).
Will report back if I find anything.
Thanks,
Darcy
On Mar 2, 2016, at 6:00 AM, Stian Thorgersen
<sthorger(a)redhat.com> wrote:
Maybe it's down to MySQL config? For example storage engine.
On 2 March 2016 at 08:11, Marek Posolda <mposolda(a)redhat.com
<mailto:mposolda@redhat.com>> wrote:
On 01/03/16 17:32, Darcy Welsh wrote:
> Hi Marek,
>
> Thank-you for the response and suggestions, much appreciated. Unfortunately, I tried
all of them (clean db, datasource settings and JDBC driver 5.1.29) and still see the
issue.
ah, so just to clearify. Even if you start Keycloak 1.9.0 with empty MySQL DB, the
startup will fail with this error?
>
> It’s very strange indeed - I have no issue with Keycloak 1.5.x, 1.6.x, 1,7.x, 1.8.0 -
I suspect it may have something to do with the change to Wildfly 10 starting in Keycloak
1.8.1.
>
> I am using JRE 1.8.0_25, not sure if that is relevant.
Guess wildfly version or JDK version is not too relevant here. Hard to say without being
able to reproduce.
Marek
>
>
> Darcy
>
>
>
>
>
>> On Mar 1, 2016, at 8:17 AM, Marek Posolda <
<mailto:mposolda@redhat.com>mposolda@redhat.com
<mailto:mposolda@redhat.com>> wrote:
>>
>> Thanks. Strange as I couldn't see it.
>>
>> Few questions:
>>
>> - Do you see it during startup of 1.9.0 against clean DB too? Or just during
migration from 1.8.0 ?
>>
>> - Could you try with datasource settings like this? [1]
>>
>> - Could you try with JDBC driver 5.1.29 ?
>>
>> [1]
>>
>> <datasource
>>
jndi-name="java:jboss/datasources/KeycloakDS"
>> pool-name="KeycloakDS"
>> enabled="true"
>> use-java-context="true">
>>
<connection-url>jdbc:mysql://localhost/keycloak</connection-url>
>> <driver>mysql</driver>
>> <security>
>> <user-name>keycloak</user-name>
>> <password>keycloak</password>
>> </security>
>> </datasource>
>> <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">
>>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
>> </driver>
>> </drivers>
>> </datasources>
>>
>>
>> Marek
>>
>> On 29/02/16 14:57, Darcy Welsh wrote:
>>> Hey Marek,
>>>
>>> I am using MySQL 5.6.23 with JDBC driver version 5.1.33.
>>>
>>> Darcy
>>>
>>>
>>>> On Feb 29, 2016, at 2:16 AM, Marek Posolda <mposolda(a)redhat.com
<mailto:mposolda@redhat.com>> wrote:
>>>>
>>>> Which JDBC driver and DB version are you using? Just found this thread
during googling:
<
http://liquibase-user.narkive.com/njIDqyEC/incorrect-database-name-on-gen...
<
http://liquibase-user.narkive.com/njIDqyEC/incorrect-database-name-on-gen...
. Wonder if it can be related to your issue...
>>>>
>>>> I am testing MySQL with JDBC driver version 5.1.29 and never saw the
issue like this.
>>>>
>>>> Marek
>>>>
>>>> On 28/02/16 06:00, Darcy Welsh wrote:
>>>>> Hi,
>>>>>
>>>>> I successfully upgraded from 1.7.0 to 1.8.0, however, seeing the
following error when attempting to upgrade from 1.8.0 to either 1.8.1 or 1.9.0:
>>>>>
>>>>> 22:45:48,803 ERROR
[org.keycloak.services.resources.KeycloakApplication] (ServerService Thread Pool -- 51)
Failed to migrate datamodel: java.lang.RuntimeException: Failed to update database
>>>>> at
org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider.update(LiquibaseJpaUpdaterProvider.java:87)
>>>>> at
org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.lazyInit(DefaultJpaConnectionProviderFactory.java:153)
>>>>> at
org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.create(DefaultJpaConnectionProviderFactory.java:42)
>>>>> at
org.keycloak.connections.jpa.DefaultJpaConnectionProviderFactory.create(DefaultJpaConnectionProviderFactory.java:30)
>>>>> at
org.keycloak.services.DefaultKeycloakSession.getProvider(DefaultKeycloakSession.java:103)
>>>>> at
org.keycloak.models.jpa.JpaRealmProviderFactory.create(JpaRealmProviderFactory.java:34)
>>>>> at
org.keycloak.models.jpa.JpaRealmProviderFactory.create(JpaRealmProviderFactory.java:16)
>>>>> at
org.keycloak.services.DefaultKeycloakSession.getProvider(DefaultKeycloakSession.java:103)
>>>>> at
org.keycloak.models.cache.infinispan.DefaultCacheRealmProvider.getDelegate(DefaultCacheRealmProvider.java:61)
>>>>> at
org.keycloak.models.cache.infinispan.DefaultCacheRealmProvider.getMigrationModel(DefaultCacheRealmProvider.java:43)
>>>>> at
org.keycloak.migration.MigrationModelManager.migrate(MigrationModelManager.java:21)
>>>>> at
org.keycloak.services.resources.KeycloakApplication.migrateModel(KeycloakApplication.java:139)
>>>>> at
org.keycloak.services.resources.KeycloakApplication.<init>(KeycloakApplication.java:82)
>>>>> 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:408)
>>>>> at
org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:150)
>>>>> 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)
>>>>> 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: liquibase.exception.DatabaseException: Incorrect database
name '' [Failed SQL: CREATE TABLE ``.DATABASECHANGELOG (ID VARCHAR(255) NOT NULL,
AUTHOR VARCHAR(255) NOT NULL, FILENAME VARCHAR(255) NOT NULL, DATEEXECUTED datetime NOT
NULL, ORDEREXECUTED INT NOT NULL, EXECTYPE VARCHAR(10) NOT NULL, MD5SUM VARCHAR(35) NULL,
DESCRIPTION VARCHAR(255) NULL, COMMENTS VARCHAR(255) NULL, TAG VARCHAR(255) NULL,
LIQUIBASE VARCHAR(20) NULL, CONTEXTS VARCHAR(255) NULL, LABELS VARCHAR(255) NULL)]
>>>>> at
liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)
>>>>> at
liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
>>>>> at
liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122)
>>>>> at
liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:112)
>>>>> at
liquibase.changelog.StandardChangeLogHistoryService.init(StandardChangeLogHistoryService.java:214)
>>>>> at liquibase.Liquibase.checkLiquibaseTables(Liquibase.java:1074)
>>>>> at liquibase.Liquibase.listUnrunChangeSets(Liquibase.java:1136)
>>>>> at liquibase.Liquibase.listUnrunChangeSets(Liquibase.java:1126)
>>>>> at liquibase.Liquibase.listUnrunChangeSets(Liquibase.java:1122)
>>>>> at
org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider.update(LiquibaseJpaUpdaterProvider.java:63)
>>>>> ... 36 more
>>>>> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
Incorrect database name ''
>>>>> 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:408)
>>>>> at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
>>>>> at com.mysql.jdbc.Util.getInstance(Util.java:360)
>>>>> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:978)
>>>>> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887)
>>>>> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
>>>>> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
>>>>> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
>>>>> at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2526)
>>>>> at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2484)
>>>>> at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:848)
>>>>> at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:742)
>>>>> at
org.jboss.jca.adapters.jdbc.WrappedStatement.execute(WrappedStatement.java:198)
>>>>> at
liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314)
>>>>> ... 45 more
>>>>>
>>>>> Any ideas as to the potential cause/resolution?
>>>>>
>>>>> The MySQL datasource is configured as follows:
>>>>>
>>>>> <datasource jta="true"
jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS"
enabled="true" use-java-context="true">
>>>>>
<connection-url>jdbc:mysql://localhost:3306/keycloak</connection-url>
>>>>> <connection-property
name="defaultFetchSize">
>>>>> 1000
>>>>> </connection-property>
>>>>> <driver>mysql</driver>
>>>>> <pool>
>>>>>
<max-pool-size>20</max-pool-size>
>>>>> </pool>
>>>>> <security>
>>>>> <user-name>keycloak</user-name>
>>>>>
<password>keycloakrocks!</password>
>>>>> </security>
>>>>> <timeout>
>>>>>
<set-tx-query-timeout>true</set-tx-query-timeout>
>>>>> </timeout>
>>>>> <statement>
>>>>>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
>>>>>
<share-prepared-statements>true</share-prepared-statements>
>>>>> </statement>
>>>>> </datasource>
>>>>> <drivers>
>>>>> <driver name="mysql"
module="com.mysql.jdbc">
>>>>>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
>>>>>
<datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlDataSource</datasource-class>
>>>>> </driver>
>>>>> .
>>>>> .
>>>>> .
>>>>> </drivers>
>>>>>
>>>>>
>>>>>
>>>>> Any help would be much appreciated.
>>>>>
>>>>> Thank-you in advance,
>>>>> Darcy Welsh
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> keycloak-user mailing list
>>>>> keycloak-user(a)lists.jboss.org
<mailto:keycloak-user@lists.jboss.org>
>>>>>
https://lists.jboss.org/mailman/listinfo/keycloak-user
<
https://lists.jboss.org/mailman/listinfo/keycloak-user>
>>>
>>
>
_______________________________________________
keycloak-user mailing list
keycloak-user(a)lists.jboss.org <mailto:keycloak-user@lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/keycloak-user
<
https://lists.jboss.org/mailman/listinfo/keycloak-user>