Menu

NoClassDefFoundError

Help
2008-11-11
2013-04-29
  • Jean-Claude Cote

    Hi,

    When the autosuite scans a bundle/plugin for test classes it loads every class in the plugin's classpath. It event loads classes that are in third party jars that might be in the plugin.

    Sometimes autosuite will encounter .class files which can't be loaded (NoClassDefFoundError) org/apache/log4j/Category.

    I know this is caused by a third party jar I'm using that requires this class but the use I make of this third party jar does not trigger access to all the jars in this third party jar so all is ok.

    However when autosuite scans this third party jar it loads every single class trying to see if it fits the regex for a test case.

    I think autosuite should just continue if it encounters a class that it cannot define from a third party jar. I don't think it is autosuite's responsibility to validate the .class files.

    What do you think?

     
    • Markus Barchfeld

      This should be fixed in Head. Please try a nightly from http://autotestsuite.pluginbuilder.org/. You should see an entry "Bundle could not load class: " in the log for those classes.

      Thanks for the report. Please let me know if the nightly works for you.

       
      • Jean-Claude Cote

        actually I downloaded the latest code and saw the checks for classnotfound and noclassdef but I think it should just catch the throwable. The scanning will fail if IllegalAccessError are thrown. There was another one as well but I forget.

        Anyways I changed the code to catch throwable and it fix my issues with it. I think you should just catch throwable since it you have problems defining a class you just want to continue with the other ones.

        BTW: thanks for developing pluginbuilder and autosuite I like these tools very much.

         
        • Markus Barchfeld

          Good to hear that you could fix the issue. Did you also add your test case to org.pluginbuilder.autotestsuite.tests? I would be interested in both a test scenario for your case and the fix (I guess in TestClassScanner). If you want to send it, simply zip the plugin or create a patch against svn trunk and send it to me.
          thanks
          Markus

           

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.