title: How to address java.lang.ExceptionInInitializerError and java.lang.NoClassDefFoundError when running cucumber script through Selenium Java
body: <p>I have a cucumber and selenium test which has always worked fine and suddenly stops running with the below error.</p>
  
  <pre><code>1 Scenarios (1 failed)
  14 Steps (14 skipped)
  0m0.004s
  
      java.lang.ExceptionInInitializerError
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
          at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145)
          at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342)
          at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
          at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
          at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
          at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
          at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
          at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
          at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
          at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
          at cucumber.runtime.java.picocontainer.PicoFactory.getInstance(PicoFactory.java:40)
          at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
          at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:224)
          at cucumber.runtime.Runtime.runHooks(Runtime.java:212)
          at cucumber.runtime.Runtime.runBeforeHooks(Runtime.java:202)
          at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:40)
          at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
          at cucumber.runtime.Runtime.run(Runtime.java:122)
          at cucumber.api.cli.Main.run(Main.java:36)
          at cucumber.api.cli.Main.main(Main.java:18)
      Caused by: java.lang.NullPointerException
          at com.optal.browsers.WebDriverFactory.createAndSetUpThreadedBrowser(WebDriverFactory.java:56)
          at com.optal.browsers.WebDriverFactory.create(WebDriverFactory.java:37)
          at com.optal.hooks.ScenarioHooks.&lt;clinit&gt;(ScenarioHooks.java:19)
          ... 24 more
  
      java.lang.NoClassDefFoundError: Could not initialize class com.optal.hooks.ScenarioHooks
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
          at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145)
          at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342)
          at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
          at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
          at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
          at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
          at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
          at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
          at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
          at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
          at cucumber.runtime.java.picocontainer.PicoFactory.getInstance(PicoFactory.java:40)
          at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
          at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:224)
          at cucumber.runtime.Runtime.runHooks(Runtime.java:212)
          at cucumber.runtime.Runtime.runAfterHooks(Runtime.java:206)
          at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:46)
          at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
          at cucumber.runtime.Runtime.run(Runtime.java:122)
          at cucumber.api.cli.Main.run(Main.java:36)
          at cucumber.api.cli.Main.main(Main.java:18)
  
  Calling System.exit() ..................
  
  Process finished with exit code 1
  </code></pre>