title: elasticsearch-1.6 Could not initialize class org.elasticsearch.monitor.jvm.JvmInfo when connecting to its docker container
body: <p>I have an sbt project which includes elasticsearch i am creating a custom image of my sbt project and using elasticsearch:1.6.0 public image 
  <a href="https://hub.docker.com/_/elasticsearch" rel="nofollow noreferrer">https://hub.docker.com/_/elasticsearch</a></p>
  
  <p>here is the docker file of my sbt project</p>
  
  <pre><code>FROM hseeberger/scala-sbt:11.0.2_2.12.8_1.2.8 as stripecommon
  
  MAINTAINER sara &lt;sarawaheed3191@gmail.com&gt;
  
  WORKDIR /myproject
  
  ADD myprojectcode .
  
  CMD ["sbt","reload","clean","compile","run"]
  </code></pre>
  
  <p>and here is the <code>dockerfile</code> of the elasticsearch:1.6.0 public image 
   <a href="https://github.com/MonsantoCo/docker-elasticsearch/blob/master/1.6.0/Dockerfile" rel="nofollow noreferrer">https://github.com/MonsantoCo/docker-elasticsearch/blob/master/1.6.0/Dockerfile</a></p>
  
  <p>i am starting the elasticsearch container like this </p>
  
  <p>here is how i am running my containers</p>
  
  <pre><code>docker create network mynetwork
  </code></pre>
  
  <p>to start elasticsearch container </p>
  
  <pre><code>docker run -p 9200:9200 -p 9300:9300 --network mynetwork elasticsearch:1.6.0
  </code></pre>
  
  <p>to start my project container</p>
  
  <pre><code>docker run --network mynetwork myproject:v1
  </code></pre>
  
  <p>i am getting the following exceptions 
  org.elasticsearch.common.inject.CreationException: Guice creation errors:</p>
  
  <pre><code>1) Error injecting constructor, java.lang.ExceptionInInitializerError
    at org.elasticsearch.cache.recycler.PageCacheRecycler.&lt;init&gt;(Unknown Source)
    while locating org.elasticsearch.cache.recycler.PageCacheRecycler
      for parameter 0 at org.elasticsearch.common.util.BigArrays.&lt;init&gt;(Unknown Source)
    while locating org.elasticsearch.common.util.BigArrays
      for parameter 3 at org.elasticsearch.transport.netty.NettyTransport.&lt;init&gt;(Unknown Source)
    while locating org.elasticsearch.transport.netty.NettyTransport
    while locating org.elasticsearch.transport.Transport
      for parameter 1 at org.elasticsearch.transport.TransportService.&lt;init&gt;(Unknown Source)
    while locating org.elasticsearch.transport.TransportService
  Caused by: java.lang.ExceptionInInitializerError
      at org.elasticsearch.common.unit.MemorySizeValue.parseBytesSizeValueOrHeapRatio(MemorySizeValue.java:42)
      at org.elasticsearch.common.settings.ImmutableSettings.getAsMemory(ImmutableSettings.java:401)
      at org.elasticsearch.cache.recycler.PageCacheRecycler.&lt;init&gt;(PageCacheRecycler.java:74)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      at org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:54)
      at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:86)
      at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)
      at org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)
      at org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)
      at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:85)
      at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)
      at org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)
      at org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)
      at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:85)
      at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)
      at org.elasticsearch.common.inject.FactoryProxy.get(FactoryProxy.java:52)
      at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)
      at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:837)
      at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)
      at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:57)
      at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
      at org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)
      at org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)
      at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:85)
      at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)
      at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)
      at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:837)
      at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)
      at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:57)
      at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
      at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:200)
      at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:193)
      at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:830)
      at org.elasticsearch.common.inject.InjectorBuilder.loadEagerSingletons(InjectorBuilder.java:193)
      at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:175)
      at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:110)
      at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
      at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
      at org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:59)
      at org.elasticsearch.client.transport.TransportClient.&lt;init&gt;(TransportClient.java:195)
      at org.elasticsearch.client.transport.TransportClient.&lt;init&gt;(TransportClient.java:125)
      at models.ElasticSearchConnectionInfo$.createClient(ElasticSearchConnectionInfo.scala:31)
      at models.ElasticSearchConnectionInfo$.getClient(ElasticSearchConnectionInfo.scala:41)
      at esconnection.ESconnectionStart.ESconStart(ESconnectionStart.scala:9)
      at com.ifkaar.hazelcastserver.HazelcastServer.main(HazelcastServer.java:35)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at sbt.Run.invokeMain(Run.scala:98)
      at sbt.Run.run0(Run.scala:92)
      at sbt.Run.execute$1(Run.scala:68)
      at sbt.Run.$anonfun$run$4(Run.scala:80)
      at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
      at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:10)
      at sbt.TrapExit$App.run(TrapExit.scala:253)
      at java.base/java.lang.Thread.run(Thread.java:834)
  Caused by: java.lang.UnsupportedOperationException: Boot class path mechanism is not supported
      at java.management/sun.management.RuntimeImpl.getBootClassPath(RuntimeImpl.java:99)
      at org.elasticsearch.monitor.jvm.JvmInfo.&lt;clinit&gt;(JvmInfo.java:77)
      ... 60 more
  
  2) Error injecting constructor, java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.monitor.jvm.JvmInfo
    at org.elasticsearch.cache.recycler.PageCacheRecycler.&lt;init&gt;(Unknown Source)
    while locating org.elasticsearch.cache.recycler.PageCacheRecycler
      for parameter 0 at org.elasticsearch.common.util.BigArrays.&lt;init&gt;(Unknown Source)
    while locating org.elasticsearch.common.util.BigArrays
      for parameter 3 at org.elasticsearch.transport.netty.NettyTransport.&lt;init&gt;(Unknown Source)
    while locating org.elasticsearch.transport.netty.NettyTransport
    while locating org.elasticsearch.transport.Transport
  Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.monitor.jvm.JvmInfo
      at org.elasticsearch.common.unit.MemorySizeValue.parseBytesSizeValueOrHeapRatio(MemorySizeValue.java:42)
      at org.elasticsearch.common.settings.ImmutableSettings.getAsMemory(ImmutableSettings.java:401)
      at org.elasticsearch.cache.recycler.PageCacheRecycler.&lt;init&gt;(PageCacheRecycler.java:74)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      at org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:54)
      at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:86)
      at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)
      at org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)
      at org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)
      at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:85)
      at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)
      at org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)
      at org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)
      at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:85)
      at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)
      at org.elasticsearch.common.inject.FactoryProxy.get(FactoryProxy.java:52)
      at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)
      at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:837)
      at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)
      at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:57)
      at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
      at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:200)
      at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:193)
      at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:830)
      at org.elasticsearch.common.inject.InjectorBuilder.loadEagerSingletons(InjectorBuilder.java:193)
      at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:175)
      at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:110)
      at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
      at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
      at org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:59)
      at org.elasticsearch.client.transport.TransportClient.&lt;init&gt;(TransportClient.java:195)
      at org.elasticsearch.client.transport.TransportClient.&lt;init&gt;(TransportClient.java:125)
      at models.ElasticSearchConnectionInfo$.createClient(ElasticSearchConnectionInfo.scala:31)
      at models.ElasticSearchConnectionInfo$.getClient(ElasticSearchConnectionInfo.scala:41)
      at esconnection.ESconnectionStart.ESconStart(ESconnectionStart.scala:9)
      at com.ifkaar.hazelcastserver.HazelcastServer.main(HazelcastServer.java:35)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at sbt.Run.invokeMain(Run.scala:98)
      at sbt.Run.run0(Run.scala:92)
      at sbt.Run.execute$1(Run.scala:68)
      at sbt.Run.$anonfun$run$4(Run.scala:80)
      at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
      at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:10)
      at sbt.TrapExit$App.run(TrapExit.scala:253)
      at java.base/java.lang.Thread.run(Thread.java:834)
  </code></pre>
  
  <p>here is my connection code </p>
  
  <pre><code>val clusterName=config.getString("es.clusterName")
     val host=config.getString("es.host")
  
  val settings = ImmutableSettings.settingsBuilder().put("cluster.name", clusterName).build();
       client = new TransportClient(settings);
       client.addTransportAddress(new InetSocketTransportAddress(host,9300));
  </code></pre>
  
  <p>and here is the config file </p>
  
  <pre><code>es.clusterName="myCluster"
  es.host="172.18.0.2"
  </code></pre>
  
  <p>i have seen the ip <code>172.18.0.2</code> in elasticsearch docker container logs </p>
  
  <pre><code>Redneck] bound_address {inet[/0.0.0.0:9300]}, publish_address {inet[/172.18.0.2:9300]}
  </code></pre>
  
  <p>here is the running status of the elasticsearch container </p>
  
  <pre><code>293f2f750398        elasticsearch:1.6.0         "/docker-entrypoint.…"   30 seconds ago      Up 22 seconds                     0.0.0.0:9200-&gt;9200/tcp, 0.0.0.0:9300-&gt;9300/tcp   zealous_johnson
  </code></pre>
  
  <p>please guide what i am doing wrong here</p>