5 Replies Latest reply on Jun 28, 2006 12:08 PM by Kabir Khan

    AOP precompiled tests - NoClassDefFoundErrors

    Rajesh Rajasekaran Newbie

      I am getting NoClassDefFoundError errors for the precompiled-tests and precompiled-genadvisor-tests on linux.
      I have the test classes compiled under output/tests.classes
      The classpath in the build.xml also looks fine.
      Am I missing something here when running the tests?
      This is the error for all the precompiled tests.

      _run-precompiled-test:
      [echo] Compiling implementz with optimized=false and instrumentor org.jboss.aop.instrument.ClassicInstrumentor
      [aopc] Build Successful: 1721 ms
      [junit] Running org.jboss.test.aop.implementz.ImplementsTester
      [junit] Exception in thread "main" java.lang.NoClassDefFoundError:


      FROM KABIR....
      Changing the name of the test itself to something weird does not cause that problem

      [delete] Deleting directory C:\cygwin\home\Kabir\cvs\jboss-head\aop\output\tests.classes\org\jboss\test\aop\jdk15\dynamic\common\scenario
      [junit] Running org.jboss.test.aop.jdk15.AOPTesterXXX
      [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
      [junit] Test org.jboss.test.aop.jdk15.AOPTesterXXX FAILED

      Now, the main difference between the precompiled tests and the loadtime tests, is that

      -for the loadtime ones
      no precompilation
      at runtime, we load up the test from aop/output/tests.classes, and it is woven at loadtime when the class is first loaded

      -for the precompiled ones
      during preinstrumentation we load up the class from aop/output/tests.classes, do the weaving and then write it back to its original location
      at runtime, we use the woven classes from aop/tests.classes

      Normally the test class itself is not woven at all (apart from the few tests using "call" pointcuts), so I think that would explain why a bogus test class name does not cause the error. It would seem that it can not find the classes used by the test class

      Could it be that when using javassist to weave the class at precompile time, when writing it out, the woven class gets the wrong file permissions or something?

        • 1. Re: AOP precompiled tests - NoClassDefFoundErrors
          Kabir Khan Master

          I'm not able to try this out since I am not on linux. Can you try putting some printlns in the code to see if it is finding the test class, or if it is not finding something else?

          If you download the distribution are you able to run the examples under docs/aspect-framework? They use loadtime aop

          • 3. Re: AOP precompiled tests - NoClassDefFoundErrors
            Rajesh Rajasekaran Newbie

            I just tried running a few xml and annotation examples under aspects-framework. I had no problems. was able to run them. Havent tried debugging more on this.

            • 4. Re: AOP precompiled tests - NoClassDefFoundErrors
              Kabir Khan Master

              I too created a dist from head, and tried out the examples which work on a friend's Linux box, so at least there should be no problems with the 1.5.0 release coming out today.

              I'm trying to connect to the QA lab, once I get access to that I will investigate further there.

              • 5. Re: AOP precompiled tests - NoClassDefFoundErrors
                Kabir Khan Master

                I've tried this out on linux and I don't get why it's not working. An

                $ant -verbose precompiled-tests

                yields:

                 [aopc] The ' characters around the executable and arguments are
                 [aopc] not part of the command.
                 [aopc] Build Successful: 4494 ms
                Property ${aop.xml} has not been set
                Property ${exclude} has not been set
                 [junit] Implicitly adding /home/kkhan/jboss-head/tools/lib/junit.jar:/home/kkhan/jboss-head/tools/lib/ant-launcher.jar:/home/kkhan/jboss-head/tools/lib/ant.jar:/home/kkhan/jboss-head/tools/lib/ant-junit.jar to CLASSPATH
                 [junit] Running org.jboss.test.aop.basic.AOPTester
                 [junit] Executing '/usr/java/j2sdk1.4.2_05/jre/bin/java' with arguments:
                 [junit] '-Djboss.aop.path=/home/kkhan/jboss-head/aop/src/resources/test/basic/jboss-aop.xml'
                 [junit] ''
                 [junit] '-classpath'
                 [junit] '/home/kkhan/jboss-head/thirdparty/qdox/lib/qdox.jar:/home/kkhan/jboss-head/thirdparty/javassist/lib/javassist.jar:/home/kkhan/jboss-head/thirdparty/trove/lib/trove.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-xjavadoc-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-xdoclet-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-web-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-jdo-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-jboss-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-java-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-ejb-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-bea-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-jmx-module-jb4.jar:/home/kkhan/jboss-head/tools/lib/ant.jar:/home/kkhan/jboss-head/thirdparty/oswego-concurrent/lib/concurrent.jar:/home/kkhan/jboss-head/thirdparty/junit/lib/junit.jar:/home/kkhan/jboss-head/thirdparty/jboss/profiler/jvmti/lib/jboss-profiler-jvmti.jar:/home/kkhan/jboss-head/thirdparty/jboss/microcontainer/lib/jboss-container.jar:/home/kkhan/jboss-head/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar:/home/kkhan/jboss-head/thirdparty/jboss/microcontainer/lib/jboss-microcontainer.jar:/home/kkhan/jboss-head/thirdparty/jboss/common/lib/namespace.jar:/home/kkhan/jboss-head/thirdparty/jboss/common/lib/jboss-common.jar:/home/kkhan/jboss-head/thirdparty/jboss/common/lib/jboss-archive-browsing.jar:/home/kkhan/jboss-head/aop/output/lib/jboss-aop.jar:/home/kkhan/jboss-head/aop/output/tests.classes:/home/kkhan/jboss-head/aop/docs:/home/kkhan/jboss-head/tools/lib/junit.jar:/home/kkhan/jboss-head/tools/lib/ant-launcher.jar:/home/kkhan/jboss-head/tools/lib/ant-junit.jar'
                 [junit] 'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
                 [junit] 'org.jboss.test.aop.basic.AOPTester'
                 [junit] 'filtertrace=true'
                 [junit] 'haltOnError=false'
                 [junit] 'haltOnFailure=false'
                 [junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
                 [junit] 'showoutput=false'
                 [junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter,/home/kkhan/jboss-head/aop/output/reports/TEST-org.jboss.test.aop.basic.AOPTester-precompiled-tests.txt'
                 [junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,/home/kkhan/jboss-head/aop/output/reports/TEST-org.jboss.test.aop.basic.AOPTester-precompiled-tests.xml'
                 [junit] 'propsfile=/home/kkhan/jboss-head/aop/junit538469726.properties'
                 [junit]
                 [junit] The ' characters around the executable and arguments are
                 [junit] not part of the command.
                 [junit] Exception in thread "main" java.lang.NoClassDefFoundError:
                 [junit] Test org.jboss.test.aop.basic.AOPTester FAILED
                 [antcall] Exiting /home/kkhan/jboss-head/aop/build.xml.
                



                Now taking this and executing the same directly from the command line works:
                [kkhan@dev02 aop]$ /usr/java/j2sdk1.4.2_05/jre/bin/java -Djboss.aop.path=/home/kkhan/jboss-head/aop/src/resources/test/basic/jboss-aop.xml -classpath /home/kkhan/jboss-head/thirdparty/qdox/lib/qdox.jar:/home/kkhan/jboss-head/thirdparty/javassist/lib/javassist.jar:/home/kkhan/jboss-head/thirdparty/trove/lib/trove.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-xjavadoc-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-xdoclet-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-web-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-jdo-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-jboss-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-java-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-ejb-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-bea-module-jb4.jar:/home/kkhan/jboss-head/thirdparty/xdoclet/lib/xdoclet-jmx-module-jb4.jar:/home/kkhan/jboss-head/tools/lib/ant.jar:/home/kkhan/jboss-head/thirdparty/oswego-concurrent/lib/concurrent.jar:/home/kkhan/jboss-head/thirdparty/junit/lib/junit.jar:/home/kkhan/jboss-head/thirdparty/jboss/profiler/jvmti/lib/jboss-profiler-jvmti.jar:/home/kkhan/jboss-head/thirdparty/jboss/microcontainer/lib/jboss-container.jar:/home/kkhan/jboss-head/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar:/home/kkhan/jboss-head/thirdparty/jboss/microcontainer/lib/jboss-microcontainer.jar:/home/kkhan/jboss-head/thirdparty/jboss/common/lib/namespace.jar:/home/kkhan/jboss-head/thirdparty/jboss/common/lib/jboss-common.jar:/home/kkhan/jboss-head/thirdparty/jboss/common/lib/jboss-archive-browsing.jar:/home/kkhan/jboss-head/aop/output/lib/jboss-aop.jar:/home/kkhan/jboss-head/aop/output/tests.classes:/home/kkhan/jboss-head/aop/docs:/home/kkhan/jboss-head/tools/lib/junit.jar:/home/kkhan/jboss-head/tools/lib/ant-launcher.jar:/home/kkhan/jboss-head/tools/lib/ant-junit.jar org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner org.jboss.test.aop.basic.AOPTester filtertrace=true haltOnError=false haltOnFailure=false formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter showoutput=false formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter,/home/kkhan/jboss-head/aop/output/reports/TEST-org.jboss.test.aop.basic.AOPTester-precompiled-tests.txt formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,/home/kkhan/jboss-head/aop/output/reports/TEST-org.jboss.test.aop.basic.AOPTester-precompiled-testsasnaknsknasnak.xml Tests run: 20, Failures: 0, Errors: 0, Time elapsed: 1.721 sec