SonarQube Server 6.1 错误:字符串值不正确:'\xF0\x9F\x92\x9A S

Posted

技术标签:

【中文标题】SonarQube Server 6.1 错误:字符串值不正确:\'\\xF0\\x9F\\x92\\x9A S【英文标题】:SonarQube Server 6.1 Error: Incorrect string value: '\xF0\x9F\x92\x9A SSonarQube Server 6.1 错误:字符串值不正确:'\xF0\x9F\x92\x9A S 【发布时间】:2017-03-26 10:58:51 【问题描述】:

sonarcube 服务器 6.1 上的 sonarqube runner 2.4 能够成功分析并生成报告,但服务器无法处理报告并引发以下错误:

2016.11.12 13:41:05 TRACE ce[AVhXlYUu6eaRvX5y_I2S][sql] 时间=265ms | sql = INSERT INTO问题(kee,rule_id,严重性,manual_severity,消息,行,位置,差距,努力,状态,标签,分辨率,校验和,受让人,author_login,issue_attributes,issue_creation_date,issue_update_date,issue_close_date,created_at,updated_at,component_uuid, project_uuid, issue_type) 值 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?) | params=AVhXlgd3R6hiEKFMKI0Y, 417, MAJOR, false, Class "Command" 有34个方法,大于20个授权。把它分解成更小的类。,32,[B @ 51e88e5,8,60,OPEN,脑过载,12,56a5cf39bde2227246f55f9c64d17971,12,12日,1478937725000,1478937725000,-5,1478938264903,1478938264903,AVhXcDrFyWOqRIX3Ks1c,AVhXcBE2vDxoF5vpXWIC,1 2016.11.12 13:41:07 错误 ce[AVhXlYUu6eaRvX5y_I2S][o.s.s.c.t.CeWorkerCallableImpl] 无法执行任务 AVhXlYUu6eaRvX5y_I2S org.apache.ibatis.exceptions.PersistenceException:

提交事务时出错。原因:org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #2) 失败。 1 个先前的子执行者成功完成,但将被回滚。原因:java.sql.BatchUpdateException:不正确的字符串值:'\xF0\x9F\x92\x9A S...' for column 'message' at row 189

原因:org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #2) 失败。 1 个先前的子执行者成功完成,但将被回滚。原因:java.sql.BatchUpdateException:不正确的字符串值:'\xF0\x9F\x92\x9A S...' for column 'message' at row 189

系统配置是 森托斯 mysql Ver 14.14 Distrib 5.7.16,适用于 Linux (x86_64),使用 EditLine 包装器

数据库集:

mysql>  SHOW VARIABLES LIKE 'char%';

+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

由于某种原因,服务器试图将 UTF8mb4 而不是 utf-8 字符插入到表“问题”中。

16 年 11 月 15 日编辑

以下 JDBC URL 已添加到 Sonar runner 和 sonar server- sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar??useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

请在下面找到 MySQL 上的字节流:

    0, 'Remove this unused "$definition" local variable.', 106,
x'0A08086A106A180C2017',
null, 5, 'OPEN',
'unused', null, '99ac744eeafa6b37f7e8eac5c646437c',
null, null,
'',
1479190059000,1479190059000, null,
1479190593317, 1479190593317,
'AVhmn_WkMWzR03Kl-FYv', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE2ZMWzR03Kl-I4i', 480,
'CRITICAL',
0, 'Define a constant instead of duplicating this literal "raw_text" 4 times.', 152,
x'0A0A089801109801181B2025120E0A0C120A089801109801181B2025120E0A0C120A0898011098011834203E120E0A0C120A08C20110C201181B2025120E0A0C120A08C20110C2011834203E',
4.0, 10, 'OPEN',
'design', null, '60c1c8e7e300be894ca50e3d8148a45e',
null, null,
'',
1479190059000,1479190059000, null,
1479190593317, 1479190593317,
'AVhmn_WkMWzR03Kl-FYw', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE2ZMWzR03Kl-I4j', 480,
'CRITICAL',
0, 'Define a constant instead of duplicating this literal "name_width" 6 times.', 38,
x'0A080826102618242030120C0A0A12080826102618242030120C0A0A120808261026183E204A120C0A0A1208083A103A18242030120C0A0A1208083A103A183E204A120C0A0A1208085C105C18542060120C0A0A1208086910691850205C',
6.0, 14, 'OPEN',
'design', null, '8ff134e37a45467429fb6ed08813ef27',
null, null,
'',
1479190059000,1479190059000, null,
1479190593318, 1479190593318,
'AVhmn_WkMWzR03Kl-FYw', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE2ZMWzR03Kl-I4k', 475,
'MINOR',
0, 'Remove the literal "true" boolean value.', 195,
x'0A0A08C30110C3011846204A',
null, 2, 'OPEN',
'clumsy', null, 'c24b378689aac9d485209fd0a4e3ade1',
null, null,
'',
1479190059000,1479190059000, null,
1479190593319, 1479190593319,
'AVhmn_WkMWzR03Kl-FYw', 'AVhmn8tKDHDOdW61_fap', 1)
2016-11-15T06:16:33.374835Z    12 Query rollback
2016-11-15T06:16:33.390547Z    12 Query SET autocommit=1
2016-11-15T06:16:35.947505Z    12 Query SELECT 1
2016-11-15T06:16:35.948774Z    12 Query SET autocommit=0
2016-11-15T06:16:35.949893Z    12 Query select

cq.uuid,
cq.task_type as taskType,
cq.component_uuid as componentUuid,
cq.status as status,
cq.submitter_login as submitterLogin,
cq.started_at as startedAt,
cq.created_at as createdAt,
cq.updated_at as updatedAt

from ce_queue cq
where cq.uuid='AVhmn81bDHDOdW61_faq'
2016-11-15T06:16:35.957953Z    12 Query insert into ce_activity (
  uuid,
  component_uuid,
  analysis_uuid,
  status,
  task_type,
  is_last,
  is_last_key,
  submitter_login,
  submitted_at,
  started_at,
  executed_at,
  created_at,
  updated_at,
  execution_time_ms,
  error_message,
  error_stacktrace
)
values (
  'AVhmn81bDHDOdW61_faq',
  'AVhmn8tKDHDOdW61_fap',
  null,
  'FAILED',
  'REPORT',
  0,
  'REPORTAVhmn8tKDHDOdW61_fap',
  'admin',
  1479190500789,
  1479190502631,
  1479190595952,
  1479190595955,
  1479190595955,
  93321,
  '\n### Error committing transaction.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189\n### Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189',
  'org.apache.ibatis.exceptions.PersistenceException: \n### Error committing transaction.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189\n### Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189\n at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)\n  at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:177)\n    at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:169)\n    at org.sonar.db.DbSession.commit(DbSession.java:41)\n   at org.sonar.db.BatchSession.commit(BatchSession.java:168)\n    at org.sonar.db.BatchSession.increment(BatchSession.java:205)\n at org.sonar.db.BatchSession.insert(BatchSession.java:125)\n    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:51)\n   at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)\n  at com.sun.proxy.$Proxy48.insert(Unknown Source)\n  at org.sonar.server.computation.task.projectanalysis.step.PersistIssuesStep.execute(PersistIssuesStep.java:71)\n    at org.sonar.server.computation.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:64)\n   at org.sonar.server.computation.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:52)\n    at org.sonar.server.computation.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:75)\n   at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.executeTask(CeWorkerCallableImpl.java:84)\n  at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:57)\n at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:35)\n at java.util.concurrent.FutureTask.run(FutureTask.java:266)\n   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n    at java.util.concurrent.FutureTask.run(FutureTask.java:266)\n   at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)\n  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)\n at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n    at java.lang.Thread.run(Thread.java:745)\nCaused by: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189\n  at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:127)\n at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:114)\n at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:109)\n at org.apache.ibatis.executor.BaseExecutor.commit(BaseExecutor.java:201)\n  at org.apache.ibatis.executor.CachingExecutor.commit(CachingExecutor.java:104)\n    at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:174)\n    ... 23 more\nCaused by: java.sql.BatchUpdateException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189\n    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\n  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)\n   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\n   at java.lang.reflect.Constructor.newInstance(Constructor.java:423)\n    at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)\n   at com.mysql.jdbc.Util.getInstance(Util.java:387)\n at com.mysql.jdbc.SQLError.createBatchUpdateException(SQLError.java:1161)\n at com.mysql.jdbc.PreparedStatement.executeBatchedInserts(PreparedStatement.java:1582)\n    at com.mysql.jdbc.PreparedStatement.executeBatchInternal(PreparedStatement.java:1248)\n at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:958)\n  at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)\n at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)\n at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)\n   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n  at java.lang.reflect.Method.invoke(Method.java:498)\n   at org.sonar.db.profiling.InvocationUtils.invokeQuietly(InvocationUtils.java:34)\n  at org.sonar.db.profiling.ProfilingPreparedStatementHandler.invoke(ProfilingPreparedStatementHandler.java:45)\n at com.sun.proxy.$Proxy24.executeBatch(Unknown Source)\n    at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:103)\n ... 28 more\nCaused by: java.sql.SQLException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189\n    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)\n  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)\n at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)\n at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)\n  at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)\n   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)\n    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)\n  at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2073)\n    at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2009)\n    at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5098)\n   at com.mysql.jdbc.PreparedStatement.executeBatchedInserts(PreparedStatement.java:1543)\n    ... 39 more\n'
)
2016-11-15T06:16:35.960623Z    12 Query select uuid
from ce_activity
where is_last_key='REPORTAVhmn8tKDHDOdW61_fap'
  and status <> 'CANCELED'
order by id desc

16 年 11 月 16 日编辑

最后几次提交错误 TABLE 'issues'

2016-11-15T06:16:33.100057Z    12 Query commit
2016-11-15T06:16:33.326963Z    12 Query INSERT INTO issues (kee, rule_id, severity, manual_severity,
message, line, locations, gap, effort, status, tags,
resolution, checksum, assignee, author_login, issue_attributes, issue_creation_date, issue_update_date,
issue_close_date, created_at, updated_at, component_uuid, project_uuid, issue_type)
VALUES ('AVhmoExZMWzR03Kl-I0r', 480,
'CRITICAL',
0, 'Define a constant instead of duplicating this literal "Australia/Brisbane" 4 times.', 51,
x'0A08083310331826203A120C0A0A1208083310331826203A120E0A0C120A08AF0110AF011826203A120E0A0C120A08A50210A50218242038120E0A0C120A08E30210E302180E2022',
4.0, 10, 'OPEN',
'design', null, '4c83bf60e890268e4c28fc0d535fbead',
null, null,

 '',
1479190059000,1479190059000, null,
1479190593306, 1479190593306,
'AVhmn_WjMWzR03Kl-FYn', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE13MWzR03Kl-I4W', 463,
'MAJOR',
0, 'Remove the unused function parameter "$input".', 191,
x'0A0A08BF0110BF0118312037',
null, 5, 'OPEN',
'cert,misra,unused', null, '2537f941461c393954f764887895a456',
null, null,
'',
1479190059000,1479190059000, null,
1479190593307, 1479190593307,
'AVhmn_WjMWzR03Kl-FYn', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE13MWzR03Kl-I4X', 463,
'MAJOR',
0, 'Remove the unused function parameter "$output".', 191,
x'0A0A08BF0110BF0118492050',
null, 5, 'OPEN',
'cert,misra,unused', null, '2537f941461c393954f764887895a456',
null, null,
'',
1479190059000,1479190059000, null,
1479190593308, 1479190593308,
'AVhmn_WjMWzR03Kl-FYn', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE13MWzR03Kl-I4Y', 417,
'MAJOR',
0, 'Class "Command" has 34 methods, which is greater than 20 authorized. Split it into smaller classes.', 32,
x'0A080820102018002005',
null, 60, 'OPEN',
'brain-overload', null, '56a5cf39bde2227246f55f9c64d17971',
null, null,
'',
1479190059000,1479190059000, null,
1479190593308, 1479190593308,
'AVhmn_WjMWzR03Kl-FYn', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE14MWzR03Kl-I4Z', 486,
'MAJOR',
0, 'Rename "$name" which has the same name as the field declared at line 35.', 520,
x'0A0A0888041088041808200D120C0A0A120808231023180C2011',
null, 5, 'OPEN',
'cert,pitfall', null, '4387290590318a46e73a00de79200861',
null, null,
'',
1479190059000,1479190059000, null,
1479190593309, 1479190593309,
'AVhmn_WjMWzR03Kl-FYn', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE19MWzR03Kl-I4a', 480,
'CRITICAL',
0, 'Define a constant instead of duplicating this literal "format" 4 times.', 41,
x'0A080829102918202028120C0A0A12080829102918202028120C0A0A120808501050181E2026120C0A0A120808551055180C2014120C0A0A120808551055182A2032',
4.0, 10, 'OPEN',
'design', null, '16686315e25cf56e4ddca44fccd55317',
null, null,
'',
1479190059000,1479190059000, null,
1479190593310, 1479190593310,
'AVhmn_WkMWzR03Kl-FYo', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE2BMWzR03Kl-I4b', 480,
'CRITICAL',
0, 'Define a constant instead of duplicating this literal "format" 4 times.', 72,
x'0A0808481048181E2026120C0A0A120808481048181E2026120C0A0A1208084D104D180C2014120C0A0A1208084D104D182D2035120C0A0A1208085C105C181C2024',
4.0, 10, 'OPEN',
'design', null, '0e27a71d30ca3a85d427d4187dcd2509',
null, null,
'',
1479190059000,1479190059000, null,
1479190593311, 1479190593311,
'AVhmn_WkMWzR03Kl-FYp', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE2BMWzR03Kl-I4c', 480,
'CRITICAL',
0, 'Define a constant instead of duplicating this literal "namespace" 3 times.', 79,
x'0A08084F104F180C2017120C0A0A1208084F104F180C2017120C0A0A1208084F104F182F203A120C0A0A120808591059181E2029',
3.0, 8, 'OPEN',
'design', null, '1a02bd65046ea1936adb8f6b555770e3',
null, null,
'',
1479190059000,1479190059000, null,
1479190593312, 1479190593312,
'AVhmn_WkMWzR03Kl-FYp', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE2QMWzR03Kl-I4d', 480,
'CRITICAL',
0, 'Define a constant instead of duplicating this literal "description" 3 times.', 103,
x'0A0808671067180C2019120C0A0A120808671067180C2019120C0A0A120808791079180C2019120E0A0C120A089F01109F01180C2019',
3.0, 8, 'OPEN',
'design', null, '9936da4d327342ba3432096385e745fc',
null, null,
'',
1479190059000,1479190059000, null,
1479190593313, 1479190593313,
'AVhmn_WkMWzR03Kl-FYu', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE2QMWzR03Kl-I4e', 480,
'CRITICAL',
0, 'Define a constant instead of duplicating this literal "namespace" 3 times.', 64,
x'0A0808401040182D2038120C0A0A120808401040182D2038120C0A0A12080840104018462051120C0A0A120808491049182D2038',
3.0, 8, 'OPEN',
'design', null, '6912cec8ed8dd70391c1cc14d15130d1',
null, null,
'',
1479190059000,1479190059000, null,
1479190593314, 1479190593314,
'AVhmn_WkMWzR03Kl-FYu', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE2UMWzR03Kl-I4f', 480,
'CRITICAL',
0, 'Define a constant instead of duplicating this literal "<none>" 6 times.', 34,
x'0A080822102218312039120C0A0A12080822102218312039120C0A0A120808251025183F2047120C0A0A1208083210321875207D120C0A0A120808361036183D2045120C0A0A120808601060183E2046120C0A0A120808621062186E2076',
6.0, 14, 'OPEN',
'design', null, '1b6527507aa924b426507804f2901b43',
null, null,
'',
1479190059000,1479190059000, null,
1479190593315, 1479190593315,
'AVhmn_WkMWzR03Kl-FYv', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE2UMWzR03Kl-I4g', 480,
'CRITICAL',
0, 'Define a constant instead of duplicating this literal "* Description: " 3 times.', 37,
x'0A0808251025180D201E120C0A0A120808251025180D201E120C0A0A120808361036180D201E120C0A0A120808601060180D201E',
3.0, 8, 'OPEN',
'design', null, 'a30f23c3ee9c6650ad296e3e26ec6260',
null, null,
'',
1479190059000,1479190059000, null,
1479190593316, 1479190593316,
'AVhmn_WkMWzR03Kl-FYv', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE2UMWzR03Kl-I4h', 468,
'MINOR',
0, 'Remove this unused "$definition" local variable.', 106,
x'0A08086A106A180C2017',
null, 5, 'OPEN',
'unused', null, '99ac744eeafa6b37f7e8eac5c646437c',
null, null,
'',
1479190059000,1479190059000, null,
1479190593317, 1479190593317,
'AVhmn_WkMWzR03Kl-FYv', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE2ZMWzR03Kl-I4i', 480,
'CRITICAL',
0, 'Define a constant instead of duplicating this literal "raw_text" 4 times.', 152,
x'0A0A089801109801181B2025120E0A0C120A089801109801181B2025120E0A0C120A0898011098011834203E120E0A0C120A08C20110C201181B2025120E0A0C120A08C20110C2011834203E',
4.0, 10, 'OPEN',
'design', null, '60c1c8e7e300be894ca50e3d8148a45e',
null, null,
'',
1479190059000,1479190059000, null,
1479190593317, 1479190593317,
'AVhmn_WkMWzR03Kl-FYw', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE2ZMWzR03Kl-I4j', 480,
'CRITICAL',
0, 'Define a constant instead of duplicating this literal "name_width" 6 times.', 38,
x'0A080826102618242030120C0A0A12080826102618242030120C0A0A120808261026183E204A120C0A0A1208083A103A18242030120C0A0A1208083A103A183E204A120C0A0A1208085C105C18542060120C0A0A1208086910691850205C',
6.0, 14, 'OPEN',
'design', null, '8ff134e37a45467429fb6ed08813ef27',
null, null,
'',
1479190059000,1479190059000, null,
1479190593318, 1479190593318,
'AVhmn_WkMWzR03Kl-FYw', 'AVhmn8tKDHDOdW61_fap', 1),('AVhmoE2ZMWzR03Kl-I4k', 475,
'MINOR',
0, 'Remove the literal "true" boolean value.', 195,
x'0A0A08C30110C3011846204A',
null, 2, 'OPEN',
'clumsy', null, 'c24b378689aac9d485209fd0a4e3ade1',
null, null,
'',
1479190059000,1479190059000, null,
1479190593319, 1479190593319,
'AVhmn_WkMWzR03Kl-FYw', 'AVhmn8tKDHDOdW61_fap', 1)
2016-11-15T06:16:33.374835Z    12 Query rollback
2016-11-15T06:16:33.390547Z    12 Query SET autocommit=1
2016-11-15T06:16:35.947505Z    12 Query SELECT 1
2016-11-15T06:16:35.948774Z    12 Query SET autocommit=0
2016-11-15T06:16:35.949893Z    12 Query select

cq.uuid,
cq.task_type as taskType,
cq.component_uuid as componentUuid,
cq.status as status,
cq.submitter_login as submitterLogin,
cq.started_at as startedAt,
cq.created_at as createdAt,
cq.updated_at as updatedAt

from ce_queue cq
where cq.uuid='AVhmn81bDHDOdW61_faq'
2016-11-15T06:16:35.957953Z    12 Query insert into ce_activity (
  uuid,
  component_uuid,
  analysis_uuid,
  status,
  task_type,
  is_last,
  is_last_key,
  submitter_login,
  submitted_at,
  started_at,
  executed_at,
  created_at,
  updated_at,
  execution_time_ms,
  error_message,
  error_stacktrace
)
values (
  'AVhmn81bDHDOdW61_faq',
  'AVhmn8tKDHDOdW61_fap',
  null,
  'FAILED',
  'REPORT',
  0,
  'REPORTAVhmn8tKDHDOdW61_fap',
  'admin',
  1479190500789,
  1479190502631,
  1479190595952,
  1479190595955,
  1479190595955,
  93321,
  '\n### Error committing transaction.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189\n### Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189',
  'org.apache.ibatis.exceptions.PersistenceException: \n### Error committing transaction.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189\n### Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189\n at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)\n  at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:177)\n    at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:169)\n    at org.sonar.db.DbSession.commit(DbSession.java:41)\n   at org.sonar.db.BatchSession.commit(BatchSession.java:168)\n    at org.sonar.db.BatchSession.increment(BatchSession.java:205)\n at org.sonar.db.BatchSession.insert(BatchSession.java:125)\n    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:51)\n   at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)\n  at com.sun.proxy.$Proxy48.insert(Unknown Source)\n  at org.sonar.server.computation.task.projectanalysis.step.PersistIssuesStep.execute(PersistIssuesStep.java:71)\n    at org.sonar.server.computation.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:64)\n   at org.sonar.server.computation.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:52)\n    at org.sonar.server.computation.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:75)\n   at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.executeTask(CeWorkerCallableImpl.java:84)\n  at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:57)\n at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:35)\n at java.util.concurrent.FutureTask.run(FutureTask.java:266)\n   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n    at java.util.concurrent.FutureTask.run(FutureTask.java:266)\n   at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)\n  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)\n at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n    at java.lang.Thread.run(Thread.java:745)\nCaused by: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189\n  at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:127)\n at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:114)\n at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:109)\n at org.apache.ibatis.executor.BaseExecutor.commit(BaseExecutor.java:201)\n  at org.apache.ibatis.executor.CachingExecutor.commit(CachingExecutor.java:104)\n    at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:174)\n    ... 23 more\nCaused by: java.sql.BatchUpdateException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189\n    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\n  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)\n   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\n   at java.lang.reflect.Constructor.newInstance(Constructor.java:423)\n    at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)\n   at com.mysql.jdbc.Util.getInstance(Util.java:387)\n at com.mysql.jdbc.SQLError.createBatchUpdateException(SQLError.java:1161)\n at com.mysql.jdbc.PreparedStatement.executeBatchedInserts(PreparedStatement.java:1582)\n    at com.mysql.jdbc.PreparedStatement.executeBatchInternal(PreparedStatement.java:1248)\n at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:958)\n  at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)\n at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)\n at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)\n   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n  at java.lang.reflect.Method.invoke(Method.java:498)\n   at org.sonar.db.profiling.InvocationUtils.invokeQuietly(InvocationUtils.java:34)\n  at org.sonar.db.profiling.ProfilingPreparedStatementHandler.invoke(ProfilingPreparedStatementHandler.java:45)\n at com.sun.proxy.$Proxy24.executeBatch(Unknown Source)\n    at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:103)\n ... 28 more\nCaused by: java.sql.SQLException: Incorrect string value: \'\\xF0\\x9F\\x92\\x9A S...\' for column \'message\' at row 189\n    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)\n  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)\n at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)\n at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)\n  at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)\n   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)\n    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)\n  at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2073)\n    at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2009)\n    at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5098)\n   at com.mysql.jdbc.PreparedStatement.executeBatchedInserts(PreparedStatement.java:1543)\n    ... 39 more\n'
)

【问题讨论】:

我在错误消息中看到“不正确的字符串值”,但在“values()”中没有;它在哪里? @RickJames。我也找不到值中的字符串。我在其结构中添加了最后几次提交的错误 TABLE 'issues'。谢谢 这些十六进制字符串似乎也不相关。 @RickJames。那么有什么解决办法呢?它是表“问题”中的消息列。 issues 听起来像是一个监控系统,而不是真正的系统。回到你的代码。 【参考方案1】:

\xF0\x9F\x92\x9A 是 ? 的 utf8mb4 编码。您需要确定客户端具有 utf8mb4 字节。

假设您使用的是 JDBC,请将 ?useUnicode=yes&amp;characterEncoding=UTF-8 添加到 JDBC URL。

如果还有更多问题,请提供更多关于流经您系统的字节的详细信息。

【讨论】:

JDBC URL 已经存在。请找到问题添加的字节流。 你有&amp;characterEncoding=utf8;我不知道那个拼写是否等同于&amp;characterEncoding=UTF-8 我尝试使用 UTF-8。 Sonar 引发异常 - JDBC URL 必须具有属性 'characterEncoding=utf8' 它也不接受那个,它只接受'true'。 进行快速搜索似乎比yes 更频繁地出现trueutf8UTF-8 同上。也许他们虚假地改变了语法?【参考方案2】:

正如 Rick James 所回答的,当问题的消息包含表情符号时,就会出现问题。根本原因是表具有名为 utf8... 的字符集,这不是 MySQL 上的 UTF-8。确实只有 utf8mb4 支持 4 字节字符,如表情符号。

由于此约束对在 MySQL 上设计数据模型的方式有很大的副作用,因此修复并不简单。目前唯一的解决方法是从分析中排除带有表情符号的源文件。

在https://jira.sonarsource.com/browse/SONAR-8496 中跟踪问题。

【讨论】:

我认为 Sonar 应该在 UTF-8 之前添加 utf8mb4 配置元素,因为现在更常用的是符号。无论如何,现在我已经转移到另一个已解决问题的数据库。谢谢。 使用 charset utf8mb4 不仅仅是配置问题。它会影响被索引的列的大小。

以上是关于SonarQube Server 6.1 错误:字符串值不正确:'\xF0\x9F\x92\x9A S的主要内容,如果未能解决你的问题,请参考以下文章

Maven 和 SonarTsPlugin 的 SonarQube 扫描仪无法运行节点

升级到 Server 4.0 和 Xcode 6.1,SSH git 遥控器坏了

SonarQube 在具有集成身份验证的 SQL Server 上作为 Windows 服务运行 - 有人有工作示例吗?

##[错误]错误:超出 GC 开销限制 - TFS 构建中的 SonarQube

Sonarqube 扫描错误,行超出范围?

对文件执行责备时发生 SonarQube 错误