问题描述
当我尝试使用Sonar的 XML语言配置文件在Maven项目上从Jenkins运行SonarQube 4.0分析时,我得到了 ClassNotFoundException .在SonarQube分析中,尝试执行 XML Schema Validation 检查时发生了异常.可能是什么问题?
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?
这是詹金斯(Jenkins)建造工作的例外情况:
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
配置:
- 使用Maven 2.2.1的Jenkins 1.509.2工作
- Jenkins在Tomcat 7.0.11下运行.
- Jenkins Sonar插件版本2.1.
- Sonar XML插件版本1.0.1.
- 使用XML语言配置文件进行SonarQube 4.0分析.
我尝试使用以下两种方法从Jenkins作业中启动Sonar分析:a)通过Maven构建后步骤进行SonarQuberunner 2.3; b)直接使用声纳制造后动作.两者给出相同的结果.请注意,SonarQube分析仍已完成,我可以在SonarQube中看到结果.我还尝试使用Maven 3.0.3运行该作业.结果相同.
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.
推荐答案
票务已创建,实际上我已经设法在本地重现此问题: https://jira.codehaus.org/browse/SONARPLUGINS-3356 感谢您的反馈.
Ticket created, indeed I've managed to reproduce this issue locally : https://jira.codehaus.org/browse/SONARPLUGINS-3356Thanks for your feedback.
这篇关于Jenkins + SonarQube 4.0 ClassNotFoundException在使用XML配置文件进行XHTML验证检查期间发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!