title: Usage of Initialization On Demand Holder idiom is giving NoClassDefFoundError
body: <p>I am trying to implement  Initialization On Demand Holder idiom in my code for Database connection manager for Lazy loading</p>
  
  <pre><code>Class ConfigurationAgent{
  private ConfigurationAgent(){
      String baseDir = "XYZ";
  }
  private static class LazyLoader{
      private static final ConfigurationAgent instance = new ConfigurationAgent();
  }
  public static ConfigurationAgent getInstance(){
      ConfigurationAgent cfg = LazyLoader.instance;
      return cfg;
  }
  }
  </code></pre>
  
  <p>Now I am calling this ConfigurationAgent's instance from another class using below : </p>
  
  <pre><code>ConfigurationAgent agent = ConfigurationAgent.getInstance();
  </code></pre>
  
  <p>In this case I am getting ExceptionInInitializerError followed by java.lang.NoClassDefFoundError errors.</p>
  
  <p>My guess is static class LazyLoader is not getting loaded properly because of which the call "LazyLoader.instance" is giving this issue. (This issue is mentioned in following wiki link without any solution <a href="http://en.wikipedia.org/wiki/Initialization_on_demand_holder_idiom" rel="nofollow">http://en.wikipedia.org/wiki/Initialization_on_demand_holder_idiom</a>)
  Please let me know how to resolve this issue</p>