2

I've similar problem which was mentioned over there. I'm using mvn clean compile site command and my versions are:

  • cobertura.version: 2.5.1
  • findbugs.version: 2.5.1
  • maven-compiler-plugin.version: 2.5.1
  • maven.version: 2.2.1
  • java.version: 1.6.0_45

The error I get is:

java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfi
guration
        at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
        at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
        at org.apache.tools.ant.util.JAXPUtils.newSAXParser(JAXPUtils.java:215)
        at org.apache.tools.ant.util.JAXPUtils.getNamespaceXMLReader(JAXPUtils.java:172)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:273)
        at org.apache.tools.ant.helper.ProjectHelper2.parseUnknownElement(ProjectHelper2.java:131)
        at org.apache.tools.ant.helper.ProjectHelper2.parseAntlibDescriptor(ProjectHelper2.java:111)
        at org.apache.tools.ant.taskdefs.Antlib.createAntlib(Antlib.java:91)
        at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:440)
        at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:292)
        at org.apache.tools.ant.ComponentHelper.checkNamespace(ComponentHelper.java:869)
        at org.apache.tools.ant.ComponentHelper.getDefinition(ComponentHelper.java:308)
        at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:285)
        at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:264)
        at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:417)
        at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
        at groovy.util.AntBuilder.nodeCompleted(AntBuilder.java:181)
        at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:147)
        at groovy.util.AntBuilder.doInvokeMethod(AntBuilder.java:149)
        at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:64)
        at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:756)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:730)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
        at org.codehaus.mojo.findbugs.FindBugsMojo.executeFindbugs(FindBugsMojo.groovy:1004)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:78)
        at org.codehaus.mojo.findbugs.FindBugsMojo.executeReport(FindBugsMojo.groovy:640)
        at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:190)
        at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:144)
        at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:164)
        at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule(DefaultSiteRenderer.java:330)
        at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(DefaultSiteRenderer.java:134)
        at org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:158)
        at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:120)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

2 Answers 2

4

In Java, always explicitly specify which XML parser to use.

Add the below parameter in your classpath:

-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
-Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
Sign up to request clarification or add additional context in comments.

Comments

0

It was a wrong version of findbugs. It works with:

  • Findbugs: 2.5.3
  • maven-compiler-plugin: 2.5.1

Also I decided to resign my pom.xml with cobertura and change it to pmd plugin. So my pom.xml looks like:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <configuration>
                    <linkXref>true</linkXref>
                    <sourceEncoding>UTF-8</sourceEncoding>
                    <minimumTokens>30</minimumTokens>
                    <targetJdk>1.6</targetJdk>
                </configuration>
            </plugin>
            <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>findbugs-maven-plugin</artifactId>
               <version>${findbugs.version}</version>
            </plugin>

  <reporting>
     <plugins>
        <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>findbugs-maven-plugin</artifactId>
           <version>${findbugs.version}</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-pmd-plugin</artifactId>
        </plugin>
      </plugins>
   </reporting>

and I prepareing my report through command:

mvn clean -D"dependency.locations.enabled=false" compile site

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.