问题描述
我最近在运行UBUNTU的Vagrant盒子上安装了SONAR。
声纳服务运行正常,但是当我尝试运行声纳转轮时,我得到一个与jdbc连接器相关的错误。
我配置声纳与mysql一起运行数据库通过更改文件sonar-runner.properties:
sonar.jdbc.url = jdbc:mysql://127.0 .0.1:3306 / sonar?seUnicode = true& amp; characterEncoding = utf8
sonar.jdbc.username = sonar
sonar.jdbc.password = sonar
当尝试启动声纳 - 跑步者时,我得到以下输出:
$ sudo sonar-runner start -e
SonarQube Runner 2.3
Java 1.6.0_27 Sun Microsystems Inc.(64位)
Linux 3.2.0-23-generic amd64
INFO:错误堆栈跟踪已打开。
INFO:运行者配置文件:/home/vagrant/bin/sonar-runner/conf/sonar-runner.properties
INFO:项目配置文件:NONE
INFO:SonarQube Server 4.1.1
13:01:58.363 INFO - 加载批量设置
13:01:59.524 INFO - 用户缓存:/root/.sonar/cache
13:01:59.560 INFO - 安装插件
13:02:03.309 INFO - 安装JDBC驱动程序
13:02:03.618 INFO - 为jdbc创建JDBC数据源:mysql://127.0.0.1:3306 / sonar?useUnicode = true& amp; characterEncoding = utf8
INFO:-------------------------------------------- ----------------------------
INFO:EXECUTION FAILURE
INFO:-------- -------------------------------------------------- --------------
总时间:43.846s
最终记忆:2M / 14M
INFO:----------- -------------------------------------------------- -----------
错误:Sonar转轮执行期间出错
org.sonar.runner.impl.RunnerException:无法在org.sonar.runner上执行Sonar
.impl.BatchLauncher $ 1.D elegateExecution(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)
引起:java.lang.IllegalStateException:无法连接到数据库
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.DefaultPicoCo ntainer.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
引起:org.apache.commons.dbcp.SQLNestedException:无法加载JDBC驱动程序类'com.mysql.jdb c.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更多
引起:java.lang.ClassNotFoundException:com.mysql.jdbc.Driver
at java.net.URLClassLoader $ 1.run(URLClassLoader.java:217)
at java.security。 AccessController.doPrivileged(本机方法)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at java.lang.ClassLoader.load类(ClassLoader.java:268)
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1420)
... 37更多
错误:
错误:使用-X开关重新运行SonarQube Runner以启用完整的调试日志记录。
从我的承诺中找不到jdbc驱动程序。我认为在初始化期间,声纳 - 跑步者将获得所需的jar(就像它对其他库一样)。
我试图sudo apt-get install libmysql-java但仍然得到相同的错误消息。
如果这是正确的做法(我怀疑)我应该将jar添加到我的类路径中,但我不知道该jar实际下载的位置以及如何将它添加到类路径中。 / p>
关于如何解决问题的任何想法?
谢谢!!
我看错了地方!
问题不是来自跑步者,而是来自SONAR本身。我不得不更改de sonar配置文件'/ opt / sonar'并重新启动它。在设置页面中我现在可以看到声纳在mysql上运行。
我正在面对跑步者的另一个问题,但它与上述问题无关。
所以基本确保SONAR和SONAR-RUNNER都配置为使用mysql。
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.
I configured sonar to run with mysql database by changing the file "sonar-runner.properties":
sonar.jdbc.url=jdbc:mysql://127.0.0.1:3306/sonar?seUnicode=true&characterEncoding=utf8
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
When trying to start sonar-runner i get the following output:
$ 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&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.
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).
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.
Any idea on how to get that solved?
Thanks!!
I was looking at the wrong place! Issue was not comming from the runner but from SONAR itself. I had to change de sonar config file '/opt/sonar' and restart it. In the setting page I now can see that sonar is running on mysql. I'm facing a other issue with the runner, but it is not related to the issue above.
So basicaly make sure both SONAR and SONAR-RUNNER are configured to work with mysql.
这篇关于声纳运行器(ubuntu)执行失败:com.mysql.jdbc.Driver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!