[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.1:sonar (default-cli) on project video.parent: Can not execute SonarQube analysis: The current batch process and the configured remote server do not share the same DB configuration. [ERROR] - Batch side: jdbc:mysql://ip:port/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true (user / *****) [ERROR] - Server side: check the configuration at http://ip:port/sonar/system [ERROR] -> [Help 1]
很奇怪,看了下sonar跟jenkins的配置DB这个URL是一致的,后面看到有说其实不是比较这个URL,而是ID,
如是看了下:
①http://server:port/sonar/api/server
②以及sonar数据库
select * from properties where prop_key = 'sonar.core.id'
发现这两个ID是不一致的,这个不知道为什么不一致,因为只有一个sonar实例啊!后面重启了sonar,不行
再后面重启Jenkins与sonar后两个ID一致了,服务恢复正常。先记录下吧,具体还是搞透。求大神指导
还有种比较极端暴力的做法的方法
直接将sonar数据库的这个值改成http://server:port/sonar/api/server看到的
update properties set text_value='20140514122555' where prop_key = 'sonar.core.id' ;
javax.persistence.NonUniqueResultException": Expected single result, but got
解决方案:https://jira.codehaus.org/browse/SONAR-2329
mysql
update snapshots old_snap, snapshots new_snap set old_snap.islast=0 where old_snap.islast=1 and new_snap.created_at > old_snap.created_at and new_snap.project_id = old_snap.project_id and new_snap.islast=1
SonarException: The project is already been analysing.
解决方案:http://www.rodrigozrusso.com/2014/01/07/sonarexception-the-project-is-already-been-analysing/
The solution:
Basically you need delete the rows in the “semaphores” table that SonarQube creates.
Step-by-step:
1) Connect to mysql
1mysql -usonar -psonar
2) Choose database
1use sonar;
3) Only for sure, verify is there is any semaphore
1select
*
from
semaphores;
You will see something like that:
1234567mysql>
select
*
from
semaphores;
+
----+---------------------------------------------------------------+----------------------------------+---------------------+---------------------+---------------------+
| id |
name
| checksum | locked_at | created_at | updated_at |
+
----+---------------------------------------------------------------+----------------------------------+---------------------+---------------------+---------------------+
| 36 | batch-com.xpto.lala:lala-services | 9d84653cc13991219a9f69bed1242c9e | 2013-04-11 19:20:40 | 2013-04-11 19:20:40 | 2013-04-11 19:20:40 |
+
----+---------------------------------------------------------------+----------------------------------+---------------------+---------------------+---------------------+
1 row
in
set
(0.00 sec)
4) Delete the semaphore
大概报错:
1delete
from
semaphores;
mavenExecutionResult exceptions not empty message : Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1-alpha-2:attached-rpm (attach-rpm) on project xx-web: RPM build execution returned: '1' executing '/bin/sh -c cd /data/hudson/jobs/xx-web-test/workspace/xx-web/target/rpm/xx-web/SPECS && rpmbuild -bb --buildroot /data/hudson/jobs/xx-web-test/workspace/xx-web/target/rpm/xx-web/buildroot --define '_topdir /data/hudson/jobs/xx-web-test/workspace/xx-web/target/rpm/xx-web' --target noarch-redhat-linux xx-web.spec' cause : RPM build execution returned: '1' executing '/bin/sh -c cd /data/hudson/jobs/xx-web-test/workspace/xx-web/target/rpm/xx-web/SPECS && rpmbuild -bb --buildroot /data/hudson/jobs/xx-web-test/workspace/xx-web/target/rpm/xx-web/buildroot --define '_topdir /data/hudson/jobs/xx-web-test/workspace/xx-web/target/rpm/xx-web' --target noarch-redhat-linux xx-web.spec' Stack trace : org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1-alpha-2:attached-rpm (attach-rpm) on project xx-web: RPM build execution returned: '1' executing '/bin/sh -c cd /data/hudson/jobs/xx-web-test/workspace/xx-web/target/rpm/xx-web/SPECS && rpmbuild -bb --buildroot /data/hudson/jobs/xx-web-test/workspace/xx-web/target/rpm/xx-web/buildroot --define '_topdir /data/hudson/jobs/xx-web-test/workspace/xx-web/target/rpm/xx-web' --target noarch-redhat-linux xx-web.spec' Caused by: org.apache.maven.plugin.MojoExecutionException: RPM build execution returned: '1' executing '/bin/sh -c cd /data/hudson/jobs/xx-web-test/workspace/xx-web/target/rpm/xx-web/SPECS && rpmbuild -bb --buildroot /data/hudson/jobs/xx-web-test/workspace/xx-web/target/rpm/xx-web/buildroot --define '_topdir /data/hudson/jobs/xx-web-test/workspace/xx-web/target/rpm/xx-web' --target noarch-redhat-linux xx-web.spec'
看了log,提示:
[WARNING] + rm -f /data/hudson/jobs/uc-web-test/workspace/xx-web/target/xx-web-4.3.3-RC01.zip [WARNING] + cp /data/hudson/jobs/xx-web-test/workspace/xx-web/target/rpm/uc-web/RPMS/noarch/xx-web-4.3.3-RC01_1.noarch.rpm[WARNING] cp: missing destination file operand after `/data/hudson/jobs/xx-web-test/workspace/uc-web/target/rpm/uc-web/RPMS/noarch/xx-web-4.3.3-RC01_1.noarch.rpm'
[WARNING] Try `cp --help' for more information.[WARNING] error: Bad exit status from /var/tmp/rpm-tmp.1D2Do9 (%clean)[WARNING] Bad exit status from /var/tmp/rpm-tmp.1D2Do9 (%clean)看了这个很明显了[WARNING] cp: missing destination file operand after `/data/hudson/jobs/xx-web-test/workspace/uc-web/target/rpm/uc-web/RPMS/noarch/xx-web-4.3.3-RC01_1.noarch.rpm'看了下pom.xml文件
<groupId>org.codehaus.mojo</groupId> <artifactId>rpm-maven-plugin</artifactId> <version>2.1-alpha-2</version> <configuration> <cleanScriptlet> <script> rm -f ${project.build.directory}/${project.build.finalName}.zip cp ${project.build.directory}/rpm/*/RPMS/noarch/*.rpm ${project.build.directory}/${project.build.finalName}.rpm </script> </cleanScriptlet> <configuration/>卧槽这不就对了么原本是这样的<groupId>org.codehaus.mojo</groupId> <artifactId>rpm-maven-plugin</artifactId> <version>2.1-alpha-2</version> <configuration> <cleanScriptlet> <script> rm -f ${project.build.directory}/${project.build.finalName}.zip cp ${project.build.directory}/rpm/*/RPMS/noarch/*.rpm ${project.build.directory}/${project.build.finalName}.rpm </script> </cleanScriptlet> <configuration/>