Sonar ant任务失败,提供者org.apache.xerces.jaxp.SAXParserFactoryImpl未找到异常

时间:2014-08-15 21:18:09

标签: sonarqube

我正在尝试在Bamboo机器上运行声纳蚂蚁任务。同样的任务在我的本地机器上工作正常(ant版本1.9.3以及ant版本1.8.2)但是在竹蚂蚁1.8.2上失败并出现以下错误

    org.sonar.runner.impl.RunnerException: Unable to execute Sonar
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
    at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
    at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
    at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
    at org.sonar.runner.api.Runner.execute(Runner.java:100)
    at org.sonar.ant.SonarTask.launchAnalysis(SonarTask.java:53)
    at org.sonar.ant.SonarTask.execute(SonarTask.java:48)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    at org.apache.tools.ant.Main.runBuild(Main.java:809)
    at org.apache.tools.ant.Main.startAnt(Main.java:217)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
    error   15-Aug-2014 16:08:20    Caused by: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
    at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:134)
    at ch.qos.logback.core.joran.event.SaxEventRecorder.buildSaxParser(SaxEventRecorder.java:81)
    at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:59)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:134)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
    at org.sonar.runner.batch.IsolatedLauncher.initLogging(IsolatedLauncher.java:71)
    at org.sonar.runner.batch.IsolatedLauncher.createBatch(IsolatedLauncher.java:52)
    at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
    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.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
    ... 24 more

我已经尝试将xercesImpl.jar放在ant classpath

2 个答案:

答案 0 :(得分:1)

我有一个类似的问题,运行sonarqube 4.2,其中findbugs会由于缺少解析器而失败。我能够通过将xercesImpl.jar放在[sonar.home] / web / WEB-INF / lib文件夹中并重新启动服务器来解决问题。通过将其他所需的罐放在同一位置解决所有其他依赖性问题后,问题就消失了。

希望这有帮助。

答案 1 :(得分:1)

我有完全相同的问题,也使用Bamboo和声纳Ant任务。

我发现这是因为我用旧的java版本运行了ant。我从1.6切换到1.7,问题得到解决。

希望这有助于将来。