views:

152

answers:

1

I have implemented a Checkstyle Listener. It worked before, (I think with a 5.0 beta release), but now (with 5.0), checkstyle fails with the following CallStack

  Unable to create Checker: cannot initialize module de.xyz.toxicity.TeamcityListener - Unable to instantiate de.xyz.toxicity.TeamcityListener
  com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module de.xyz.toxicity.TeamcityListener - Unable to instantiate de.xyz.toxicity.TeamcityListener
    at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:177)
    at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:207)
    at com.puppycrawl.tools.checkstyle.Main.createChecker(Main.java:138)
    at com.puppycrawl.tools.checkstyle.Main.main(Main.java:115)
  Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to instantiate de.xyz.toxicity.TeamcityListener
    at com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObjectFactory.java:156)
    at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:152)
    ... 3 more
  Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to instantiate de.xyz.toxicity.TeamcityListenerCheck
    at com.puppycrawl.tools.checkstyle.PackageObjectFactory.doMakeObject(PackageObjectFactory.java:99)
    at com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObjectFactory.java:153)
    ... 4 more

My configuration File looks like this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"&gt;

<module name="Checker">
<property name="severity" value="warning"/>
<module name="de.xyz.toxicity.TeamcityListener" />
    <module name="FileLength">
        <property name="max" value="500"/>
</module>

<module name="TreeWalker">
    <module name="FileContentsHolder"/>

    <module name="AnonInnerLength">
        <property name="max" value="35"/>
    </module>
    // ... more modules like this follow
</module>
</module>

Everything works fine when my own Listener is removed from the config.

What really confuses me is: Why is checkstyle looking for the TeamcityListenerCheck class? Such a class does not exist. Do I need it? What should it look like?

A: 

Stupid me ... it was a simple classpath issue.

Jens Schauder