DB key was too long (over 3072 bytes) [MariaDB]

361 views
Skip to first unread message

Federica Saccà

unread,
Oct 16, 2019, 6:09:45 AM10/16/19
to HAPI FHIR
Hi James,
after last release update I erased the fhir database and start jpa server starter project but I recieved an error in the eclipse console about the length of key. In details, the error is:

2019-10-16 11:52:06.881 [localhost-startStop-1] WARN  o.h.t.s.i.ExceptionHandlerLoggedImpl [ExceptionHandlerLoggedImpl.java:27] GenerationTarget encountered exception accepting command : Error executing DDL "create index IDX_VALUESET_C_DSGNTN_VAL on TRM_VALUESET_C_DESIGNATION (VAL)" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create index IDX_VALUESET_C_DSGNTN_VAL on TRM_VALUESET_C_DESIGNATION (VAL)" via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:559)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:504)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applyIndexes(AbstractSchemaMigrator.java:331)
at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:84)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:207)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:114)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:184)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:73)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:315)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:462)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:935)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:141)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:400)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4754)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5216)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLSyntaxErrorException: (conn=10) Specified key was too long; max key length is 3072 bytes
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:236)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:165)
at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:238)
at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:356)
at org.mariadb.jdbc.MariaDbStatement.execute(MariaDbStatement.java:407)
at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:291)
at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:291)
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
... 39 common frames omitted
Caused by: java.sql.SQLException: Specified key was too long; max key length is 3072 bytes
Query is: create index IDX_VALUESET_C_DSGNTN_VAL on TRM_VALUESET_C_DESIGNATION (VAL)
java thread: localhost-startStop-1
at org.mariadb.jdbc.internal.util.LogQueryTool.exceptionWithQuery(LogQueryTool.java:126)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:222)
at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:350)
... 43 common frames omitted

I'd like you to note that I just read the old post at this link:

Although I've applied that suggested solutions the problem persists. 
Do you have any idea about this?

p.s. as I wrote in the object I've used MariaDB with this connection url: jdbc:mysql://localhost:3307/myDB?useUnicode=true&connectionCollation=utf8_general_ci&characterSetResults=utf8&characterEncoding=utf8&autoReconnect=true&useSSL=false&createDatabaseIfNotExist=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC

James Agnew

unread,
Oct 16, 2019, 9:19:06 AM10/16/19
to Federica Saccà, HAPI FHIR
Hi Federica,

This is an issue in HAPI FHIR 4.0.0 that has been fixed in current snapshot builds of HAPI FHIR 4.1.0. 

If you're using the hapi-fhir-jpaserver-starter project, can you try with the following branch: rel_4_1_0 - https://github.com/hapifhir/hapi-fhir-jpaserver-starter/tree/rel_4_1_0

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/5ad9d8e9-2f07-4689-a385-c0c5690fcf3a%40googlegroups.com.

itom...@gmail.com

unread,
Nov 14, 2019, 5:56:20 AM11/14/19
to HAPI FHIR
Hi James, I've just installed version 4.0.1 of starter server from GIT and still getting the same error.

In the pom:
    <parent>
        <groupId>ca.uhn.hapi.fhir</groupId>
        <artifactId>hapi-fhir</artifactId>
        <version>4.1.0</version>
    </parent>

I've not found the branch that you have indicated in your answer (tree/rel_4_1_0).

Ciao
Ivano

James Agnew

unread,
Nov 14, 2019, 7:55:13 AM11/14/19
to itom...@gmail.com, HAPI FHIR
Hapi fhir 4.1.0 was released yesterday, so that branch has now been merged into master.

sent from my phone.

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.

ry...@jembi.org

unread,
Jan 17, 2020, 8:12:14 AM1/17/20
to HAPI FHIR
Hi,

I'm using version 4.1 (and I tried latest) of the starter project as built by Docker hub and I am see the exact same issue. Is this fixed?

Here is the docker compose config I'm using with the relevant changes in hapi.properties:

  fhir:
    container_name: hapi-fhir
    image: hapiproject/hapi:latest
    ports:
      - "3447:8080"
    environment:
      - JAVA_OPTS='-Dhapi.properties=/usr/local/tomcat/conf/hapi.properties'
    volumes:
      - ./hapi.properties:/usr/local/tomcat/conf/hapi.properties
    depends_on:
      - mysql

  mysql:
    image: mysql:5.7
    container_name: hapi-mysql
    command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
    environment:
      MYSQL_DATABASE: 'hapi'
      MYSQL_USER: 'admin'
      MYSQL_PASSWORD: 'admin'
      MYSQL_ROOT_PASSWORD: 'admin'

Cheers,
Ryan
To unsubscribe from this group and stop receiving emails from it, send an email to hapi...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages