8 Replies Latest reply on Nov 5, 2007 8:52 AM by Pete Muir

    NoClassDefFoundError with SeamTest

    neilac333 Novice

      I am running TestNG 5.6 in Ant 1.7 and using SeamTest in Seam 2.0 CR 2. When I run the test, I get this:

      java.lang.NoClassDefFoundError
       at org.apache.log4j.Logger.getLogger(Logger.java:104)
       at org.jboss.seam.log.Log4JProvider.<init>(Log4JProvider.java:31)
       at org.jboss.seam.log.Logging.getLogProvider(Logging.java:43)
       at org.jboss.seam.log.Logging.getLogProvider(Logging.java:50)
       at org.jboss.seam.contexts.ServletLifecycle.<clinit>(ServletLifecycle.java:33)
       at org.jboss.seam.mock.BaseSeamTest.begin(BaseSeamTest.java:881)
       at org.jboss.seam.mock.SeamTest.begin(SeamTest.java:28)
       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.invokeMethod(Invoker.java:421)
       at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:564)
       at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:830)
       at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
       at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
       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)
      


      Without a mention of the class that is missing in the stack trace, I have no idea what dependency I am missing. Currently, I have all the Seam JARs as well as those for JSF and Jakarta Commons.

      Any insight is appreciated.

      Thanks.

        • 1. Re: NoClassDefFoundError with SeamTest
          Pete Muir Master

          log4j I think which is in thirdparty-all.jar

          • 2. Re: NoClassDefFoundError with SeamTest
            neilac333 Novice

            I am currently at home, so I can't check this until I get to the office. But I would think I must have log4j in the classpath already given that the offending method call is at line 104 of Logger.java, which is included in log4j. Besides, I am pretty sure I have thirdparty-all.jar on my classpath.

            Nevertheless, I will explore more tomorrow. Thanks, Pete.

            • 3. Re: NoClassDefFoundError with SeamTest
              neilac333 Novice

              I have indeed confirmed that I have thirdparty-all.jar on my classpath and that it does contain log4j within.

              I have all the Seam JARs included with the CR2 distribution on my classpath.

              Any other ideas?

              Thanks.

              • 4. Re: NoClassDefFoundError with SeamTest
                neilac333 Novice

                So I completely purged my test method of all meaningful code. The only line in the test method is this:

                Assert.assertTrue(true);
                


                And then I got I got a completely strange 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.AOPJoinpointFactoryBuilder.createJoinpointFactory(Lorg/jboss/reflect/spi/ClassInfo;Lorg/jboss/repository/spi/MetaDataContext;)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(PropertyKernelConfig.java:149)
                 at org.jboss.kernel.plugins.config.property.PropertyKernelConfig.createKernelInitializer(PropertyKernelConfig.java:117)
                 at org.jboss.kernel.KernelFactory.createKernelInitializer(KernelFactory.java:150)
                 ... 32 more
                


                What the heck is that???


                • 5. Re: NoClassDefFoundError with SeamTest
                  neilac333 Novice

                  Maybe the better question is which JARs are necessary for SeamTest to work. I have included everything that comes with Seam CR2 as well as all the JSF and Hibernate libraries.

                  Right now a mere empty test is failing.

                  Thanks.

                  • 6. Re: NoClassDefFoundError with SeamTest
                    neilac333 Novice

                    I read in Michael Yuan's book that I need configuration files like components.xml in the classpath. That could be an idea, but much of the stuff in the book is outdated (through no fault of Michael's)--particularly in the area of configuration. Right now I have no config files in my classpath. Do I need to?

                    Incidentally, here is a Windows dir listing of the jars in my classpath:

                    10/05/2007 09:25 AM 62,983 activation.jar
                    10/05/2007 09:25 AM 443,432 antlr.jar
                    10/05/2007 09:25 AM 282,338 cglib.jar
                    10/05/2007 09:25 AM 303,207 dom4j.jar
                    10/05/2007 09:25 AM 32,941 ejb-api.jar
                    09/18/2007 12:53 PM 278,920 gwt-servlet.jar
                    09/18/2007 12:53 PM 2,719,460 hibernate-all.jar
                    10/05/2007 09:25 AM 265,130 hibernate-annotations.jar
                    10/05/2007 09:25 AM 66,426 hibernate-commons-annotations.jar
                    10/05/2007 09:25 AM 116,544 hibernate-entitymanager.jar
                    10/05/2007 09:25 AM 192,762 hibernate-search.jar
                    10/05/2007 09:25 AM 60,992 hibernate-validator.jar
                    10/05/2007 09:25 AM 1,138,709 itext.jar
                    10/05/2007 09:25 AM 459,663 javassist.jar
                    10/05/2007 09:25 AM 73,081 jaxb-api.jar
                    10/05/2007 09:25 AM 23,618 jaxws-api.jar
                    10/05/2007 09:25 AM 896,119 jboss-aop.jar
                    09/18/2007 12:53 PM 12,539 jboss-archive-browsing.jar
                    10/05/2007 09:25 AM 706,964 jboss-cache.jar
                    10/05/2007 09:25 AM 419,324 jboss-common-core.jar
                    10/05/2007 09:25 AM 356,776 jboss-container.jar
                    10/05/2007 09:25 AM 20,853 jboss-dependency.jar
                    10/05/2007 09:25 AM 155,835 jboss-deployers.jar
                    09/24/2007 03:02 PM 8,210,655 jboss-ejb3-all.jar
                    10/05/2007 09:25 AM 133,966 jboss-el.jar
                    09/18/2007 12:53 PM 13,655,643 jboss-embedded-all.jar
                    10/05/2007 09:25 AM 52,286 jboss-embedded-api.jar
                    10/05/2007 09:25 AM 328,656 jboss-kernel.jar
                    10/05/2007 09:25 AM 7,740 jboss-logging-spi.jar
                    10/05/2007 09:25 AM 11,603 jboss-seam-debug.jar
                    09/18/2007 12:53 PM 6,107 jboss-seam-gen.jar
                    10/05/2007 09:25 AM 65,238 jboss-seam-ioc.jar
                    10/05/2007 09:25 AM 25,915 jboss-seam-mail.jar
                    10/05/2007 09:25 AM 78,883 jboss-seam-pdf.jar
                    10/05/2007 09:25 AM 96,312 jboss-seam-remoting.jar
                    10/05/2007 09:25 AM 209,671 jboss-seam-ui.jar
                    10/05/2007 09:25 AM 827,444 jboss-seam.jar
                    10/05/2007 09:25 AM 266,749 jboss-system.jar
                    10/05/2007 09:25 AM 658,168 jbpm-jpdl.jar
                    10/05/2007 09:25 AM 306,089 jcommon.jar
                    10/05/2007 09:25 AM 1,184,816 jfreechart.jar
                    10/09/2007 04:24 PM 8,812 jta.jar
                    09/18/2007 12:53 PM 538,618 lucene-core-2.2.0.jar
                    09/18/2007 12:53 PM 13,737 mail-ra.jar
                    09/18/2007 12:53 PM 387,690 mail.jar
                    10/09/2007 04:24 PM 52,150 persistence-api.jar
                    09/18/2007 12:53 PM 5,590,165 thirdparty-all.jar
                    10/09/2007 04:24 PM 29,309 el-api.jar
                    10/09/2007 04:24 PM 97,471 el-ri.jar
                    10/09/2007 04:24 PM 323,012 jsf-api.jar
                    10/09/2007 04:24 PM 1,210,046 jsf-impl.jar
                    10/09/2007 04:24 PM 20,801 jstl.jar
                    09/26/2007 04:37 PM 97,523 servlet-api.jar
                    09/24/2007 03:02 PM 188,671 commons-beanutils.jar
                    09/24/2007 03:02 PM 571,259 commons-collections.jar
                    09/24/2007 03:02 PM 109,096 commons-digester.jar
                    09/24/2007 03:02 PM 71,442 commons-discovery.jar
                    09/24/2007 03:02 PM 112,341 commons-el.jar
                    09/24/2007 03:02 PM 53,082 commons-fileupload.jar
                    09/24/2007 03:02 PM 245,274 commons-lang.jar
                    09/24/2007 03:02 PM 44,598 commons-logging-api.jar
                    09/24/2007 03:02 PM 52,915 commons-logging.jar
                    
                    


                    Thanks for any insight.

                    • 7. Re: NoClassDefFoundError with SeamTest
                      neilac333 Novice

                      Perhaps I should also mention that I am running a straight TestNG unit test with the virtually "empty" test I mentioned above. There is no integration with a simulated FacesContext or anything like that. The test runs fine when I extend Object, but it bombs when I extend SeamTest.

                      Just to let you know in case that affects anything.

                      Thanks.

                      • 8. Re: NoClassDefFoundError with SeamTest
                        Pete Muir Master

                        The ordering of your classpath for tests is important. How are you building the project? What is the actual classpath in use? Your listing above is just the output of ls.