title: Sonar runner (ubuntu) execution failed: com.mysql.jdbc.Driver
body: <p>I've recently installed SONAR on a Vagrant box running UBUNTU.
  Sonar service run fine, but when I try to run the sonar-runner I get an error related to jdbc connector.</p>
  
  <p>I configured sonar to run with mysql database by changing the file "sonar-runner.properties":</p>
  
  <pre><code>sonar.jdbc.url=jdbc:mysql://127.0.0.1:3306/sonar?seUnicode=true&amp;amp;characterEncoding=utf8
  sonar.jdbc.username=sonar
  sonar.jdbc.password=sonar
  </code></pre>
  
  <p>When trying to start sonar-runner i get the following output:</p>
  
  <pre><code>$ sudo sonar-runner start -e
  SonarQube Runner 2.3
  Java 1.6.0_27 Sun Microsystems Inc. (64-bit)
  Linux 3.2.0-23-generic amd64
  INFO: Error stacktraces are turned on.
  INFO: Runner configuration file: /home/vagrant/bin/sonar-runner/conf/sonar-runner.properties
  INFO: Project configuration file: NONE
  INFO: SonarQube Server 4.1.1
  13:01:58.363 INFO  - Load batch settings
  13:01:59.524 INFO  - User cache: /root/.sonar/cache
  13:01:59.560 INFO  - Install plugins
  13:02:03.309 INFO  - Install JDBC driver
  13:02:03.618 INFO  - Create JDBC datasource for jdbc:mysql://127.0.0.1:3306/sonar?useUnicode=true&amp;amp;characterEncoding=utf8
  INFO: ------------------------------------------------------------------------
  INFO: EXECUTION FAILURE
  INFO: ------------------------------------------------------------------------
  Total time: 43.846s
  Final Memory: 2M/14M
  INFO: ------------------------------------------------------------------------
  ERROR: Error during Sonar runner execution
  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:90)
      at org.sonar.runner.Main.executeTask(Main.java:70)
      at org.sonar.runner.Main.execute(Main.java:59)
      at org.sonar.runner.Main.main(Main.java:41)
  Caused by: java.lang.IllegalStateException: Fail to connect to database
      at org.sonar.core.persistence.DefaultDatabase.start(DefaultDatabase.java:81)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:622)
      at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
      at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
      at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
      at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
      at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
      at org.picocontainer.behaviors.Stored.start(Stored.java:110)
      at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1015)
      at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1008)
      at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:766)
      at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:91)
      at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
      at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
      at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
      at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:622)
      at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
      ... 9 more
  Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
      at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)
      at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
      at org.apache.commons.dbcp.BasicDataSource.getLogWriter(BasicDataSource.java:1098)
      at org.apache.commons.dbcp.BasicDataSourceFactory.createDataSource(BasicDataSourceFactory.java:350)
      at org.sonar.core.persistence.DefaultDatabase.initDatasource(DefaultDatabase.java:142)
      at org.sonar.core.persistence.DefaultDatabase.start(DefaultDatabase.java:75)
      ... 32 more
  Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
      at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
      at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1420)
      ... 37 more
  ERROR: 
  ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
  </code></pre>
  
  <p>From my undertanding the jdbc driver is not found. I thought that during initalisation sonar-runner will get the required jar (like it does for other libraries).</p>
  
  <p>I tried to "sudo apt-get install libmysql-java" but still get the same error message.
  If that's the right thing to do (which I doubt) I should maybe add the jar to my classpath, but I'm don't know where that jar is actually downloaded and how to add it to the classpath.</p>
  
  <p>Any idea on how to get that solved?</p>
  
  <p>Thanks!!</p>