I'm working in the development of a custom plugin for sonar which generates a report and exports it to PDF. For that purpose I use one of our libraries with xercesimpl 2.9.1 dependency.
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"
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
I have read several posts about this, like "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.
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
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.
OK. It was my mistake.
It seems that xerces library is not included in SonarQube 4.x anymore. Recompiling my plugin with sonar-plugin-api 4.0, maven finds xercesimpl and includes it to my plugin. Then, it works fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.