11 Replies Latest reply on Apr 25, 2008 5:45 AM by jamesl

    Exception running the tests in the bundled examples

    dam

      Running ant test on any of the examples e.g. booking throws exceptions at me.


      test:
         [testng] [Parser] Running:
         [testng]   C:\java\jboss-seam-2.0.1.GA\examples\booking\src\org\jboss\seam\example\booking\test\testng.xml
         [testng] 
         [testng] ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Described: name=BeanDeployer state=PreInstall
         [testng] java.lang.RuntimeException: java.lang.reflect.UndeclaredThrowableException
         [testng]      at org.jboss.aop.util.ClassInfoMethodHashing.methodHash(ClassInfoMethodHashing.java:70)
         [testng]      at org.jboss.aop.util.ClassInfoMethodHashing.addDeclaredMethods(ClassInfoMethodHashing.java:169)
         [testng]      at org.jboss.aop.util.ClassInfoMethodHashing.populateMethodTables(ClassInfoMethodHashing.java:182)
      



      Anyone know why?


      I'm using


      java 1.6.0, Apache Ant 1.7.0, seam 2.0.1.GA


        • 1. Re: Exception running the tests in the bundled examples
          dam

          I was using JDK 6. Using JDK 5 I can now run the tests.


          It is however stated in the documenation at


          2.0.1.GA reference


          that I could use JDK6, which is very confusing.


          Now I however have a new problem running tests on a new project created with the seam generator.


          The exception is


          test:
             [testng] [Parser] Running:
             [testng]   C:\Aragost\Workspace\test\test-build\HelloTest.xml
             [testng] 
             [testng] FAILED CONFIGURATION: @BeforeClass init
             [testng] java.lang.NoClassDefFoundError: org/jboss/beans/metadata/spi/BeanMetaData
             [testng]      at java.lang.Class.forName0(Native Method)
             [testng]      at java.lang.Class.forName(Unknown Source)
             [testng]      at org.jboss.seam.mock.BaseSeamTest.embeddedJBossAvailable(BaseSeamTest.java:1051)
             [testng]      at org.jboss.seam.mock.BaseSeamTest.startJbossEmbeddedIfNecessary(BaseSeamTest.java:1039)
             [testng]      at org.jboss.seam.mock.BaseSeamTest.startSeam(BaseSeamTest.java:935)
             [testng]      at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:923)
             [testng]      at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
             [testng] Caused by: java.lang.ClassNotFoundException: org.jboss.beans.metadata.spi.BeanMetaData
             [testng]      at java.net.URLClassLoader$1.run(Unknown Source)
             [testng]      at java.security.AccessController.doPrivileged(Native Method)
             [testng]      at java.net.URLClassLoader.findClass(Unknown Source)
             [testng]      at java.lang.ClassLoader.loadClass(Unknown Source)
             [testng]      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
             [testng]      at java.lang.ClassLoader.loadClass(Unknown Source)
             [testng]      at java.lang.ClassLoader.loadClassInternal(Unknown Source)
             [testng]      ... 29 more
             [testng] ... Removed 22 stack frames
             [testng] SKIPPED CONFIGURATION: @BeforeMethod begin
             [testng] SKIPPED CONFIGURATION: @AfterMethod end
             [testng] SKIPPED CONFIGURATION: @AfterClass cleanup
             [testng] SKIPPED: test
             [testng] 
             [testng] ===============================================
             [testng]     Hello Test
             [testng]     Tests run: 1, Failures: 0, Skips: 1
             [testng]     Configuration Failures: 1, Skips: 3
             [testng] ===============================================
             [testng] 
             [testng] 
             [testng] ===============================================
             [testng] Hello Tests
             [testng] Total tests run: 1, Failures: 0, Skips: 1
             [testng] Configuration Failures: 1, Skips: 3
             [testng] ===============================================
             [testng] 
          
          BUILD SUCCESSFUL
          Total time: 0 seconds
          



          What can I do so the class is found?



          • 2. Re: Exception running the tests in the bundled examples

            I think Seam can run on jdk5, but embedded jboss must be running on jdk5.


            http://docs.jboss.com/seam/latest/reference/en/html/configuration.html



            25.5.1. Installing Embedded JBoss

            Embedded JBoss must by installed into Tomcat for Seam applications to run correctly on it. Embedded JBoss only runs on JDK 1.5 (not JDK 1.6). Embedded JBoss can be downloaded here. The process for installing Embedded JBoss into Tomcat 6 is quite simple. First, you should copy the Embedded JBoss JARs and configuration files into Tomcat.

            The test suit might use embedded jboss?

            • 3. Re: Exception running the tests in the bundled examples

              Edit: I think Seam can run on jdk6, but embedded jboss must be running on jdk5.

              • 4. Re: Exception running the tests in the bundled examples
                dam

                On JDK 6 I could run all the examples on the server. The only thing I couldn't was run the tests.


                What I don't get is that after changing to JDK5, the tests in the bundled examples work, but when I create a new project with the seam generator and create a action with the generator and run the test it gives me the exception above.

                • 5. Re: Exception running the tests in the bundled examples
                  dam

                  Jars from the lib/test was not included, by the build script generated by seam, when testing. So the information in the documentation



                  If you used seam-gen to create your project you are ready to start writing tests.

                  or the seam gen needs to be altered.


                  Is no one using this script? Or just not testing? Or just not reading this post:) Since everybody would have changed this.

                  • 6. Re: Exception running the tests in the bundled examples
                    pmuir

                    They most certainly are in Seam 2.0.1.GA (which you say you are running).

                    • 7. Re: Exception running the tests in the bundled examples
                      dam

                      As mentioned before I get


                      java.lang.NoClassDefFoundError: org/jboss/beans/metadata/spi/BeanMetaData
                      



                      when running ant test. Fixed it by including the jars in the build script when running the target.

                      • 8. Re: Exception running the tests in the bundled examples
                        bk8133.info.jua.si

                        Running 

                        ant test

                        might fail with exceptions like 'class not found' if you are running an existing instance of  jboss server in the background.. So you might want to check that out..
                           with best regards,

                        • 9. Re: Exception running the tests in the bundled examples
                          jamesl

                          @Jakob,


                          Could you tell us the changes you made in the build script, so we can do the same to overcome the error?

                          • 10. Re: Exception running the tests in the bundled examples
                            jamesl

                            I added the following in the build.xml file after the path setup for  build.classpath



                            <path id="test.classpath">
                                <fileset id="lib.test" dir="${lib.dir}/test">
                                    <include name="*.jar" />
                                </fileset>
                            </path>
                            



                            At the 'test' target I added the following entry to the class path entries for testng:



                            <classpath refid="test.classpath" />




                            Running 'ant test' then has the following error:


                            test:
                               [testng] [Parser] Running:
                               [testng]   <snip>\test_seam\test-build\ExampleTest.xml
                               [testng]
                               [testng] ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=JMXKernel state=Cre
                            ate
                               [testng] java.lang.NoSuchMethodError: org.jboss.system.ServiceController.setKernel(Lorg/jboss/kernel/Kernel;)V
                               [testng]     at org.jboss.embedded.adapters.JMXKernel.start(JMXKernel.java:164)
                               [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                               [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                               [testng]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                               [testng]     at java.lang.reflect.Method.invoke(Method.java:585)
                               [testng]     at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:56)
                               [testng]     at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:110)
                               [testng]     at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
                               [testng]     at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControll
                            erContextAction.java:214)
                               [testng]     at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:45)
                            <snipped>



                            Do I need to regenerate the project since changing back to JDK 1.5 ?


                            Has anyone else been able to test a seam-gen generated project?



                            • 11. Re: Exception running the tests in the bundled examples
                              jamesl

                              All is working now



                              Installed jboss-seam-2.0.2.CR1, created a project, created and action and ran 'ant test'.


                              I am also running jdk1.5.0-15


                              No modifications to build.xml required.