0

将 Sonar 从版本 3.5.1 更新到 3.7 后,Eclipse 中的本地分析不再起作用。从 3.7.0 升级到 3.7.2 并没有改变这种情况。eclipse indigo ( Sonar Java Analyser and Sonar m2e Connector version 3.2.0.20130627-1142-RELEASE) 中的错误消息是:

INFO: Sonar Server 3.7.2
11:34:08.423 INFO  - Load batch settings
11:34:08.619 INFO  - User cache: C:\Users\xxxx\.sonar\cache
11:34:08.627 INFO  - Install plugins
11:34:08.661 INFO  - Exclude plugins: devcockpit, jira, pdfreport, views, report, scmactivity
11:34:11.218 INFO  - Dry run
Exception in thread "main" org.sonar.runner.impl.RunnerException: Unable to execute Sonar
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:79)
    at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:63)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:57)
    at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
    at org.sonar.runner.impl.BatchLauncherMain.execute(BatchLauncherMain.java:41)
    at org.sonar.runner.impl.BatchLauncherMain.main(BatchLauncherMain.java:59)
Caused by: org.sonar.api.utils.HttpDownloader$HttpException: Fail to download [http://sonar-server:9000/batch_bootstrap/db?project=com.project:xxx.yyy]. Response code: 500
    at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:279)
    at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:235)
    at com.google.common.io.ByteStreams.copy(ByteStreams.java:116)
    at com.google.common.io.Files.copy(Files.java:231)
    at org.sonar.batch.bootstrap.ServerClient.download(ServerClient.java:69)
    at org.sonar.batch.bootstrap.DryRunDatabase.downloadDatabase(DryRunDatabase.java:88)
    at org.sonar.batch.bootstrap.DryRunDatabase.start(DryRunDatabase.java:70)
    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:601)
    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:601)
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:75)
    ... 6 more

在我们的声纳服务器上的 sonar.log 文件中,我发现了以下堆栈跟踪:

ERROR o.s.c.p.DbTemplate  Fail to copy table rules
org.h2.jdbc.JdbcBatchUpdateException: 
Unique index or primary key violation: "RULES_PLUGIN_KEY_AND_NAME ON PUBLIC.RULES(PLUGIN_RULE_KEY, PLUGIN_NAME)"; SQL statement:
INSERT INTO rules(ID,PLUGIN_RULE_KEY,PLUGIN_NAME,DESCRIPTION,PRIORITY,CARDINALITY,PARENT_ID,PLUGIN_CONFIG_KEY,NAME,STATUS,LANGUAGE,CREATED_AT,UPDATED_AT) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?) [23505-172]
 at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1167) ~[h2-1.3.172.jar:1.3.172]
        at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297) ~[commons-dbcp-1.4.jar:1.4]
        at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297) ~[commons-dbcp-1.4.jar:1.4]
        at org.sonar.core.persistence.DbTemplate.copyTable(DbTemplate.java:85) [sonar-core-3.7.2.jar:na]
        at org.sonar.core.persistence.DbTemplate.copyTable(DbTemplate.java:46) [sonar-core-3.7.2.jar:na]
        at org.sonar.core.persistence.DryRunDatabaseFactory.copy(DryRunDatabaseFactory.java:83) [sonar-core-3.7.2.jar:na]
        at org.sonar.core.persistence.DryRunDatabaseFactory.createNewDatabaseForDryRun(DryRunDatabaseFactory.java:60) [sonar-core-3.7.2.jar:na]
        at org.sonar.core.dryrun.DryRunCache.generateNewDB(DryRunCache.java:121) [sonar-core-3.7.2.jar:na]
        at org.sonar.core.dryrun.DryRunCache.getDatabaseForDryRun(DryRunCache.java:81) [sonar-core-3.7.2.jar:na]
        at org.sonar.server.ui.JRubyFacade.createDatabaseForDryRun(JRubyFacade.java:500) [classes/:na]

我试图通过查看声纳源代码来找出问题所在,但没有更深入的了解声纳想要做什么,我无法知道如何解决问题。有没有人有任何提示?

4

1 回答 1

0

我遇到了这个问题,它阻止了来自 Eclipse 的分析(因为 Sonar 为空运行创建了数据库的 H2 副本)。

问题是我在数据库中有两次相同的用户登录,一旦我删除其中一个就可以了。

于 2014-01-24T10:50:43.983 回答