title: Private static property variable leads to null pointer exception
body: <p>I have set a private static properties object to load in some configuration for my factory class in the constructor of factory class.</p>
  
  <pre><code>public class BussinessServiceFactory {
      private static final BussinessServiceFactory factory = new BussinessServiceFactory();
      public static BussinessServiceFactory createBussinessServiceFactory(){
          return factory;
      }
      private BussinessServiceFactory(){
          InputStream in = BussinessServiceFactory.class.getClassLoader().getResourceAsStream("factory/bussinessservice.properties");
          try {
              bsConfig.load(in);
          } catch (IOException exception) {
              // TODO Auto-generated catch block
              throw new RuntimeException(exception);
          }
      }
      private static Properties bsConfig = new Properties();
      public &lt;T&gt; T createBussinessService(Class&lt;T&gt; clazz){
          try {
              String clazzName = clazz.getSimpleName();
              String name = bsConfig.getProperty(clazzName);
              return (T) Class.forName(name).newInstance();
          } catch (InstantiationException | IllegalAccessException
                  | ClassNotFoundException exception) {
              throw new RuntimeException(exception);
          }
      }
  }
  </code></pre>
  
  <p>However, when I initialize the class, it throws <code>NullPointerException</code>. </p>
  
  <pre><code>java.lang.NullPointerException
      at factory.BussinessServiceFactory.&lt;init&gt;(BussinessServiceFactory.java:15)
      at factory.BussinessServiceFactory.&lt;clinit&gt;(BussinessServiceFactory.java:8)
      ... 24 more
  </code></pre>
  
  <p>Then if I change the properties object into non-static object, the problem is solved. But I am still confused by the reason why would this happen and how it could be solved in this way.</p>