Re: Checkstyle Custom rule fails to instantiate

Oliver Burn <[email protected]> Fri, 3 Feb 2012 07:05:12 +1100
Newsgroups gmane.comp.java.audit.checkstyle.user
Message-ID <CAHZftdWF4eHYLePXE5tqZ_RRtvK-6uHT48cVC0MzvoV1nJsVGw@mail.gmail.com>
--===============2383255070355430027==
Content-Type: multipart/alternative; boundary=e0cb4efe2cdec388cd04b800b61d

--e0cb4efe2cdec388cd04b800b61d
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

In the file "client_checks.xml" how is the "LoggerAttr" module defined? Try
using the fully qualified class name.

On Thu, Feb 2, 2012 at 23:25, Mark Tymieniecki <[email protected]>wrote=
:

> Hi Lars,
>
> I am running Windows 7, and have set CLASSPATH correctly(trying both \ an=
d
> /
> in that path!), but cannot run directly from another folder so have to us=
e
> the -JAR option and then with the full path.
> This is what it all end up looking like:
>
> C:\02-Client-Code\Client\Checkstyle>java -D64 -jar
> c:/checkstyle-5.5/checkstyle-5.5-all.jar -c
> "C:/02-Client-Code/Client/Checkstyle/client_checks.xml" -f
>  xml -o C:/02-Client-Code/Client/Checkstyle/Client_checkstyle_errors.xml =
-r
> "E:/Eclipse Projects/Client_Rules_Test/src"
> Unable to create Checker: cannot initialize module TreeWalker - Unable to
> instantiate LoggerAttr
> com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initializ=
e
> module TreeWalker - Unable to instantiate LoggerAttr
>        at
> com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:178)
>        at
> com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(Automatic
> Bean.java:184)
>        at com.puppycrawl.tools.checkstyle.Main.createChecker(Main.java:14=
3)
>        at com.puppycrawl.tools.checkstyle.Main.main(Main.java:120)
> Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unabl=
e
> to instantiate LoggerAttr
>        at
>
> com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(Package=
Obj
> ectFactory.java:155)
>        at
> com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java:161=
)
>        at
>
> com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean=
.ja
> va:184)
>        at
> com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:157)
> ... 3 more
> Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unabl=
e
> to instantiate LoggerAttrCheck
>        at
>
> com.puppycrawl.tools.checkstyle.PackageObjectFactory.doMakeObject(Package=
Obj
> ectFactory.java:98)
>        at
>
> com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(Package=
Obj
> ectFactory.java:152)
>        ... 6 more
>
> This is very worrying as I have now tried it on three platforms and get t=
he
> same result each time.
>
> Regards
> -----Original Message-----
> From: Lars K=F6dderitzsch [mailto:[email protected]]
> Sent: 01 February 2012 18:16
> To: [email protected]
> Subject: Re: [Checkstyle-user] Checkstyle Custom rule fails to instantiat=
e
>
> Hello Mark,
>
> if I got it right you need to fully specify each jar in the CLASSPATH
> variable (or via -cp cmd line option) or use a classpath wildcard to pick
> up
> all jars in a folder (e.g. foo/*).
>
> http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.ht=
ml
>
> HTH,
> Lars
>
> | Snipped for less scrolling
>
>
>
>
> -------------------------------------------------------------------------=
---
> --
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers i=
s
> just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Met=
ro
> Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Checkstyle-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/checkstyle-user
>
>
>
> -------------------------------------------------------------------------=
-----
> Keep Your Developer Skills Current with LearnDevNow!
> 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-d2d
> _______________________________________________
> Checkstyle-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/checkstyle-user
>

--e0cb4efe2cdec388cd04b800b61d
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

In the file &quot;client_checks.xml&quot; how is the &quot;LoggerAttr&quot;=
 module defined? Try using the fully qualified class name.<br><br><div clas=
s=3D"gmail_quote">On Thu, Feb 2, 2012 at 23:25, Mark Tymieniecki <span dir=
=3D"ltr">&lt;<a href=3D"mailto:[email protected]">[email protected]=
</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">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&gt;java -D64 -jar<br>
c:/checkstyle-5.5/checkstyle-5.5-all.jar -c<br>
&quot;C:/02-Client-Code/Client/Checkstyle/client_checks.xml&quot; -f<br>
=A0xml -o C:/02-Client-Code/Client/Checkstyle/Client_checkstyle_errors.xml =
-r<br>
&quot;E:/Eclipse Projects/Client_Rules_Test/src&quot;<br>
Unable to create Checker: cannot initialize module TreeWalker - Unable to<b=
r>
instantiate LoggerAttr<br>
com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize<=
br>
module TreeWalker - Unable to instantiate LoggerAttr<br>
 =A0 =A0 =A0 =A0at<br>
com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:178)<br>
 =A0 =A0 =A0 =A0at<br>
com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(Automatic<br>
Bean.java:184)<br>
 =A0 =A0 =A0 =A0at com.puppycrawl.tools.checkstyle.Main.createChecker(Main.=
java:143)<br>
 =A0 =A0 =A0 =A0at com.puppycrawl.tools.checkstyle.Main.main(Main.java:120)=
<br>
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable<=
br>
to instantiate LoggerAttr<br>
 =A0 =A0 =A0 =A0at<br>
com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageOb=
j<br>
ectFactory.java:155)<br>
 =A0 =A0 =A0 =A0at<br>
com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java:161)<=
br>
 =A0 =A0 =A0 =A0at<br>
com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.j=
a<br>
va:184)<br>
 =A0 =A0 =A0 =A0at<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>
 =A0 =A0 =A0 =A0at<br>
com.puppycrawl.tools.checkstyle.PackageObjectFactory.doMakeObject(PackageOb=
j<br>
ectFactory.java:98)<br>
 =A0 =A0 =A0 =A0at<br>
com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageOb=
j<br>
ectFactory.java:152)<br>
 =A0 =A0 =A0 =A0... 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=F6dderitzsch [mailto:<a href=3D"mailto:[email protected]"=
>[email protected]</a>]<br>
Sent: 01 February 2012 18:16<br>
To: <a href=3D"mailto:[email protected]">checkstyle-use=
[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 u=
p<br>
all jars in a folder (e.g. foo/*).<br>
<br>
<a href=3D"http://docs.oracle.com/javase/7/docs/technotes/tools/windows/cla=
sspath.html" target=3D"_blank">http://docs.oracle.com/javase/7/docs/technot=
es/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 href=3D"http://p.sf.net/sfu/learndevnow-d2d" target=3D"_blank">http://p.=
sf.net/sfu/learndevnow-d2d</a><br>
_______________________________________________<br>
Checkstyle-user mailing list<br>
<a href=3D"mailto:[email protected]">Checkstyle-user@li=
sts.sourceforge.net</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/checkstyle-user" ta=
rget=3D"_blank">https://lists.sourceforge.net/lists/listinfo/checkstyle-use=
r</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 href=3D"http://p.sf.net/sfu/learndevnow-d2d" target=3D"_blank">http://p.=
sf.net/sfu/learndevnow-d2d</a><br>
_______________________________________________<br>
Checkstyle-user mailing list<br>
<a href=3D"mailto:[email protected]">Checkstyle-user@li=
sts.sourceforge.net</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/checkstyle-user" ta=
rget=3D"_blank">https://lists.sourceforge.net/lists/listinfo/checkstyle-use=
r</a><br>
</blockquote></div><br>

--e0cb4efe2cdec388cd04b800b61d--


--===============2383255070355430027==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
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-d2d
--===============2383255070355430027==
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

--===============2383255070355430027==--