Re: Checkstyle Custom rule fails to instantiate
Lars Ködderitzsch <[email protected]> Fri, 03 Feb 2012 19:04:48 +0100
| Newsgroups | gmane.comp.java.audit.checkstyle.user |
|---|---|
| Message-ID | <[email protected]> |
--===============4603283414380662758==
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello Mark,<br>
<br>
what is the root cause of the exception you're receiving?
NoClassDefFound? Or something other?<br>
<br>
In case of NoClassDefFound you're probably having classpath issues
(try the -cp parameter passed to the java executable ISO the
CLASSPATH system variable).<br>
In case of a different error there could be something wrong with
your check class itself, e.g. missing public default constructor or
something like that.<br>
The root cause exception should usually reveal it...<br>
<br>
BR,<br>
Lars<br>
<br>
<br>
Am 03.02.2012 18:25, schrieb Mark Tymieniecki:
<blockquote cite="mid:[email protected]"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Times New Roman","serif";
color:#1F497D;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";
mso-fareast-language:EN-GB;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;color:#1F497D">Hi Oliver,<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;color:#1F497D">Many thanks for that,
it ran slower so was obviously trying something but still
with the same result. I amdefinitely doing something
blindingly obvious and probably very stupid, but for the
life of me cannot fathom what !<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;color:#1F497D">Regards<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
lang="EN-US"> Oliver Burn [<a class="moz-txt-link-freetext" href="mailto:[email protected]">mailto:[email protected]</a>] <br>
<b>Sent:</b> 02 February 2012 20:05<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a><br>
<b>Subject:</b> Re: [Checkstyle-user] Checkstyle Custom rule
fails to instantiate<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">In the file
"client_checks.xml" how is the "LoggerAttr" module defined?
Try using the fully qualified class name.<o:p></o:p></p>
<div>
<p class="MsoNormal">On Thu, Feb 2, 2012 at 23:25, Mark
Tymieniecki <<a moz-do-not-send="true"
href="mailto:[email protected]">[email protected]</a>>
wrote:<o:p></o:p></p>
<p class="MsoNormal">Hi Lars,<br>
<br>
I am running Windows 7, and have set CLASSPATH
correctly(trying both \ and /<br>
in that path!), but cannot run directly from another folder
so have to use<br>
the -JAR option and then with the full path.<br>
This is what it all end up looking like:<br>
<br>
C:\02-Client-Code\Client\Checkstyle>java -D64 -jar<br>
c:/checkstyle-5.5/checkstyle-5.5-all.jar -c<br>
"C:/02-Client-Code/Client/Checkstyle/client_checks.xml" -f<br>
xml -o
C:/02-Client-Code/Client/Checkstyle/Client_checkstyle_errors.xml
-r<br>
"E:/Eclipse Projects/Client_Rules_Test/src"<br>
Unable to create Checker: cannot initialize module
TreeWalker - Unable to<br>
instantiate LoggerAttr<br>
com.puppycrawl.tools.checkstyle.api.CheckstyleException:
cannot initialize<br>
module TreeWalker - Unable to instantiate LoggerAttr<br>
at<br>
com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:178)<br>
at<br>
com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(Automatic<br>
Bean.java:184)<br>
at
com.puppycrawl.tools.checkstyle.Main.createChecker(Main.java:143)<br>
at
com.puppycrawl.tools.checkstyle.Main.main(Main.java:120)<br>
Caused by:
com.puppycrawl.tools.checkstyle.api.CheckstyleException:
Unable<br>
to instantiate LoggerAttr<br>
at<br>
com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObj<br>
ectFactory.java:155)<br>
at<br>
com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java:161)<br>
at<br>
com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.ja<br>
va:184)<br>
at<br>
com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:157)<br>
... 3 more<br>
Caused by:
com.puppycrawl.tools.checkstyle.api.CheckstyleException:
Unable<br>
to instantiate LoggerAttrCheck<br>
at<br>
com.puppycrawl.tools.checkstyle.PackageObjectFactory.doMakeObject(PackageObj<br>
ectFactory.java:98)<br>
at<br>
com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObj<br>
ectFactory.java:152)<br>
... 6 more<br>
<br>
This is very worrying as I have now tried it on three
platforms and get the<br>
same result each time.<br>
<br>
Regards<br>
-----Original Message-----<br>
From: Lars Ködderitzsch [mailto:<a moz-do-not-send="true"
href="mailto:[email protected]">[email protected]</a>]<br>
Sent: 01 February 2012 18:16<br>
To: <a moz-do-not-send="true"
href="mailto:[email protected]">[email protected]</a><br>
Subject: Re: [Checkstyle-user] Checkstyle Custom rule fails
to instantiate<br>
<br>
Hello Mark,<br>
<br>
if I got it right you need to fully specify each jar in the
CLASSPATH<br>
variable (or via -cp cmd line option) or use a classpath
wildcard to pick up<br>
all jars in a folder (e.g. foo/*).<br>
<br>
<a moz-do-not-send="true"
href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html"
target="_blank">http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html</a><br>
<br>
HTH,<br>
Lars<br>
<br>
| Snipped for less scrolling<br>
<br>
<br>
<br>
----------------------------------------------------------------------------<br>
--<br>
Keep Your Developer Skills Current with LearnDevNow!<br>
The most comprehensive online learning library for Microsoft
developers is<br>
just $99.99! Visual Studio, SharePoint, SQL - plus HTML5,
CSS3, MVC3, Metro<br>
Style Apps, more. Free future releases when you subscribe
now!<br>
<a moz-do-not-send="true"
href="http://p.sf.net/sfu/learndevnow-d2d" target="_blank">http://p.sf.net/sfu/learndevnow-d2d</a><br>
_______________________________________________<br>
Checkstyle-user mailing list<br>
<a moz-do-not-send="true"
href="mailto:[email protected]">[email protected]</a><br>
<a moz-do-not-send="true"
href="https://lists.sourceforge.net/lists/listinfo/checkstyle-user"
target="_blank">https://lists.sourceforge.net/lists/listinfo/checkstyle-user</a><br>
<br>
<br>
------------------------------------------------------------------------------<br>
Keep Your Developer Skills Current with LearnDevNow!<br>
The most comprehensive online learning library for Microsoft
developers<br>
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5,
CSS3, MVC3,<br>
Metro Style Apps, more. Free future releases when you
subscribe now!<br>
<a moz-do-not-send="true"
href="http://p.sf.net/sfu/learndevnow-d2d" target="_blank">http://p.sf.net/sfu/learndevnow-d2d</a><br>
_______________________________________________<br>
Checkstyle-user mailing list<br>
<a moz-do-not-send="true"
href="mailto:[email protected]">[email protected]</a><br>
<a moz-do-not-send="true"
href="https://lists.sourceforge.net/lists/listinfo/checkstyle-user"
target="_blank">https://lists.sourceforge.net/lists/listinfo/checkstyle-user</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
<a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/learndevnow-dev2">http://p.sf.net/sfu/learndevnow-dev2</a></pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Checkstyle-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/checkstyle-user">https://lists.sourceforge.net/lists/listinfo/checkstyle-user</a>
</pre>
</blockquote>
<br>
</body>
</html>
--===============4603283414380662758==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
--===============4603283414380662758==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Checkstyle-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user
--===============4603283414380662758==--