hi marek,

i was trying to play around with "driverDialect" property but it does not work.

Anyway, i've just modified this file and it's working now. This error only happened during the first time startup of keycloak.

model/jpa/src/main/java/org/keycloak/models/jpa/session/JpaUserSessionPersisterProvider.java

+        
+        if(userSessionIds!=null && userSessionIds.size()==0)
+        	userSessionIds.add("");
 
         TypedQuery<PersistentClientSessionEntity> query2 = em.createNamedQuery("findClientSessionsByUserSessions", PersistentClientSessionEntity.class);
         query2.setParameter("userSessionIds", userSessionIds);

On Wed, Nov 4, 2015 at 3:30 PM, Marek Posolda <mposolda@redhat.com> wrote:
I didn't see the error, but we are not using InnoDB dialect during testing. Will it work if you remove "driverDialect" property?

Marek


On 04/11/15 05:24, Chen Keong Yap wrote:
Hi Guys,

Have you encountered this error before using mysql to store keycloak data?


- JDK 1.8

- mysql-connector-java-5.1.25.jar

- MYSQL  5.6.23-log

- Keycloak.json

"connectionsJpa": {
        "default": {
            "dataSource": "java:jboss/datasources/KeycloakDS",
            "databaseSchema": "update",
            "driverDialect" : "org.hibernate.dialect.MySQL5InnoDBDialect"
        }
    },

- logs

04:23:26,251 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (ServerService Thread Pool -- 56) SQL Error: 1064, SQLState: 42000
04:23:26,251 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (ServerService Thread Pool -- 56) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) order by persistent0_.USER_SESSION_ID' at line 1
04:23:26,267 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/auth]] (ServerService Thread Pool -- 56) JBWEB000289: Servlet Keycloak REST Interface threw load() exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) order by persistent0_.USER_SESSION_ID' at line 1
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.8.0_65]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [rt.jar:1.8.0_65]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.8.0_65]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422) [rt.jar:1.8.0_65]
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
        at com.mysql.jdbc.Util.getInstance(Util.java:386)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4187)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4119)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2815)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2322)
        at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.executeQuery(CachedPreparedStatement.java:107)
        at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
        at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:79) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.loader.Loader.getResultSet(Loader.java:2062) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1859) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1838) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.loader.Loader.doQuery(Loader.java:906) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:348) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.loader.Loader.doList(Loader.java:2550) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.loader.Loader.doList(Loader.java:2536) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2366) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.loader.Loader.list(Loader.java:2361) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:495) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:357) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:198) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1230) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
        at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:268) [hibernate-entitymanager-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]



_______________________________________________
keycloak-user mailing list
keycloak-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user