Re: Unable to initialize a new user defined check class
Bhavana <[email protected]>
| Newsgroups | gmane.comp.java.audit.checkstyle.user |
|---|---|
| Message-ID | <[email protected]> |
Ok never mind. The error was fixed by entering a fully qualified classname for module name as follows: <module name="tools.ManualSteps"/> Thanks Bhavana On Wed, Jun 11, 2008 at 4:22 PM, Bhavana <[email protected]> wrote: > Hello everyone > > > This is my first post here. I just got started with Checkstyle. I wrote a > new Check and I'm trying to make it work using ant. > > The following are the contents of my ant target: > > <project name="checkstyle1" default="" basedir="." > xmlns:cs="antlib:com.puppycrawl.tools.checkstyle"> > <target name="runCS"> > <cs:checkstyle > config="..\config\mychecks.xml" > file="..\java\src\tools\SomeJavaFile.java"/> > </target> > </project> > > This what my config file contains: > > <?xml version="1.0"?> > > <!DOCTYPE module PUBLIC > "-//Puppy Crawl//DTD Check Configuration 1.2//EN" > "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> > > <module name="Checker"> > <module name="TreeWalker"> > <module name="ManualSteps"/> > </module> > > </module> > > I get the following error when I run ant runCS -verbose > > runCS: > parsing buildfile > jar:file:/C:/dev/tools/ant/apache-ant-1.6.5/lib/checkstyle-all > -4.4.jar!/com/puppycrawl/tools/checkstyle/antlib.xml with URI = > jar:file:/C:/dev > > /tools/ant/apache-ant-1.6.5/lib/checkstyle-all-4.4.jar!/com/puppycrawl/tools/che > ckstyle/antlib.xml > [cs:checkstyle] checkstyle version 4.4 > [cs:checkstyle] compiled on Mon December 17 2007, 08:39 EST > [cs:checkstyle] Total execution took 109 ms. > > BUILD FAILED > C:\EXTEND~1\build\build-checkstyle.xml:5: Unable to cr > eate a Checker: cannot initialize module TreeWalker - Unable to instantiate > Manu > alSteps > at > com.puppycrawl.tools.checkstyle.CheckStyleTask.createChecker(CheckSty > leTask.java:386) > at > com.puppycrawl.tools.checkstyle.CheckStyleTask.realExecute(CheckStyle > Task.java:304) > at > com.puppycrawl.tools.checkstyle.CheckStyleTask.execute(CheckStyleTask > .java:265) > at > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) > at org.apache.tools.ant.Task.perform(Task.java:364) > at org.apache.tools.ant.Target.execute(Target.java:341) > at org.apache.tools.ant.Target.performTasks(Target.java:369) > at > org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) > at org.apache.tools.ant.Project.executeTarget(Project.java:1185) > at > org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe > cutor.java:40) > at org.apache.tools.ant.Project.executeTargets(Project.java:1068) > at org.apache.tools.ant.Main.runBuild(Main.java:668) > at org.apache.tools.ant.Main.startAnt(Main.java:187) > at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246) > at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67) > Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot > initi > alize module TreeWalker - Unable to instantiate ManualSteps > at > com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:165) > at > com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(Automatic > Bean.java:208) > at > com.puppycrawl.tools.checkstyle.CheckStyleTask.createChecker(CheckSty > leTask.java:377) > ... 14 more > Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable > to in > stantiate ManualSteps > at > com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(Pac > kageObjectFactory.java:152) > at > com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java > :213) > at > com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(Automatic > Bean.java:208) > at > com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:144) > ... 16 more > Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable > to in > stantiate ManualStepsCheck > at > com.puppycrawl.tools.checkstyle.PackageObjectFactory.doMakeObject(Pac > kageObjectFactory.java:94) > at > com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(Pac > kageObjectFactory.java:149) > ... 19 more > --- Nested Exception --- > com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize > modul > e TreeWalker - Unable to instantiate ManualSteps > at > com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:165) > at > com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(Automatic > Bean.java:208) > Bean.java:208) > at > com.puppycrawl.tools.checkstyle.CheckStyleTask.createChecker(CheckSty > leTask.java:377) > at > com.puppycrawl.tools.checkstyle.CheckStyleTask.realExecute(CheckStyle > Task.java:304) > at > com.puppycrawl.tools.checkstyle.CheckStyleTask.execute(CheckStyleTask > .java:265) > at > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) > at org.apache.tools.ant.Task.perform(Task.java:364) > at org.apache.tools.ant.Target.execute(Target.java:341) > at org.apache.tools.ant.Target.performTasks(Target.java:369) > at > org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) > at org.apache.tools.ant.Project.executeTarget(Project.java:1185) > at > org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe > cutor.java:40) > at org.apache.tools.ant.Project.executeTargets(Project.java:1068) > at org.apache.tools.ant.Main.runBuild(Main.java:668) > at org.apache.tools.ant.Main.startAnt(Main.java:187) > at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246) > at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67) > Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable > to in > stantiate ManualSteps > at > com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(Pac > kageObjectFactory.java:152) > at > com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java > :213) > at > com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(Automatic > Bean.java:208) > at > com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:144) > ... 16 more > Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable > to in > stantiate ManualStepsCheck > at > com.puppycrawl.tools.checkstyle.PackageObjectFactory.doMakeObject(Pac > kageObjectFactory.java:94) > at > com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(Pac > kageObjectFactory.java:149) > ... 19 more > > Total time: 0 seconds > > > > > Any ideas what I'm doing wrong? > > Thanks > > Bhavana > > > -- > Bhavana > -- Bhavana Rehani ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Checkstyle-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/checkstyle-user