5 Replies Latest reply on Sep 16, 2009 6:36 PM by frer

    Integration test fails because of @Startup component

    frer

      Hi,


      I have a component called LocaleSetupAction that is declared like this:


      @Stateful
      @Name("localeSetupAction")
      @Scope(ScopeType.SESSION)
      @Startup
      public class LocaleSetupActionImpl implements LocaleSetupAction {
      ...    
      }



      The component works great with my jboss server (4.2.1) but when I try to launch an integration test, it fails with the exception:





      If I comment the @Startup of that particular component (which I'm not actually testing) the test goes smoothly.


      Is this a known bug?  The workaround is acceptable for now but its kind of annoying to have to comment it every time I launch a test (and to remember to uncomment it after)


      Thanks


        • 1. Re: Integration test fails because of @Startup component
          frer

          By the way I'm using seam 2.2.0 and my integration test runs on embedded-jboss

          • 2. Re: Integration test fails because of @Startup component
            frer

            Here is the stack trace:




            java.lang.RuntimeException: org.jboss.seam.InstantiationException: Could not instantiate Seam component: localeSetupAction
                 at org.mdarad.framework.tests.unittests.AbstractTestNGSeamTest.begin(AbstractTestNGSeamTest.java:45)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                 at java.lang.reflect.Method.invoke(Unknown Source)
                 at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
                 at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:398)
                 at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:145)
                 at org.testng.internal.Invoker.invokeMethod(Invoker.java:427)
                 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
                 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
                 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
                 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
                 at org.testng.TestRunner.runWorkers(TestRunner.java:712)
                 at org.testng.TestRunner.privateRun(TestRunner.java:582)
                 at org.testng.TestRunner.run(TestRunner.java:477)
                 at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
                 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
                 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
                 at org.testng.SuiteRunner.run(SuiteRunner.java:198)
                 at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:823)
                 at org.testng.TestNG.runSuitesLocally(TestNG.java:790)
                 at org.testng.TestNG.run(TestNG.java:708)
                 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
                 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
            Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: localeSetupAction
                 at org.jboss.seam.Component.newInstance(Component.java:2144)
                 at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
                 at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
                 at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:233)
                 at org.jboss.seam.contexts.ServletLifecycle.beginSession(ServletLifecycle.java:155)
                 at org.jboss.seam.mock.AbstractSeamTest.begin(AbstractSeamTest.java:898)
                 at org.jboss.seam.mock.SeamTest.begin(SeamTest.java:30)
                 at org.mdarad.framework.tests.unittests.AbstractTestNGSeamTest.begin(AbstractTestNGSeamTest.java:35)
                 ... 24 more
            Caused by: javax.naming.NameNotFoundException: petstore not bound
                 at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
                 at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
                 at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
                 at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
                 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:669)
                 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
                 at javax.naming.InitialContext.lookup(Unknown Source)
                 at org.jboss.seam.Component.instantiateSessionBean(Component.java:1400)
                 at org.jboss.seam.Component.instantiate(Component.java:1364)
                 at org.jboss.seam.Component.newInstance(Component.java:2122)
                 ... 31 more
            



            • 3. Re: Integration test fails because of @Startup component
              jeanluc

              Does your code actually depend on a petstore naming location in JNDI as the stack trace indicates?

              • 4. Re: Integration test fails because of @Startup component
                frer

                yes its the name of my test application. It is deployed and works well in Jboss...just not with embedded-jboss

                • 5. Re: Integration test fails because of @Startup component
                  frer

                  Anybody have an idea why I cannot have a @Startup component in my ComponentTest?