fabriciocolombo / sonar-delphi

SonarQube Delphi Plugin
91 stars 46 forks source link

NullPointerException on connecting to mssql database #52

Open bootv2 opened 8 years ago

bootv2 commented 8 years ago

Hi,

I'm attempting to read code-coverage results from AQTime that have been exported to an MSSQL database and I keep running into a NullPointerException.

INFO: Sensor Delphi Code Coverage Sensor DEBUG: Code Coverage starting... ERROR: com.microsoft.sqlserver.jdbc.SQLServerDriver INFO: ------------------------------------------------------------------------ INFO: EXECUTION FAILURE INFO: ------------------------------------------------------------------------ INFO: Total time: 39.743s INFO: Final Memory: 133M/1437M INFO: ------------------------------------------------------------------------ ERROR: Error during SonarQube Scanner execution java.lang.NullPointerException at org.sonar.plugins.delphi.codecoverage.aqtime.JdbcTemplate.query(JdbcTemplate.java:62) at org.sonar.plugins.delphi.codecoverage.aqtime.AQTimeCoverageDao.readAQTimeCodeCoverage(AQTimeCoverageDao.java:56) at org.sonar.plugins.delphi.codecoverage.aqtime.AQTimeCoverageParser.parse(AQTimeCoverageParser.java:60) at org.sonar.plugins.delphi.codecoverage.CodeCoverageSensor.analyse(CodeCoverageSensor.java:92) at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58) at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50) at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83) at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241) at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236) at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47) at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106) at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) at com.sun.proxy.$Proxy0.execute(Unknown Source) at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:244) at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:154) at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:110) at org.sonarsource.scanner.cli.Main.execute(Main.java:72) at org.sonarsource.scanner.cli.Main.main(Main.java:60)

I've been trying for hours using different connection settings and nothing makes a difference. The settings I'm using are these: https://i.gyazo.com/18e4776769db5354f59f89796d1b0df1.png

I think this is a bug. I hope this could be fixed because my employer would very much like to use this feature.

bootv2 commented 8 years ago

I did some research and the problem is that the java classloader can't find the MSSQL driver which is in the jdbc/mssql folder in sonarqube. I fixed this by placing the mssql jdbc driver in the META-INF/lib folder of the sonar-delphi plugin.