wix-incubator / wix-embedded-mysql

embedded mysql based on https://github.com/flapdoodle-oss/de.flapdoodle.embed.process
BSD 3-Clause "New" or "Revised" License
381 stars 82 forks source link

v5_7_latest command exited with code 127 #117

Closed annappropriate closed 6 years ago

annappropriate commented 6 years ago

Server does not start

java.lang.RuntimeException: Command exited with error code: '127' and output: ''
[info]   at com.wix.mysql.distribution.setup.ProcessRunner.resolveException(ProcessRunner.java:50)
[info]   at com.wix.mysql.distribution.setup.ProcessRunner.run(ProcessRunner.java:35)
[info]   at com.wix.mysql.distribution.setup.Mysql57Initializer.apply(Mysql57Initializer.java:35)
[info]   at com.wix.mysql.distribution.Setup.apply(Setup.java:26)
[info]   at com.wix.mysql.MysqldExecutable.start(MysqldExecutable.java:42)
[info]   at com.wix.mysql.MysqldExecutable.start(MysqldExecutable.java:21)
[info]   at de.flapdoodle.embed.process.runtime.Executable.start(Executable.java:101)
[info]   at com.wix.mysql.EmbeddedMysql.<init>(EmbeddedMysql.java:47)
[info]   at com.wix.mysql.EmbeddedMysql$Builder.start(EmbeddedMysql.java:155)
viliusl commented 6 years ago

Could you please provide me more details:

These might help. Because it's so generic that I don't know where to even start:/ Having this info I might be able to add additional ci configuration and see if I can reproduce.

Loucher commented 6 years ago

UPDATED see message at the bottom

I have same problem using this library in Spring Boot application v1.5.1.RELEASE

lib version mysql version error code
3.1.0 v5_7_19 127
3.1.0 v5_7_18 127
3.1.0 v5_6_latest 141
3.0.0 v5_7_19 127
2.2.10 v5_7_19 127

Output for 3.1.0 and v5_7_19 :

    Download Version 5.7.19:Linux:B64 DONE
    Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz START
    Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/bin/mysql
    Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/bin/mysqladmin
    Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/bin/my_print_defaults
    Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/bin/mysqld
    Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/bin/resolveip
    Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/share/english/errmsg.sys
    Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/share/fill_help_tables.sql
    Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/share/mysql_security_commands.sql
    Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/share/mysql_system_tables.sql
    Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/share/mysql_system_tables_data.sql
    Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz nothing left
    Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz DONE

    .
    .
    .

    2018-01-31 16:43:51.514 $ threadId: ERROR  namespace:com.example o.s.b.SpringApplication [ hostname: serviceName: version: transactionId: conversationId: requestTimeStamp:  responseTimeStamp: duration:] Application startup failed
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'appEntityManagerFactory' defined in class path resource [com/example/config/AppDatabaseConfig.class]: Unsatisfied dependency expressed through method 'appEntityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMysqlDb' defined in class path resource [com/example/config/EmbeddedMysqlConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wix.mysql.EmbeddedMysql]: Factory method 'embeddedMysql' threw exception; nested exception is java.lang.RuntimeException: Command exited with error code: '127' and output: ''
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:856)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
        at com.example.Application.main(Application.java:47)
    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMysqlDb' defined in class path resource [com/example/config/EmbeddedMysqlConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wix.mysql.EmbeddedMysql]: Factory method 'embeddedMysql' threw exception; nested exception is java.lang.RuntimeException: Command exited with error code: '127' and output: ''
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
        ... 19 common frames omitted
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMysqlDb' defined in class path resource [com/example/config/EmbeddedMysqlConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wix.mysql.EmbeddedMysql]: Factory method 'embeddedMysql' threw exception; nested exception is java.lang.RuntimeException: Command exited with error code: '127' and output: ''
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
        ... 42 common frames omitted
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wix.mysql.EmbeddedMysql]: Factory method 'embeddedMysql' threw exception; nested exception is java.lang.RuntimeException: Command exited with error code: '127' and output: ''
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
        ... 57 common frames omitted
    Caused by: java.lang.RuntimeException: Command exited with error code: '127' and output: ''
        at com.wix.mysql.distribution.setup.ProcessRunner.resolveException(ProcessRunner.java:50)
        at com.wix.mysql.distribution.setup.ProcessRunner.run(ProcessRunner.java:35)
        at com.wix.mysql.distribution.setup.Mysql57Initializer.apply(Mysql57Initializer.java:35)
        at com.wix.mysql.distribution.Setup.apply(Setup.java:26)
        at com.wix.mysql.MysqldExecutable.start(MysqldExecutable.java:42)
        at com.wix.mysql.MysqldExecutable.start(MysqldExecutable.java:21)
        at de.flapdoodle.embed.process.runtime.Executable.start(Executable.java:101)
        at com.wix.mysql.EmbeddedMysql.<init>(EmbeddedMysql.java:46)
        at com.wix.mysql.EmbeddedMysql$Builder.start(EmbeddedMysql.java:160)
        at com.example.config.EmbeddedMysqlConfig.embeddedMysql(EmbeddedMysqlConfig.java:37)
        at com.example.config.EmbeddedMysqlConfig$$EnhancerBySpringCGLIB$$b1f46ab.CGLIB$embeddedMysql$0(<generated>)
        at com.example.config.EmbeddedMysqlConfig$$EnhancerBySpringCGLIB$$b1f46ab$$FastClassBySpringCGLIB$$74be74ed.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
        at com.example.config.EmbeddedMysqlConfig$$EnhancerBySpringCGLIB$$b1f46ab.embeddedMysql(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
        ... 58 common frames omitted

Usage:

@Configuration
public class EmbeddedMysqlConfig {

    public static final String dbName = "embeddedMysqlDb";

    @Bean(dbName)
    @Profile("local")
    public EmbeddedMysql embeddedMysql() {
        MysqldConfig config = aMysqldConfig(Version.v5_7_19)
                .withCharset(Charset.UTF8)
                .withPort(3306)
                .build();
        DownloadConfig downloadConfig = aDownloadConfig()
                .withProxy(aHttpProxy("<redacted>", 8888))
                .withCacheDir(System.getProperty("java.io.tmpdir"))
                .build();
        return anEmbeddedMysql(config, downloadConfig)
                .addSchema("whiteboard-camunda")
                .addSchema("whiteboard-app")
                .addSchema("whiteboard-history")
                .start();
    }

    @Bean(dbName)
    @Profile("!local")
    public EmbeddedMysql fakeMysql() {
        return null;
    }
}

UPDATE I've noticed it creates only empty directory structure in /target.

viliusl commented 6 years ago

@Loucher - thanks alot for detailed report! Could you check newly released version 3.1.1 ? I did a fix for missing output from mysql - so at least you should get a better feedback.

Also you could set more verbose output (TRACE) like https://github.com/wix/wix-embedded-mysql/blob/master/wix-embedded-mysql/src/test/resources/logback.xml#L8

These platform-specific issues are usually hard to hunt down and travis does not even have ubuntu 16 support:/

Loucher commented 6 years ago

@viliusl - good news! With 3.1.1 mySQL server successfully started, but looks like there is now a problem with schema creation:

ERROR 1064 (42000) at line 1: 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 '-camunda CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci' at line 1

Full output:

2018-02-01 13:18:45.515 $ threadId: INFO   namespace:com.example c.w.m.EmbeddedMysql [ hostname: serviceName: version: transactionId: conversationId: requestTimeStamp:  responseTimeStamp: duration:] Preparing EmbeddedMysql version 'Version 5.7.19'...
Download Version 5.7.19:Linux:B64 START
Download Version 5.7.19:Linux:B64 DownloadSize: 640650826
Download Version 5.7.19:Linux:B64 0%
Download Version 5.7.19:Linux:B64 5%
Download Version 5.7.19:Linux:B64 10%
Download Version 5.7.19:Linux:B64 15%
Download Version 5.7.19:Linux:B64 20%
Download Version 5.7.19:Linux:B64 25%
Download Version 5.7.19:Linux:B64 30%
Download Version 5.7.19:Linux:B64 35%
Download Version 5.7.19:Linux:B64 40%
Download Version 5.7.19:Linux:B64 45%
Download Version 5.7.19:Linux:B64 50%
Download Version 5.7.19:Linux:B64 55%
Download Version 5.7.19:Linux:B64 60%
Download Version 5.7.19:Linux:B64 65%
Download Version 5.7.19:Linux:B64 70%
Download Version 5.7.19:Linux:B64 75%
Download Version 5.7.19:Linux:B64 80%
Download Version 5.7.19:Linux:B64 85%
Download Version 5.7.19:Linux:B64 90%
Download Version 5.7.19:Linux:B64 95%
Download Version 5.7.19:Linux:B64 100%
Download Version 5.7.19:Linux:B64 downloaded with 519kb/s
Download Version 5.7.19:Linux:B64 DONE
Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz START
Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/bin/mysql
Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/bin/mysqladmin
Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/bin/my_print_defaults
Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/bin/mysqld
Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/bin/resolveip
Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/share/english/errmsg.sys
Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/share/fill_help_tables.sql
Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/share/mysql_security_commands.sql
Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/share/mysql_system_tables.sql
Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz extract mysql-5.7.19-linux-glibc2.12-x86_64/share/mysql_system_tables_data.sql
Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz nothing left
Extract /tmp/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz DONE
2018-02-01 13:39:18.002 $ threadId: INFO   namespace:com.example c.w.m.MysqldExecutable [ hostname: serviceName: version: transactionId: conversationId: requestTimeStamp:  responseTimeStamp: duration:] Preparing mysqld for startup
2018-02-01 13:39:24.186 $ threadId: INFO   namespace:com.example c.w.m.MysqldExecutable [ hostname: serviceName: version: transactionId: conversationId: requestTimeStamp:  responseTimeStamp: duration:] Starting MysqldProcess
2018-02-01 13:39:24.891 $ threadId: INFO   namespace:com.example d.f.e.p.r.Executable [ hostname: serviceName: version: transactionId: conversationId: requestTimeStamp:  responseTimeStamp: duration:] start com.wix.mysql.config.MysqldConfig@12a38b53
2018-02-01 13:39:24.960 $ threadId: WARN   namespace:com.example o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext [ hostname: serviceName: version: transactionId: conversationId: requestTimeStamp:  responseTimeStamp: duration:] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'appEntityManagerFactory' defined in class path resource [com/example/config/AppDatabaseConfig.class]: Unsatisfied dependency expressed through method 'appEntityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMysqlDb' defined in class path resource [com/example/config/EmbeddedMysqlConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wix.mysql.EmbeddedMysql]: Factory method 'embeddedMysql' threw exception; nested exception is com.wix.mysql.exceptions.CommandFailedException: Command 'CREATE DATABASE whiteboard-camunda CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;' on schema 'information_schema' failed with errCode '1' and output 'mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: 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 '-camunda CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci' at line 1
'
2018-02-01 13:39:24.989 $ threadId: INFO   namespace:com.example o.s.b.a.l.AutoConfigurationReportLoggingInitializer [ hostname: serviceName: version: transactionId: conversationId: requestTimeStamp:  responseTimeStamp: duration:] 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-02-01 13:39:25.005 $ threadId: ERROR  namespace:com.example o.s.b.SpringApplication [ hostname: serviceName: version: transactionId: conversationId: requestTimeStamp:  responseTimeStamp: duration:] Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'appEntityManagerFactory' defined in class path resource [com/example/config/AppDatabaseConfig.class]: Unsatisfied dependency expressed through method 'appEntityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMysqlDb' defined in class path resource [com/example/config/EmbeddedMysqlConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wix.mysql.EmbeddedMysql]: Factory method 'embeddedMysql' threw exception; nested exception is com.wix.mysql.exceptions.CommandFailedException: Command 'CREATE DATABASE whiteboard-camunda CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;' on schema 'information_schema' failed with errCode '1' and output 'mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: 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 '-camunda CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci' at line 1
'
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:856)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
    at com.example.Application.main(Application.java:47)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMysqlDb' defined in class path resource [com/example/config/EmbeddedMysqlConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wix.mysql.EmbeddedMysql]: Factory method 'embeddedMysql' threw exception; nested exception is com.wix.mysql.exceptions.CommandFailedException: Command 'CREATE DATABASE whiteboard-camunda CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;' on schema 'information_schema' failed with errCode '1' and output 'mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: 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 '-camunda CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci' at line 1
'
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:372)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
    ... 19 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMysqlDb' defined in class path resource [com/example/config/EmbeddedMysqlConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wix.mysql.EmbeddedMysql]: Factory method 'embeddedMysql' threw exception; nested exception is com.wix.mysql.exceptions.CommandFailedException: Command 'CREATE DATABASE whiteboard-camunda CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;' on schema 'information_schema' failed with errCode '1' and output 'mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: 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 '-camunda CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci' at line 1
'
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
    ... 42 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wix.mysql.EmbeddedMysql]: Factory method 'embeddedMysql' threw exception; nested exception is com.wix.mysql.exceptions.CommandFailedException: Command 'CREATE DATABASE whiteboard-camunda CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;' on schema 'information_schema' failed with errCode '1' and output 'mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: 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 '-camunda CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci' at line 1
'
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 57 common frames omitted
Caused by: com.wix.mysql.exceptions.CommandFailedException: Command 'CREATE DATABASE whiteboard-camunda CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;' on schema 'information_schema' failed with errCode '1' and output 'mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: 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 '-camunda CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci' at line 1
'
    at com.wix.mysql.MysqlClient.execute(MysqlClient.java:74)
    at com.wix.mysql.MysqlClient.executeCommands(MysqlClient.java:49)
    at com.wix.mysql.EmbeddedMysql.addSchema(EmbeddedMysql.java:79)
    at com.wix.mysql.EmbeddedMysql$Builder.start(EmbeddedMysql.java:163)
    at com.example.config.EmbeddedMysqlConfig.embeddedMysql(EmbeddedMysqlConfig.java:36)
    at com.example.config.EmbeddedMysqlConfig$$EnhancerBySpringCGLIB$$307edc39.CGLIB$embeddedMysql$1(<generated>)
    at com.example.config.EmbeddedMysqlConfig$$EnhancerBySpringCGLIB$$307edc39$$FastClassBySpringCGLIB$$8e66561d.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
    at com.example.config.EmbeddedMysqlConfig$$EnhancerBySpringCGLIB$$307edc39.embeddedMysql(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 58 common frames omitted
viliusl commented 6 years ago

@Loucher - shouldn't you add table name to quotes? afaik mysql is not happy with dashes in table-names.

viliusl commented 6 years ago

@Loucher - btw - did you get error with missing libaio1?

Loucher commented 6 years ago

@viliusl its was failing on .addSchema("whiteboard-camunda") , so yes, wrapping in escaped quotes is required, or maybe there can be small improvement in SQL script for creating database, for example: "CREATE DATABASE '%s' CHARACTER SET = %s COLLATE = %s;"

I already had libaio1 installed so no error occurred for me.

viliusl commented 6 years ago

@Loucher added a PR - this will require major version up of library as it's a breaking change, but oh well.

viliusl commented 6 years ago

@Loucher version 4.0.0 released with implicit database name quoting. closing this issue - please reopen if any issues found with it.