6 Replies Latest reply: Nov 7, 2012 1:58 PM by nantucket RSS

    singleton is not set

    nantucket
      Eclipse Indigo
      Tomcat 7.0.27
      Java 6
      Mac OS X 10.7

      I'm trying to run a JSF web application but when I attempt to load the page in the browser I generate a 500 Server error response and the following error stack appears:

      Caused by: java.lang.IllegalStateException: Singleton is not set
           at org.jboss.weld.bootstrap.api.helpers.IsolatedStaticSingletonProvider$IsolatedStaticSingleton.get(IsolatedStaticSingletonProvider.java:52)
           at org.jboss.weld.Container.instance(Container.java:54)
           at org.jboss.weld.jsf.WeldPhaseListener.instance(WeldPhaseListener.java:161)
           at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:98)
           at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:85)
           at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
           at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
           ... 20 more

      Any feedback as to what this might mean or how to resolve it would be appreciated. Thanks.
        • 1. Re: singleton is not set
          gimbal2
          nantucket wrote:
          Any feedback as to what this might mean or how to resolve it would be appreciated. Thanks.
          Google might have some ideas if you paste "Caused by: java.lang.IllegalStateException: Singleton is not set" into it. Its not a problem with JSF, its a problem with Weld (the reference implementation of the CDI specification). You probably missed some setup step you need when using Weld outside of a JEE container.

          For real assistance I suggest you take it to the JBoss Weld forums:

          https://community.jboss.org/en/weld?view=discussions
          • 2. Re: singleton is not set
            nickarls
            Make sure you follow the Weld documentation for Tomcat usage (it's not OOTB on a non-EE-server)
            • 3. Re: singleton is not set
              gimbal2
              nickarls wrote:
              Make sure you follow the Weld documentation for Tomcat usage (it's not OOTB on a non-EE-server)
              http://docs.jboss.org/weld/reference/1.1.0.Final/en-US/html/gettingstarted.html#tomcat

              I'm not against RTFM replies, but then at least be forgiving by providing the actual link to it :)
              • 4. Re: singleton is not set
                nickarls
                If the google search is trivial (http://www.lmgtfy.com/?q=weld+tomcat) I consider it implicitly linked ;-)
                • 5. Re: singleton is not set
                  gimbal2
                  nickarls wrote:
                  If the google search is trivial (http://www.lmgtfy.com/?q=weld+tomcat) I consider it implicitly linked ;-)
                  Right you are. But these kind of threads usually come to be because people somehow get a rash when looking at search results. That's the service you deliver to your fellow man - to make it so their head doesn't explode from doing a tiny bit of quality-of-life-improving personal effort.

                  Sod it all, lets go to a bar :(
                  • 6. Re: singleton is not set
                    nantucket
                    gimbal2 wrote:
                    nantucket wrote:
                    Any feedback as to what this might mean or how to resolve it would be appreciated. Thanks.
                    Google might have some ideas if you paste "Caused by: java.lang.IllegalStateException: Singleton is not set" into it. Its not a problem with JSF, its a problem with Weld (the reference implementation of the CDI specification). You probably missed some setup step you need when using Weld outside of a JEE container.

                    For real assistance I suggest you take it to the JBoss Weld forums:

                    https://community.jboss.org/en/weld?view=discussions
                    gimbal2, you are right and I am sorry it took me so long to return to the thread. Yes in fact I had a jar file for weld on my classpath that I didn't intend to use. Removing the jar file resolved the issue.

                    Thanks for your timely response I really appreciate it!

                    ETA - Just to clarify, I did do a search and discovered it was a weld issue but assumed that since I wasn't using weld, that I must not have found the answer I needed. Only after your post confirmed my search results did I go back and thoroughly search for the jar in my classpath and I found it.

                    Edited by: nantucket on Nov 7, 2012 12:56 PM