I'm trying to run sonar on my Maven 3 project. I am using SonarQube 5.0 with all the latest plugins installed (Java 3.0, Findbugs 3.1, Codecheck 2.2). Additionally, I'm using the latest maven-sonar-plugin to launch.
I'm fairly new to sonar, so I am not entirely sure if I need special configuration to get the Sonar scanning to work. I started with the following error:
java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/servlet/ServletException, method=<init>()V, pc=0
So I tried to add an exclusion to the pom to exclude all javax files, but that doesn't seem to have done anything; I'm still getting the same error messages. What makes me wonder even more is that these are all "WARNINGS", and yet, the sonar build fails.
Is this even the Sonar Java plugin? Is it another plugin (ie: checkstyle or findbugs) that needs to be configured independently? What is causing the build to fail?
I am not including the pom file as there is really no sonar configuration present, save and except the following properties (plus host, url, password, etc):
<sonar.jdbc.driver>oracle.jdbc.driver.OracleDriver</sonar.jdbc.driver>
<sonar.junit.reportsPath>target/surefire-reports</sonar.junit.reportsPath>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.jacoco.reportPath>target/jacoco.exec</sonar.jacoco.reportPath>
The output of mvn sonar:sonar
(following a mvn clean install):
[INFO] [12:22:25.635] Index files
[INFO] [12:22:25.647] Excluded sources:
[INFO] [12:22:25.647] **/generated-sources/**
[INFO] [12:22:25.647] **/angular*.js
[INFO] [12:22:25.647] **/jquery*.js
[INFO] [12:22:25.647] **/bootstrap*.js
[INFO] [12:22:25.648] **/underscore*.js
[INFO] [12:22:25.648] **/json3*.js
[INFO] [12:22:25.648] **/modernizr*.js
[INFO] [12:22:25.648] **/es5-shim*.js
[INFO] [12:22:25.648] **/dataTables*.js
[INFO] [12:22:25.648] **/javax/**/*
[INFO] [12:22:31.023] 1782 files indexed
[INFO] [12:22:51.367] Quality profile for java: Sonar way with Findbugs
[INFO] [12:22:51.967] Sensor JavaSquidSensor...
[INFO] [12:22:52.947] Java Main Files AST scan...
[INFO] [12:22:52.969] 1782 source files to be analyzed
[INFO] [12:23:02.970] 41/1782 files analyzed, current is C:\dev\Eclipse\workspace_proj_v6.0\bbi_java\sources\com\me\bbi\admin\agent\dao\User.java
....
[INFO] [12:25:05.046] 1782/1782 source files analyzed
[INFO] [12:25:05.177] Java bytecode scan...
[INFO] [12:25:06.926] Java bytecode scan done: 1749 ms
[INFO] [12:25:06.926] Java Test Files AST scan...
[INFO] [12:25:06.926] 0 source files to be analyzed
[INFO] [12:25:06.927] Java Test Files AST scan done: 1 ms
[INFO] [12:25:06.931] Package design analysis...
[INFO] [12:25:06.951] 0/0 source files analyzed
[INFO] [12:25:17.738] Package design analysis done: 10807 ms
[INFO] [12:25:18.456] Sensor JavaSquidSensor done: 146489 ms
[INFO] [12:25:18.461] Sensor QProfileSensor...
[INFO] [12:25:18.463] Sensor QProfileSensor done: 2 ms
[INFO] [12:25:18.464] Sensor Maven dependencies...
[INFO] [12:25:19.185] Sensor Maven dependencies done: 721 ms
[INFO] [12:25:19.188] Sensor FindbugsSensor...
[INFO] [12:25:19.234] Execute Findbugs 3.0.0...
[INFO] [12:25:20.899] Findbugs output report: C:\dev\Eclipse\workspace_proj_v6.0\bbi_java\target\sonar\findbugs-result.xml
[INFO] [12:27:09.117] Execute Findbugs 3.0.0 done: 109883 ms
[INFO] [12:27:09.224] Sensor FindbugsSensor done: 110036 ms
[INFO] [12:27:09.224] Sensor CheckstyleSensor...
[INFO] [12:27:09.225] Execute Checkstyle 6.1...
[INFO] [12:27:09.238] Checkstyle configuration: C:\dev\Eclipse\workspace_proj_v6.0\bbi_java\target\sonar\checkstyle.xml
java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/servlet/ServletException, method=<init>()V, pc=0
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:306)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:711)
at java.net.URLClassLoader.access$400(URLClassLoader.java:92)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1159)
at java.security.AccessController.doPrivileged(AccessController.java:366)
at java.net.URLClassLoader.findClass(URLClassLoader.java:594)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:760)
at java.lang.ClassLoader.loadClass(ClassLoader.java:728)
at java.lang.ClassLoader.loadClass(ClassLoader.java:707)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:219)
at com.puppycrawl.tools.checkstyle.checks.ClassResolver.safeLoad(ClassResolver.java:153)
...
... above warning repeated 50+ times
...
[WARN] [12:27:19.995] C:\dev\Eclipse\workspace_proj_v6.0\bbi_java\sources\com\me\bbi\banking\electronicstatement\ElectronicStatementPDFServlet.java: Got an exception - java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/servlet/ServletException, method=<init>()V, pc=0
java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/servlet/ServletException, method=<init>()V, pc=0
[WARN] [12:28:08.951] C:\dev\Eclipse\workspace_proj_v6.0\bbi_java\sources\com\me\bbi\wealthmanagement\EntryPointServlet.java: Got an exception - java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/servlet/ServletException, method=<init>()V, pc=0
[INFO] [12:28:10.725] Execute Checkstyle 6.1 done: 61500 ms
[INFO] [12:28:10.725] Sensor CheckstyleSensor done: 61501 ms
[INFO] [12:28:10.725] Sensor PmdSensor...
[INFO] [12:28:10.726] Execute PMD 5.2.1...
[INFO] [12:28:10.738] Java version: 1.7
[INFO] [12:28:10.838] PMD configuration: C:\dev\Eclipse\workspace_proj_v6.0\bbi_java\target\sonar\pmd.xml
Mar 19, 2015 12:28:14 PM net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver visit
WARNING: Could not find class com.me.bbi.admin.agent.AgentAdminController, due to: java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/servlet/GenericServlet, method=<init>()V, pc=0
Mar 19, 2015 12:28:14 PM net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver visit
WARNING: Could not find class com.bnc.bvi.admin.agent.AgentStartupController, due to: java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/servlet/GenericServlet, method=<init>()V, pc=0
...
... above warning lines repeated several times (50+) for multiple files
...
[INFO] [12:28:23.757] Execute PMD 5.2.1 done: 13031 ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 06:09 min
[INFO] Finished at: 2015-03-19T12:28:23-04:00
[INFO] Final Memory: 41M/470M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project bbi2: JVMCFRE074 no Code attribute specified; class=javax/servlet/jsp/PageContext, method=<init>()V, pc=0 -> [Help 1]