Q:

Jenkins + SonarQube 4.0 ClassNotFoundException occurs durng XHTML validation check using XML profile

I am getting a ClassNotFoundException while attempting to run a SonarQube 4.0 analysis from Jenkins on a Maven project using Sonar's XML language profile. Within the SonarQube analysis, the exception is occurring while attempting to perform the XML Schema Validation check. What might be wrong?
This is the exception from the Jenkins build job:
0.0.0.0 ERROR - Could not analyze the file D:\Jenkins_home\.jenkins\jobs\XXX with Sonar Runner\workspace\XXX\WebContent\Login.xhtml
org.sonar.api.utils.SonarException: java.lang.ClassNotFoundException: org.apache.xerces.dom.DOMImplementationSourceImpl
at org.sonar.plugins.xml.schemas.SchemaResolver.createLSInput(SchemaResolver.java:122) ~[na:na]
at org.sonar.plugins.xml.schemas.SchemaResolver.resolveResource(SchemaResolver.java:269) ~[na:na]
at com.sun.org.apache.xerces.internal.util.DOMEntityResolverWrapper.resolveEntity(DOMEntityResolverWrapper.java:106) ~[na:1.6.0_24]
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntity(XMLEntityManager.java:1100) ~[na:1.6.0_24]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.resolveDocument(XMLSchemaLoader.java:595) ~[na:1.6.0_24]
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.resolveSchema(XSDHandler.java:1671) ~[na:1.6.0_24]
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:909) ~[na:1.6.0_24]
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:569) ~[na:1.6.0_24]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:552) ~[na:1.6.0_24]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:519) ~[na:1.6.0_24]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:485) ~[na:1.6.0_24]
at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:211) ~[na:1.6.0_24]
at org.sonar.plugins.xml.checks.XmlSchemaCheck.createSchema(XmlSchemaCheck.java:147) ~[na:na]
at org.sonar.plugins.xml.checks.XmlSchemaCheck.validate(XmlSchemaCheck.java:234) ~[na:na]
at org.sonar.plugins.xml.checks.XmlSchemaCheck.validate(XmlSchemaCheck.java:227) ~[na:na]
at org.sonar.plugins.xml.checks.XmlSchemaCheck.validate(XmlSchemaCheck.java:259) ~[na:na]
at org.sonar.plugins.xml.XmlSensor.analyse(XmlSensor.java:69) ~[na:na]
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:72) [sonar-batch-4.0.jar:na]
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:114) [sonar-batch-4.0.jar:na]
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:150) [sonar-batch-4.0.jar:na]
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-plugin-api-4.0.jar:na]
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-plugin-api-4.0.jar:na]
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:190) [sonar-batch-4.0.jar:na]
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:185) [sonar-batch-4.0.jar:na]
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:178) [sonar-batch-4.0.jar:na]
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-plugin-api-4.0.jar:na]
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-plugin-api-4.0.jar:na]
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:58) [sonar-batch-4.0.jar:na]
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45) [sonar-batch-4.0.jar:na]
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82) [sonar-batch-4.0.jar:na]
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-plugin-api-4.0.jar:na]
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-plugin-api-4.0.jar:na]
at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:155) [sonar-batch-4.0.jar:na]
at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:143) [sonar-batch-4.0.jar:na]
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-plugin-api-4.0.jar:na]
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-plugin-api-4.0.jar:na]
at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92) [sonar-batch-4.0.jar:na]
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74) [sonar-batch-4.0.jar:na]
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45) [sonar-runner-batch1703873637256551857.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_24]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_24]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_24]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_24]
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) [sonar-runner-dist-2.3.jar:na]
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) [sonar-runner-dist-2.3.jar:na]
at java.security.AccessController.doPrivileged(Native Method) [na:1.6.0_24]
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) [sonar-runner-dist-2.3.jar:na]
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) [sonar-runner-dist-2.3.jar:na]
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) [sonar-runner-dist-2.3.jar:na]
at org.sonar.runner.api.Runner.execute(Runner.java:90) [sonar-runner-dist-2.3.jar:na]
at org.sonar.runner.Main.executeTask(Main.java:70) [sonar-runner-dist-2.3.jar:na]
at org.sonar.runner.Main.execute(Main.java:59) [sonar-runner-dist-2.3.jar:na]
at org.sonar.runner.Main.main(Main.java:41) [sonar-runner-dist-2.3.jar:na]
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.dom.DOMImplementationSourceImpl
at java.net.URLClassLoader$1.run(URLClassLoader.java:202) ~[na:1.6.0_24]
at java.security.AccessController.doPrivileged(Native Method) [na:1.6.0_24]
at java.net.URLClassLoader.findClass(URLClassLoader.java:190) ~[na:1.6.0_24]
at java.lang.ClassLoader.loadClass(ClassLoader.java:307) ~[na:1.6.0_24]
at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ~[na:1.6.0_24]
at org.w3c.dom.bootstrap.DOMImplementationRegistry.newInstance(DOMImplementationRegistry.java:146) ~[na:1.6.0_24]
at org.sonar.plugins.xml.schemas.SchemaResolver.createLSInput(SchemaResolver.java:115) ~[na:na]
... 52 common frames omitted

Configuration:

Jenkins 1.509.2 job using Maven 2.2.1.
Jenkins is running under Tomcat 7.0.11.
Jenkins Sonar plugin version 2.1.
Sonar XML plugin version 1.0.1.
SonarQube 4.0 analysis using XML language profile.

I tried initiating the Sonar analysis from the Jenkins job using both a) SonarQube runner 2.3 via Maven post-build step; and b) directly using a Sonar post-build action. Both give the same result. Note that the SonarQube analysis still completes and I can see the results in SonarQube. I also tried running the job using Maven 3.0.3. Same result.

A:

Ticket created, indeed I've managed to reproduce this issue locally : https://jira.codehaus.org/browse/SONARPLUGINS-3356
Thanks for your feedback.

