FAQ.html revision 489a0ec7301a86af8497d24748336db09ca278da
1<html>
2<head>
3<title>FindBugs FAQ</title>
4<link rel="stylesheet" type="text/css" href="findbugs.css">
5
6</head>
7
8<body>
9
10<table width="100%"><tr>
11
12
13<td bgcolor="#b9b9fe" valign="top" align="left" width="20%"> 
14<table width="100%" cellspacing="0" border="0"> 
15<tr><td><a class="sidebar" href="index.html"><img src="umdFindbugs.png" alt="FindBugs"></a></td></tr> 
16
17<tr><td>&nbsp;</td></tr>
18
19<tr><td><b>Docs and Info</b></td></tr> 
20<tr><td><font size="-1"><a class="sidebar" href="findbugs2.html">FindBugs 2.0</a></font></td></tr> 
21<tr><td><font size="-1"><a class="sidebar" href="demo.html">Demo and data</a></font></td></tr> 
22<tr><td><font size="-1"><a class="sidebar" href="users.html">Users and supporters</a></font></td></tr> 
23<tr><td><font size="-1"><a class="sidebar" href="http://findbugs.blogspot.com/">FindBugs blog</a></font></td></tr> 
24<tr><td><font size="-1"><a class="sidebar" href="factSheet.html">Fact sheet</a></font></td></tr> 
25<tr><td><font size="-1"><a class="sidebar" href="manual/index.html">Manual</a></font></td></tr> 
26<tr><td><font size="-1"><a class="sidebar" href="ja/manual/index.html">Manual(ja/&#26085;&#26412;&#35486;)</a></font></td></tr> 
27<tr><td><font size="-1"><a class="sidebar" href="FAQ.html">FAQ</a></font></td></tr> 
28<tr><td><font size="-1"><a class="sidebar" href="bugDescriptions.html">Bug descriptions</a></font></td></tr> 
29<tr><td><font size="-1"><a class="sidebar" href="mailingLists.html">Mailing lists</a></font></td></tr> 
30<tr><td><font size="-1"><a class="sidebar" href="publications.html">Documents and Publications</a></font></td></tr> 
31<tr><td><font size="-1"><a class="sidebar" href="links.html">Links</a></font></td></tr> 
32
33<tr><td>&nbsp;</td></tr>
34
35<tr><td><a class="sidebar" href="downloads.html"><b>Downloads</b></a></td></tr> 
36
37<tr><td>&nbsp;</td></tr>
38
39<tr><td><a class="sidebar" href="http://www.cafeshops.com/findbugs"><b>FindBugs Swag</b></a></td></tr>
40
41<tr><td>&nbsp;</td></tr>
42
43<tr><td><b>Development</b></td></tr> 
44<tr><td><font size="-1"><a class="sidebar" href="http://sourceforge.net/tracker/?group_id=96405">Open bugs</a></font></td></tr> 
45<tr><td><font size="-1"><a class="sidebar" href="reportingBugs.html">Reporting bugs</a></font></td></tr> 
46<tr><td><font size="-1"><a class="sidebar" href="contributing.html">Contributing</a></font></td></tr> 
47<tr><td><font size="-1"><a class="sidebar" href="team.html">Dev team</a></font></td></tr> 
48<tr><td><font size="-1"><a class="sidebar" href="api/index.html">API</a> <a class="sidebar" href="api/overview-summary.html">[no frames]</a></font></td></tr> 
49<tr><td><font size="-1"><a class="sidebar" href="Changes.html">Change log</a></font></td></tr> 
50<tr><td><font size="-1"><a class="sidebar" href="http://sourceforge.net/projects/findbugs">SF project page</a></font></td></tr> 
51<tr><td><font size="-1"><a class="sidebar" href="http://code.google.com/p/findbugs/source/browse/">Browse source</a></font></td></tr> 
52<tr><td><font size="-1"><a class="sidebar" href="http://code.google.com/p/findbugs/source/list">Latest code changes</a></font></td></tr> 
53</table> 
54</td>
55
56<td>
57<h1>FindBugs FAQ</h1>
58
59<p> This document contains answers to frequently asked questions about
60<a href="index.html">FindBugs</a>.&nbsp; If you just want general
61information about FindBugs, have a look at the
62<a href="factSheet.html">fact sheet</a> and the
63<a href="manual/index.html">manual</a>.
64
65<h2>Contents</h2>
66<ol>
67<li> <a href="#q1">I'm getting java.lang.UnsupportedClassVersionError when I try to run FindBugs</a>
68<li> <a href="#q2">When I click the "Find Bugs!" button, I get a NoSuchMethodError or VerifyError</a>
69<li> <a href="#q3">FindBugs is running out of memory, or is taking a long time to finish</a>
70<li> <a href="#q4">What is the "auxiliary classpath"?  Why should I specify it?</a>
71<li> <a href="#q5">The Eclipse plugin doesn't load</a>
72<li> <a href="#q6">I'm getting a lot of false "OS" and "ODR" warnings</a>
73<li> <a href="#q7">The Eclipse plugin loads, but doesn't work correctly</a>
74<li> <a href="#q8">Where is the Maven plugin for FindBugs?</a>
75<li> <a href="#q9">Where is the NetBeans plugin for FindBugs?</a>
76</ol>
77
78<h2><a name="q1">Q1: I'm getting java.lang.UnsupportedClassVersionError when I try to run FindBugs</a></h2>
79
80<p> FindBugs requires JRE 1.5.0 or later to run.&nbsp; If you use an earlier version,
81you will see an exception error message similar to the following:
82<pre>
83Exception in thread "main" java.lang.UnsupportedClassVersionError:
84edu/umd/cs/findbugs/gui/FindBugsFrame (Unsupported major.minor version 48.0)
85</pre>
86The solution is to upgrade to JRE 1.5.0 or later.
87
88<h2><a name="q2">Q2: When I click the "Find Bugs!" button, I get a NoSuchMethodError or VerifyError</a></h2>
89
90<p> The symptom of this bug is that when you start the FindBugs analysis,
91you see an exception similar to the following:
92<pre>
93java.lang.NoSuchMethodError: org.apache.bcel.Repository.setRepository(Lorg/apache/bcel/util/Repository;)V
94        at edu.umd.cs.findbugs.FindBugs.clearRepository(FindBugs.java:483)
95        ...
96</pre>
97
98or
99
100<pre>
101java.lang.VerifyError: Cannot inherit from final class
102    at java.lang.ClassLoader.defineClass0(Native Method)
103    at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
104    ...
105</pre>
106
107<p> The problem here is that the wrong version of the
108<a href="http://jakarta.apache.org/bcel/">Apache BCEL</a>
109library is being found.&nbsp; FindBugs requires its own
110version of BCEL, which normally will be used automatically
111when you invoke the <code>findbugs</code> or <code>findbugs.bat</code>
112scripts used to launch FindBugs.&nbsp; If an old version of BCEL is installed
113in a location, such as "lib/endorsed" in the JRE installation,
114where it overrides classes on the application classpath,
115FindBugs will not execute properly.&nbsp;
116We know of several reasons this could happen
117
118<ul>
119<li> If you install the
120<a href="http://java.sun.com/webservices/downloads/webservicespack.html">Java(TM) Web Services
121Developer Pack 1.2</a>
122in the <code>lib/endorsed</code> directory of your Java Runtime Environment (JRE).&nbsp;
123The file <code>xsltc.jar</code> contains an old version of BCEL that is incompatible with
124FindBugs.&nbsp;
125
126<li> Another possibility is that you are using the IBM JDK.&nbsp;
127Some versions include a version of BCEL which conflicts with the
128one required by FindBugs.&nbsp; This problem is fixed in version 1.4.1 SP1,
129so upgrading your JDK should allow FindBugs to run correctly.
130
131<li> Some versions of the Apache Xalan XSLT processor include
132an old version of BCEL in <code>xalan.jar</code>.
133
134</ul>
135
136<p> In all of these cases, you should be able to run FindBugs
137by either removing the offending version of BCEL from your JRE,
138or installing a clean JRE or JDK and using that to run FindBugs.
139
140<p> Many thanks to Peter Meulmeester, Michael Levi, and Thomas Klaeger
141for providing information on this problem.
142
143<h2><a name="q3">Q3: FindBugs is running out of memory, or is taking a long time to finish</a></h2>
144
145<p> In general, FindBugs requires lots of memory and a relatively
146fast CPU.  For large applications, 512M or more of heap space may be
147required.  By default, FindBugs allocates 256M of heap space.
148You can increase this using the <code>-maxHeap <i>n</i></code> option,
149where <i>n</i> is the number of megabytes of heap space to allocate.
150
151
152<h2><a name="q4">Q4: What is the "auxiliary classpath"?  Why should I specify it?</a></h2>
153
154<p> Many important facts about a Java class require information about
155the classes that it references.&nbsp; For example:
156<ul>
157<li> What other classes and interfaces the class inherits from
158<li> What exceptions can be thrown by methods in external classes
159and interfaces
160</ul>
161
162<p> The "auxiliary classpath" is a list of Jar files, directories, and
163class files containing classes that are <em>used</em> by the code you
164want FindBugs to analyze, but should not themselves be analyzed
165by FindBugs.
166
167<p> If FindBugs doesn't have complete information about referenced classes,
168it will not be able to produce results that are as accurate as possible.&nbsp;
169For example, having a complete repository of referenced classes allows
170FindBugs to prune control flow information so it can concentrate on
171paths through methods that are most likely to be feasible at runtime.&nbsp;
172Also, some bug detectors (such as the suspicious reference comparison detector)
173rely on being able to perform type inference, which requires complete
174type hierarchy information.
175
176<p> For these reasons, we strongly recommend that you completely specify
177the auxiliary classpath when you run FindBugs.&nbsp; You can do this
178by using the <code>-auxclasspath</code> command line option, or the
179"Classpath entries" list in the GUI project editor dialog.
180
181<p> If FindBugs cannot find a class referenced by your application, it
182will print out a message when the analysis completes, specifying the
183classes that were missing.&nbsp; You should modify the auxiliary classpath
184to specify how to find the missing classes, and then run FindBugs again.
185
186<h2><a name="q5">Q5: The Eclipse plugin doesn't load</a></h2>
187
188<p> The symptom of this problem is that Eclipse fails to load
189the FindBugs UI plugin with the message:
190<blockquote>
191Plug-in "edu.umd.cs.findbugs.plugin.eclipse" was disabled due to missing or disabled
192prerequisite plug-in "org.eclipse.ui.ide"
193</blockquote>
194
195<p> The reason for this problem is that the Eclipse
196plugin distributed with FindBugs
197does not work with older 3.x versions of Eclipse.
198Please use Eclipse version 3.6 (June 2010) or newer.
199
200<h2><a name="q6">Q6: I'm getting a lot of false "OS" and "ODR" warnings</a></h2>
201
202<p> By default, FindBugs assumes that any method invocation can
203throw an unchecked runtime exception.&nbsp; As a result,
204it may assume that an unchecked exception thrown out of the
205method could bypass a call to a <code>close()</code> method
206for a stream or database resource.
207
208<p> You can use the <code>-workHard</code> command line argument
209or the <code>findbugs.workHard</code> boolean analysis property
210to make FindBugs work harder to prune unlikely exception
211edges.&nbsp; This generally reduces the number of
212false warnings, at the expense of slowing down the
213analysis.
214
215<h2><a name="q7">Q7: The Eclipse plugin loads, but doesn't work correctly</a></h2>
216
217<p> Make sure the Java code you trying to analyze is built properly and has no
218classpath or compile errors.
219
220<p> Make sure the project and workspace FindBugs settings are valid - in doubt, revert them to defaults.
221
222<p> Make sure the Error log view does not show errors.
223
224<h2><a name="q8">Q8: Where is the Maven plugin for FindBugs?</a></h2>
225
226<p>
227The <a href="http://maven.apache.org/">Maven</a> Plugin for FindBugs
228may be found <a href="http://mojo.codehaus.org/findbugs-maven-plugin/">here</a>.&nbsp;
229Please note that the Maven plugin is not maintained by the FindBugs developers,
230so we can't answer questions about it.
231</p>
232
233<h2><a name="q9">Q9: Where is the NetBeans plugin for FindBugs?</a></h2>
234
235<p>We recommend <a href="http://kenai.com/projects/sqe/pages/Home">SQE: Software Quality Environment</a>
236which bundles FindBugs, PMD and CheckStyle. Use the following
237update site:
238<a href="http://deadlock.netbeans.org/hudson/job/sqe/lastStableBuild/artifact/build/full-sqe-updatecenter/updates.xml
239">http://deadlock.netbeans.org/hudson/job/sqe/lastStableBuild/artifact/build/full-sqe-updatecenter/updates.xml</a>
240<p>Pease note that the SQE plugin is not maintained by the FindBugs developers,
241so we can't answer questions about it.
242</p>
243
244
245<hr> <p> 
246<script language="JavaScript" type="text/javascript"> 
247<!---//hide script from old browsers 
248document.write( "Last updated "+ document.lastModified + "." ); 
249//end hiding contents ---> 
250</script> 
251<p> Send comments to <a class="sidebar" href="mailto:findbugs@cs.umd.edu">findbugs@cs.umd.edu</a> 
252<p> 
253<A href="http://sourceforge.net"><IMG src="http://sourceforge.net/sflogo.php?group_id=96405&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
254
255</td>
256
257</table>
258
259</body>
260
261</html>
262