Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2382

Simple JSF project fails with "Singleton not set for STATIC_INSTANCE => []"

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.4.2.Final
    • Fix Version/s: 3.0.0.Final, 2.4.4.Final
    • Component/s: None
    • Labels:
      None
    • Environment:

      Apache Tomcat 8.5.9
      Mojarra JavaServer Faces 2.3, 2.2.14

      Description

      I created a minimal JSF project with Tomcat, Mojarra JavaServer Faces and Weld. It consists of a single index.xhtml page. After deployment I end up with a HTTP Status 500 - Singleton not set for STATIC_INSTANCE => [].

      Stacktrace:

      java.lang.IllegalStateException: Singleton not set for STATIC_INSTANCE => []
      at org.jboss.weld.bootstrap.api.helpers.RegistrySingletonProvider$RegistrySingleton.get(RegistrySingletonProvider.java:28)
      at org.jboss.weld.Container.instance(Container.java:63)
      at org.jboss.weld.jsf.ConversationAwareViewHandler.getConversationContext(ConversationAwareViewHandler.java:81)
      at org.jboss.weld.jsf.ConversationAwareViewHandler.getActionURL(ConversationAwareViewHandler.java:110)
      at com.sun.faces.facelets.tag.ui.UIDebug.encodeBegin(UIDebug.java:112)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1854)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458)
      at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
      at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:789)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1437)
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)

      Steps to reproduce:
      Setup up your Mojarra and Weld environment for use in a servlet container: beans.xml, register BeanManager in context and add the listener in web.xml. Create a simple index.xhtml.

      <!DOCTYPE html>
      <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://xmlns.jcp.org/jsf/html"
            xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
          <h:head>
              <meta charset="utf-8" />
              <title></title>
          </h:head>
          <h:body>
              <ui:debug />
              <h:outputText value="Hello, World!" />
          </h:body>
      </html>
      

      After deployment the project will fail with the stacktrace above.

      Mitigation
      Remove the <ui:debug> the context starts and prints Hello World.

      or

      Create a plain Java class, annotate it with Named and a Scope.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                manovotn Matej Novotny
                Reporter:
                raupach Björn Raupach
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: