1 Reply Latest reply on Mar 1, 2012 7:47 AM by Aslak Knutsen

    java.lang.IllegalStateException: Singleton is not set

    brin jack Newbie

      My application runs on glassfish 3.0.1 with seam3, ejb, jsf, richfaces. I am using embedded glassfish 3.0.1 and Arquillian for testcases.

       

      The testcases have to be run for conversationscoped classes. The context has been created for it, as it sometimes runs successfully. But it throws the following exception most of the time.

       

      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:58)

      at com.corelogic.terradactyl.scope.handler.ConversationScopeHandler.initializeContext(ConversationScopeHandler.java:12)

      at com.corelogic.terradactyl.scope.handler.ScopeHandlingRule.starting(ScopeHandlingRule.java:22)

      at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:46)

      at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)

      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)

      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)

      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)

      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)

      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)

      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)

      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)

      at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:163)

      at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:186)

      at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:297)

      at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:182)

      at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

      at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:127)

      at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)

      at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)

      at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)

      at org.apache.maven.surefire.Surefire.run(Surefire.java:177)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:597)

      at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)

      at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)

       

      How can this be overcome.

       

      Thanks.

        • 1. Re: java.lang.IllegalStateException: Singleton is not set
          Aslak Knutsen Master

          Looking at your stacktrace, you're attempting to start a ConversationScope in a Rule on the Client side, not incontainer. JUnit rules are currently executed both on client and incontainer. Your Rule would need 'some' logic to only do the ConversationScope setup when you're incontainer. Arquillian does currently not provide any easy hooks for figuring this out..

           

          Looking at the stacktrace is one bad option..