title: java.lang.IllegalStateException: WebXml is not initialized yet. Please use #init(ServletContext) method to manually initialize it
body: <p>I'm trying to (auto) deploy an ear that holds code that uses a combination of JSF, PrimeFaces and OmniFaces on a WebLogic 12c application server.</p>
  
  <p>Every now and then (and lately there's more 'now' than 'then') all of the AJAX requests that can be are done from the application are broken. Whenever something is using AJAX, the following response is returned from the server:</p>
  
  <pre><code>java.lang.IllegalStateException: WebXml is not initialized yet. Please use #init&amp;#40;ServletContext&amp;#41; method to manually initialize it.
    at org.omnifaces.config.WebXml.checkInitialized(WebXml.java:313)
    at org.omnifaces.config.WebXml.getFormLoginPage(WebXml.java:294)
    at org.omnifaces.context.OmniPartialViewContext$OmniPartialResponseWriter.startDocument(OmniPartialViewContext.java:253)
    at org.primefaces.context.PrimePartialResponseWriter.startDocument(PrimePartialResponseWriter.java:133)
    at com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError(AjaxExceptionHandlerImpl.java:199)
    at com.sun.faces.context.AjaxExceptionHandlerImpl.handle(AjaxExceptionHandlerImpl.java:123)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
    at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3296)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3262)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
    at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2171)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2097)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2075)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1514)
    at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
  </code></pre>
  
  <p>In that whole stacktrace, there's not a single line of code that has been written by us.</p>
  
  <p>For sake of clarity, this is what we package (irrelevant items excluded; at least, let's hope they are irrelevent :):</p>
  
  <pre><code>portal.ear
  portal.ear/portal.war
  portal.ear/portal.war/WEB-INF/lib/portal.jar
  portal.ear/portal.war/WEB-INF/lib/omnifaces-1.6.3.jar
  portal.ear/portal.war/WEB-INF/lib/primefaces-3.5.17.jar
  </code></pre>
  
  <p>The <code>web.xml</code> only has a single error page because of the issues mentioned at <a href="https://stackoverflow.com/questions/18542209/referencing-cdi-managed-bean-from-facelets-error-page">Referencing CDI managed bean from Facelets error page</a>:</p>
  
  <pre><code>&lt;error-page&gt;
    &lt;exception-type&gt;javax.faces.application.ViewExpiredException&lt;/exception-type&gt;
    &lt;location&gt;/login.xhtml?custom_msg=session_expired&lt;/location&gt;
  &lt;/error-page&gt;
  </code></pre>
  
  <p>Question now is: what am I doing wrong? Or is this caused by OmniFaces in combination with the before mentioned software stack?</p>
  
  <p>Regards,</p>
  
  <p>Rens</p>