title: Is it possible to use liquibase in AWS ECS Fargate?
body: <p>I ask because I've tried and failed.   The problem seems to be that liquibase needs information about the host it is running on to lock and write to the DATABASECHANGELOG.   </p>
  
  <p>Thus, when I bring up my spring-boot application in an ECS Fargate cluster, I see this:</p>
  
  <p>018-01-12 19:34:03.406 ERROR 6 --- [ main] o.s.boot.SpringApplication : Application startup failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/mlb/best/config/LiquibaseConfig.class]: Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
  at .springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
  at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.8.RELEASE.jar!/:1.5.8.RELEASE]
  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.8.RELEASE.jar!/:1.5.8.RELEASE]
  at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.8.RELEASE.jar!/:1.5.8.RELEASE]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.8.RELEASE.jar!/:1.5.8.RELEASE]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.8.RELEASE.jar!/:1.5.8.RELEASE]
  at com.mlb.best.Application.main(Application.java:31) [classes!/:1.0-SNAPSHOT]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_92-internal]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_92-internal]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_92-internal]
  at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_92-internal]
  at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [application.jar:1.0-SNAPSHOT]
  at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [application.jar:1.0-SNAPSHOT]
  at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [application.jar:1.0-SNAPSHOT]
  at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [application.jar:1.0-SNAPSHOT]
  Caused by: java.lang.ExceptionInInitializerError: null
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_92-internal]
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_92-internal]
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_92-internal]
  at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_92-internal]
  at liquibase.sqlgenerator.SqlGeneratorFactory.(SqlGeneratorFactory.java:40) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.sqlgenerator.SqlGeneratorFactory.getInstance(SqlGeneratorFactory.java:54) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.executor.AbstractExecutor.applyVisitors(AbstractExecutor.java:23) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.executor.jvm.JdbcExecutor.access$700(JdbcExecutor.java:36) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.executor.jvm.JdbcExecutor$QueryStatementCallback.doInStatement(JdbcExecutor.java:345) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:135) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:143) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:151) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:166) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.executor.jvm.JdbcExecutor.queryForInt(JdbcExecutor.java:187) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.executor.jvm.JdbcExecutor.queryForInt(JdbcExecutor.java:182) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.lockservice.StandardLockService.isDatabaseChangeLogLockTableInitialized(StandardLockService.java:118) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.lockservice.StandardLockService.init(StandardLockService.java:94) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:188) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:154) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.Liquibase.update(Liquibase.java:186) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:353) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:317) ~[liquibase-core-3.3.2.jar!/:na]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
  ... 23 common frames omitted
  Caused by: liquibase.exception.UnexpectedLiquibaseException: java.net.UnknownHostException: 19f647ae563e: 19f647ae563e: unknown error
  at liquibase.sqlgenerator.core.LockDatabaseChangeLogGenerator.(LockDatabaseChangeLogGenerator.java:32) ~[liquibase-core-3.3.2.jar!/:na]
  ... 48 common frames omitted
  Caused by: java.net.UnknownHostException: 19f647ae563e: 19f647ae563e: unknown error
  at java.net.InetAddress.getLocalHost(InetAddress.java:1505) ~[na:1.8.0_92-internal]
  at liquibase.util.NetUtil.getLocalHostName(NetUtil.java:41) ~[liquibase-core-3.3.2.jar!/:na]
  at liquibase.sqlgenerator.core.LockDatabaseChangeLogGenerator.(LockDatabaseChangeLogGenerator.java:29) ~[liquibase-core-3.3.2.jar!/:na]
  ... 48 common frames omitted
  <strong><em>Caused by: java.net.UnknownHostException: 19f647ae563e: unknown error</em>
  <em>at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_92-internal]</em>
  <em>at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) ~[na:1.8.0_92-internal]</em>
  <em>at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) ~[na:1.8.0_92-internal]</em>
  <em>at java.net.InetAddress.getLocalHost(InetAddress.java:1500) ~[na:1.8.0_92-internal]</em></strong>
  ... 50 common frames omitted</p>
  
  <p>Is there some way to get around this or must I punt and use AWS ECS EC2?  Normally I'd fix this by inspecting my /etc/hosts to be sure there is a localhost defined there.  But not sure how I do that with fargate.</p>