Using the Fedora 20 provided FindBugs package (version 2.0.3), trying to run the FindBugs via the Ant task gives me a ClassNotFound exception for org.apache.bcel.classfile.ClassFormatException. Running things under strace shows that the process successfully opened the file /usr/share/java/findbugs-bcel-20130910svn1521566.jar, so I don't see where the problem is coming from.
More information can be found at this StackOverflow question.
FindBugs2 is the first class loaded by the ant task from findbugs.jar and this class triggers loading of the org.apache.bcel.classfile.ClassFormatException class which must be on findbugs.jar classpath (see MANIFEST.MF). Most likely the MANIFEST.MF doesn't point to the right bcel library location on fedora.
Would you please give here an overview of the fedora's directory layout for findbugs related directories & jars?
I can't make a picture what resides where.
If everything used by FB is under /usr/share/java/ (including findbugs.jar?), why do you need to create /usr/share/findbugs/lib link? Why not just set FB home to /usr/share/java/?
So basically: which jars are where?
Can you also please provide the MANIFEST.MF file from findbugs.jar you use (I guess you generate it for fedora with different entries as the default provided by FB)?
BTW if you specify "debug=true" for the FB task, does it give more insights what happens?
BTW, is the org.apache.bcel.classfile.ClassFormatException class inside /usr/share/java/findbugs-bcel-20130910svn1521566.jar?
Regards,
Andrey
All of the Jar files are in
/usr/share/java, while everything else (theetcandpluginsdirectory) are in/usr/share/findbugs.Using
jarto extract all the file, I get this for the manifest file:Yes, it is.
Ok, the manifest is wrong - it has no classpath attribute.
See http://code.google.com/p/findbugs/source/browse/findbugs/etc/MANIFEST-findbugs.MF for the expected content. The libraries will be resolved relative to the findbugs.jar location. In your case some libraries might also have different names, like the bcel library.
Thanks. I've filed a bug report with Red Hat repeating what you've said, if you're interested.
Have you confirmed (by manually fixing the jar) if the fixed manifest helps? I do not have fedora so I can't judge if the manifest patch is the only place where fedora's FB code differs from original.
According to the [1] the problem is in the way how FB is packaged in fedora. Proposed workaround:
<findbugs classpath="/usr/share/java/findbugs.jar:/usr/share/java/ant/ant-findbugs.jar:/usr/share/java/apache-commons-lang.jar:/usr/share/java/dom4j.jar:/usr/share/java/findbugs-bcel.jar:/usr/share/java/jaxen.jar:/usr/share/java/jcip-annotations.jar:/usr/share/java/jFormatString.jar:/usr/share/java/jsr-305.jar:/usr/share/java/junit.jar:/usr/share/java/objectweb-asm/asm.jar:/usr/share/java/objectweb-asm/asm-commons.jar:/usr/share/java/objectweb-asm/asm-tree.jar"></findbugs>
where that classpath is the output from:
$ build-classpath
cat /etc/ant.d/findbugs[1] https://bugzilla.redhat.com/show_bug.cgi?id=1080682#c4
Closing as not findbugs issue.