java.lang.IllegalStateException: WebXml is not initialized yet. Please use #init(ServletContext) method to manually initialize it

StackOverflow https://stackoverflow.com/questions/19646732

Frage

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.

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:

java.lang.IllegalStateException: WebXml is not initialized yet. Please use #init(ServletContext) 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)

In that whole stacktrace, there's not a single line of code that has been written by us.

For sake of clarity, this is what we package (irrelevant items excluded; at least, let's hope they are irrelevent :):

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

The web.xml only has a single error page because of the issues mentioned at Referencing CDI managed bean from Facelets error page:

<error-page>
  <exception-type>javax.faces.application.ViewExpiredException</exception-type>
  <location>/login.xhtml?custom_msg=session_expired</location>
</error-page>

Question now is: what am I doing wrong? Or is this caused by OmniFaces in combination with the before mentioned software stack?

Regards,

Rens

War es hilfreich?

Lösung

Problem looks like a race condition indeed. I have tried the workaround that BalusC suggested and I haven't seen this problem ever since.

Will wait for a version of OmniFaces that contains the fix and will then remove the workaround.

Thanks!

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top