Menu

Embedding NodeFilter in jar: NoClassDefFoundE

Help
2006-01-13
2013-04-27
  • Gerhard Olsson

    Gerhard Olsson - 2006-01-13

    I try to use htmlparser embedded in a jar (without main()), that is loaded by another jar. However, if I include any class derived from NodeFilter, the main program cannot load the jar unless I decomment all NodeFilter related calls. (not much left)

    The only I can interpret from the message is that NodeFilter requires a main class since it is an interface, but that seems odd.

    Any hints?

    Gerhard

    (I try to use htmlparser in the searchengine regain.sf.net. I am not the author, but will try to get the author accept a real parser.)

            at net.sf.regain.crawler.document.DocumentFactory.<init>(Unknown Source)
            at net.sf.regain.crawler.IndexWriterManager.<init>(Unknown Source)
            at net.sf.regain.crawler.Crawler.run(Unknown Source)
            at net.sf.regain.crawler.Main.main(Unknown Source)
    Caused by: net.sf.regain.RegainException: Loading preparator file 'preparator/Ht
    mlPreparator.jar' failed
            at net.sf.regain.crawler.document.PreparatorFactory.loadPrepararorJar(Un
    known Source)
            at net.sf.regain.crawler.document.PreparatorFactory.createPreparatorArr(
    Unknown Source)
            ... 4 more
    Caused by: java.lang.NoClassDefFoundError: org/htmlparser/NodeFilter
            at java.lang.Class.getDeclaredConstructors0(Native Method)
            at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
            at java.lang.Class.getConstructor0(Class.java:2640)
            at java.lang.Class.newInstance0(Class.java:321)
            at java.lang.Class.newInstance(Class.java:303)
            at net.sf.regain.RegainToolkit.createClassInstance(Unknown Source)
            ... 6 more

     
    • Gerhard Olsson

      Gerhard Olsson - 2006-01-13

      The best way to find your own stupid problems are to post them in public.

      I had not updated the ant buildfile properly, so the libraries were not included in the jar. For some reason I did not get the same message for other included jars.

            <fileset dir="temp/included-lib-classes/common">                         
              <include name="org/htmlparser/**"/>                                    
            </fileset>                                                

       

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.