5 Replies Latest reply on Nov 7, 2007 6:56 PM by Pete Muir

    Trouble Getting the Most Basic SeamTest to Work

    neilac333 Novice

      I have studied the forum, yet I am having trouble simply getting the most basic test to work--a single TestNG unit test extending SeamTest with a single method with Assert.assertTrue(true). That's it. No FacesContext simulation or anything remotely complex. I haven't seen anything in the documentation or in the Yuan book that might help.

      Can you please provide just a basic tutorial on the configuration necessary to make SeamTest work? JAR files, configuration files like components.xml and their contents and where they should be, any other kinds of special settings, etc.

      It is really frustrating to be having so much trouble with something so basic.

      Thanks.

      Here is the stack trace of the error:

      java.lang.RuntimeException: Unable to create a KernelInitializer based on the specified KernelConfig
      
       at org.jboss.kernel.KernelFactory.createKernelInitializer(KernelFactory.java:156)
       at org.jboss.kernel.KernelFactory.assembleNewKernel(KernelFactory.java:99)
       at org.jboss.kernel.KernelFactory.newInstance(KernelFactory.java:67)
       at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.bootstrap(AbstractBootstrap.java:120)
       at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:89)
       at org.jboss.embedded.Bootstrap.createKernel(Bootstrap.java:131)
       at org.jboss.embedded.Bootstrap.getInstance(Bootstrap.java:76)
       at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:10)
       at org.jboss.seam.mock.BaseSeamTest.startJbossEmbeddedIfNecessary(BaseSeamTest.java:967)
       at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:892)
       at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
       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:585)
       at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
       at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:394)
       at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
       at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
       at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:165)
       at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
       at org.testng.TestRunner.runWorkers(TestRunner.java:678)
       at org.testng.TestRunner.privateRun(TestRunner.java:624)
       at org.testng.TestRunner.run(TestRunner.java:495)
       at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
       at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
       at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
       at org.testng.SuiteRunner.run(SuiteRunner.java:190)
       at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
       at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
       at org.testng.TestNG.run(TestNG.java:699)
       at org.testng.TestNG.privateMain(TestNG.java:824)
       at org.testng.TestNG.main(TestNG.java:802)
      Caused by: java.lang.AbstractMethodError: org.jboss.aop.microcontainer.integration.AOPJoinpointFacto
      ryBuilder.createJoinpointFactory(Lorg/jboss/reflect/spi/ClassInfo;Lorg/jboss/repository/spi/MetaData
      Context;)Lorg/jboss/joinpoint/spi/JoinpointFactory;
       at org.jboss.classadapter.plugins.BasicClassAdapter.getJoinpointFactory(BasicClassAdapter.java:85)
       at org.jboss.beans.info.plugins.AbstractBeanInfo.getJoinpointFactory(AbstractBeanInfo.java:140)
       at org.jboss.kernel.plugins.config.Configurator.findConstructor(Configurator.java:210)
       at org.jboss.kernel.plugins.config.Configurator.getConstructorJoinPoint(Configurator.java:194)
       at org.jboss.kernel.plugins.config.Configurator.instantiate(Configurator.java:92)
       at org.jboss.kernel.plugins.config.Configurator.instantiateAndConfigure(Configurator.java:68)
       at org.jboss.kernel.plugins.config.property.PropertyKernelConfig.getImplementation(PropertyKernelCo
      nfig.java:149)
       at org.jboss.kernel.plugins.config.property.PropertyKernelConfig.createKernelInitializer(PropertyKe
      rnelConfig.java:117)
       at org.jboss.kernel.KernelFactory.createKernelInitializer(KernelFactory.java:150)
       ... 32 more
      
      


        • 1. Re: Trouble Getting the Most Basic SeamTest to Work
          neilac333 Novice

          By the way, I am using Seam 2.0 CR 2 with TestNG 5.6 and Ant 1.7.

          Thanks.

          • 2. Re: Trouble Getting the Most Basic SeamTest to Work
            neilac333 Novice

            I have moved to CR3 and based on the Wiki example have reconfigured my classpath to load libraries in a special order. Here is the classpath, which I hope is self-explanatory:

            <path id="seam.test.class.path.libs">
             <fileset dir="${seam-hibernate.lib.dir}/bootstrap" />
             <fileset dir="${seam-hibernate.lib.dir}" includes="jboss-embedded-all.jar,thirdparty-all.jar"/>
             <fileset dir="${sun-jsf.lib.dir}"/>
             <fileset dir="${commons.lib.dir}"/>
             <fileset dir="${seam-hibernate.lib.dir}" excludes="jboss-container.jar,hibernate*,jboss-seam.jar"/>
             <fileset dir="${seam-hibernate.lib.dir}" includes="hibernate*,jboss-archive-browsing.jar"/>
             <fileset dir="${seam-hibernate.lib.dir}" includes="jboss-seam.jar"/>
            </path>
            


            I get this exception, which I can probably figure out on my own:

            org.jboss.deployers.spi.DeploymentException: Unable to find bootstrap file: conf/bootstrap-beans.xml in classpath
             at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:200)
             at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:214)
             at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:11)
             at org.jboss.seam.mock.BaseSeamTest.startJbossEmbeddedIfNecessary(BaseSeamTest.java:1006)
             at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:931)
             at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
             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:585)
             at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
             at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:394)
             at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
             at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
             at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:165)
             at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
             at org.testng.TestRunner.runWorkers(TestRunner.java:678)
             at org.testng.TestRunner.privateRun(TestRunner.java:624)
             at org.testng.TestRunner.run(TestRunner.java:495)
             at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
             at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
             at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
             at org.testng.SuiteRunner.run(SuiteRunner.java:190)
             at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
             at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
             at org.testng.TestNG.run(TestNG.java:699)
             at org.testng.TestNG.privateMain(TestNG.java:824)
             at org.testng.TestNG.main(TestNG.java:802)
            


            Now certain JARs in the Ant script in the example, like jboss-embedded-all.jar, are not found in the CR3 distribution. So I really need an idea as to what JARs/bootstrap files I need and in what order I need to load them.

            And I thought out-of-container testing was supposed to be easy!

            • 3. Re: Trouble Getting the Most Basic SeamTest to Work
              Pete Muir Master

              I would use seam-gen to build an example application and base your classpath on the one it generates. It works ootb.

              • 4. Re: Trouble Getting the Most Basic SeamTest to Work
                neilac333 Novice

                I was actually going to try that next, but I somehow managed to get the test to work. Here is the classpath I got in my Ant script to get things to work:

                <path id="seam.test.class.path.libs">
                 <pathelement path="${seam-hibernate.lib.dir}/bootstrap" />
                 <fileset dir="${seam-hibernate.lib.dir}" includes="jboss-embedded-all.jar,thirdparty-all.jar"/>
                 <fileset dir="${sun-jsf.lib.dir}"/>
                 <fileset dir="${commons.lib.dir}"/>
                 <fileset dir="${seam-hibernate.lib.dir}" excludes="jboss-container.jar,hibernate*,jboss-seam.jar"/>
                 <fileset dir="${seam-hibernate.lib.dir}" includes="hibernate*,jboss-archive-browsing.jar"/>
                 <fileset dir="${seam-hibernate.lib.dir}" includes="jboss-seam.jar"/>
                </path>
                


                ...where seam-hibernate.lib.dir is the lib directory that comes with Seam.

                I based this on the wiki sample which I believe you wrote, Pete. I don't know why it works, but it works.

                Now I am having another issue regarding DBUnit in my test that I may have to post later.

                Anyway, thanks for your help. And congrats to you and the guys on Seam 2.0 GA.



                • 5. Re: Trouble Getting the Most Basic SeamTest to Work
                  Pete Muir Master

                  All credit for the wiki goes to Christian :)

                  The ordering of the classpath is tricky for testing atm - I'm going to spend some time working with Ales Justin next week on related issues.