title: Java EE Critical error during deployment: java.lang.NullPointerException
body: <p>I'm trying to deploy a JEE8 application to a local GlassFish server. The application consists of two modules: one for EJB and one for JSF. I'm using IntelliJ and followed instructions for creating an EAR file, which includes an ejb.jar and jsf.war file.</p>
  
  <p>The deployment is failing and looking at the output is seems to be a NullPointerException. Done plenty of Googling, but no further forward. I've attached the GlassFish output, the application.xml and server log output.</p>
  
  <p>Can someone help please?</p>
  
  <p>The GlassFish console output below</p>
  
  <pre><code>[2020-05-25 02:02:38,665] Artifact JEEv3:ear: Artifact is being deployed, please wait...
  [2020-05-25 02:02:55,453] Artifact JEEv3:ear: Error during artifact deployment. See server log for details.
  [2020-05-25 02:02:55,453] Artifact JEEv3:ear: java.io.IOException: com.sun.enterprise.admin.remote.RemoteFailureException: Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.RuntimeException: java.lang.NullPointerException. Please see server.log for more details.
  </code></pre>
  
  <p>The application.xml file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;application xmlns="http://xmlns.jcp.org/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_8.xsd"
               version="8"&gt;
      &lt;module id="ejb-EJB"&gt;
          &lt;ejb&gt;ejb.jar&lt;/ejb&gt;
      &lt;/module&gt;
      &lt;module id="jsf-Web"&gt;
          &lt;web&gt;
              &lt;web-uri&gt;jsf.war&lt;/web-uri&gt;
              &lt;context-root&gt;jsfWeb&lt;/context-root&gt;
          &lt;/web&gt;
      &lt;/module&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>The server log details below. I've added the full log, which appears to be mainly warnings, and highlighted the nullpointer exception</p>
  
  <pre><code>[2020-05-25T14:02:47.811+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411767811] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.glassfish.cdi.transaction.TransactionalInterceptorMandatory is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:47.841+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411767841] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.glassfish.cdi.transaction.TransactionalInterceptorNever is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:47.846+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411767846] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.glassfish.cdi.transaction.TransactionalInterceptorNotSupported is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:47.850+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411767850] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.glassfish.cdi.transaction.TransactionalInterceptorRequired is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:47.857+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411767857] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.glassfish.cdi.transaction.TransactionalInterceptorRequiresNew is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:47.861+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411767861] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.glassfish.cdi.transaction.TransactionalInterceptorSupports is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:47.888+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411767888] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider$JaxRsParamProducer is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:47.917+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411767917] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class com.ibm.jbatch.container.cdi.BatchProducerBean is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:47.929+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411767929] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class com.sun.faces.flow.FlowDiscoveryCDIHelper is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:48.056+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411768056] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.glassfish.jersey.ext.cdi1x.servlet.internal.CdiExternalRequestScope is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:49.069+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411769069] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.jboss.weld.environment.se.beans.ParametersFactory is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:49.156+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411769156] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.jboss.weld.environment.se.beans.InstanceManager is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:49.164+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411769164] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.jboss.weld.environment.se.threading.RunnableDecorator is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:49.202+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411769202] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.jboss.weld.environment.se.WeldContainer is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:49.208+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411769208] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.WebAppExceptionHolder is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:49.217+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411769217] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.WebAppExceptionInterceptor is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:49.223+0100] [glassfish 5.1] [WARN] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411769223] [levelValue: 900] [[
    WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType&lt;?&gt;) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.TransactionalExceptionMapper is deprecated from CDI 1.1!]]
  
  [2020-05-25T14:02:50.912+0100] [glassfish 5.1] [SEVERE] [] [] [tid: _ThreadID=49 _ThreadName=Thread-9] [timeMillis: 1590411770912] [levelValue: 1000] [[
    SLF4J: Class path contains multiple SLF4J bindings.]]
  
  [2020-05-25T14:02:50.912+0100] [glassfish 5.1] [SEVERE] [] [] [tid: _ThreadID=49 _ThreadName=Thread-9] [timeMillis: 1590411770912] [levelValue: 1000] [[
    SLF4J: Found binding in [jar:file:/Users/marccooling/IdeaProjects/appservers/glassfish5/glassfish/domains/domain1/applications/JEEv3_ear/jsf_war_war/WEB-INF/lib/weld-se.jar!/org/slf4j/impl/StaticLoggerBinder.class]]]
  
  [2020-05-25T14:02:50.912+0100] [glassfish 5.1] [SEVERE] [] [] [tid: _ThreadID=49 _ThreadName=Thread-9] [timeMillis: 1590411770912] [levelValue: 1000] [[
    SLF4J: Found binding in [jar:file:/Users/marccooling/IdeaProjects/appservers/glassfish5/glassfish/domains/domain1/applications/JEEv3_ear/jsf_war_war/WEB-INF/lib/weld-servlet.jar!/org/slf4j/impl/StaticLoggerBinder.class]]]
  
  [2020-05-25T14:02:50.912+0100] [glassfish 5.1] [SEVERE] [] [] [tid: _ThreadID=49 _ThreadName=Thread-9] [timeMillis: 1590411770912] [levelValue: 1000] [[
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.]]
  
  [2020-05-25T14:02:50.923+0100] [glassfish 5.1] [SEVERE] [] [] [tid: _ThreadID=49 _ThreadName=Thread-9] [timeMillis: 1590411770923] [levelValue: 1000] [[
    SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]]]
  
  [2020-05-25T14:02:55.267+0100] [glassfish 5.1] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411775267] [levelValue: 900] [[
    java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.RuntimeException: java.lang.NullPointerException
  java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.RuntimeException: java.lang.NullPointerException
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:881)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:860)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:644)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2020)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1666)
      at com.sun.enterprise.web.WebApplication.start(WebApplication.java:83)
      at org.glassfish.internal.data.EngineRef.start(EngineRef.java:98)
    **Critical error during deployment: 
  java.lang.NullPointerException
      at** com.sun.faces.application.ApplicationAssociate$PostConstructApplicationListener.processEvent(ApplicationAssociate.java:324)
      at javax.faces.event.SystemEvent.processListener(SystemEvent.java:123)
      at com.sun.faces.application.applicationimpl.Events.processListeners(Events.java:253)
      at com.sun.faces.application.applicationimpl.Events.invokeListenersFor(Events.java:231)
      at com.sun.faces.application.applicationimpl.Events.publishEvent(Events.java:112)
      at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:127)
      at org.jboss.weld.environment.servlet.jsf.ForwardingApplication.publishEvent(ForwardingApplication.java:282)
      at org.jboss.weld.environment.servlet.jsf.ForwardingApplication.publishEvent(ForwardingApplication.java:282)
      at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:788)
      at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:553)
      at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:264)
      at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:5005)
      at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:568)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:5574)
      at com.sun.enterprise.web.WebModule.start(WebModule.java:516)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:877)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:860)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:644)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2020)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1666)
      at com.sun.enterprise.web.WebApplication.start(WebApplication.java:83)
      at org.glassfish.internal.data.EngineRef.start(EngineRef.java:98)
    Startup of context /jsf_war failed due to previous errors]]
  
  [2020-05-25T14:02:55.262+0100] [glassfish 5.1] [SEVERE] [AS-WEB-CORE-00175] [javax.enterprise.web.core] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1590411775262] [levelValue: 1000] [[
    **Exception during cleanup after start failed**
  org.apache.catalina.LifecycleException: Manager has not yet been started
      at org.apache.catalina.session.StandardManager.stop(StandardManager.java:838)
      at org.apache.catalina.core.StandardContext.stop(StandardContext.java:5779)
      at com.sun.enterprise.web.WebModule.stop(WebModule.java:545)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:5592)
      at com.sun.enterprise.web.WebModule.start(WebModule.java:516)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:877)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:860)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:644)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2020)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1666)
      at com.sun.enterprise.web.WebApplication.start(WebApplication.java:83)
      at org.glassfish.internal.data.EngineRef.start(EngineRef.java:98)
  </code></pre>