[英]SonarQube 4.0 and Xerces
I'm working in the development of a custom plugin for sonar which generates a report and exports it to PDF. 我正在开发声纳的自定义插件,该插件可生成报告并将其导出为PDF。 For that purpose I use one of our libraries with xercesimpl 2.9.1 dependency.
为此,我使用了一个具有xercesimpl 2.9.1依赖关系的库。
This plugin works with SonarQube 3.7.4 but I'm getting a ClassNotFoundException with SonarQube 4.0 when I analyze a project with "mvn sonar:sonar" 该插件可用于SonarQube 3.7.4,但当我使用“ mvn sonar:sonar”分析项目时,SonarQube 4.0出现了ClassNotFoundException异常
Caused by: java.lang.NoClassDefFoundError: org/apache/xerces/dom/DocumentImpl
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:389)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
at es.excentia.qalitax.report.service.OdtReport.getPdfOutputFile(OdtReport.java:103)
at es.excentia.sonar.odtreports.OdtReportPostJob.generateAndSaveReport(OdtReportPostJob.java:204)
at es.excentia.sonar.odtreports.OdtReportPostJob.executeOnIfLicenseOk(OdtReportPostJob.java:96)
at es.excentia.sonar.licenser.LicensedPostjob.executeOnIfEnabled(LicensedPostjob.java:29)
at es.excentia.sonar.plugins.common.DisableablePostjob.executeOn(DisableablePostjob.java:21)
It seems sonar-plugin-api requires also xercesimpl, but 2.8.1 version, so I have tried some things 似乎sonar-plugin-api也需要xercesimpl,但是版本2.8.1,所以我尝试了一些方法
I have read several posts about this, like "Xerces Hell" . 我已经阅读了一些有关此的文章,例如“ Xerces Hell” 。 I also have read that maybe it's a jvm problem , but I have tried it with jdk 6 and 7 with same result.
我也读过也许是jvm问题 ,但是我已经用jdk 6和7尝试了相同的结果。
Any idea? 任何想法?
UPDATE 更新
I did it work copying xercesimpl.jar and xml-apis.jar to the sonar webserver directory: sonarqube-4.0\\web\\WEB-INF\\lib 我完成了将xercesimpl.jar和xml-apis.jar复制到声纳网络服务器目录的工作:sonarqube-4.0 \\ web \\ WEB-INF \\ lib
Is there any way to avoid this? 有什么办法可以避免这种情况?
I tried to modify my pom dependencies to include both libraries in my plugin jar, but when I run the analysis I get the same error. 我试图修改我的pom依赖项以在我的插件jar中包含两个库,但是当我运行分析时,我遇到了相同的错误。
OK. 好。 It was my mistake.
是我的错
It seems that xerces library is not included in SonarQube 4.x anymore. 似乎SonerQube 4.x不再包含xerces库。 Recompiling my plugin with sonar-plugin-api 4.0, maven finds xercesimpl and includes it to my plugin.
maven使用sonar-plugin-api 4.0重新编译我的插件,找到了xercesimpl并将其包含到我的插件中。 Then, it works fine.
然后,它工作正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.