1. 程式人生 > >SonarQube安裝異常之Cause: java.sql.BatchUpdateException: Cannot execute statement: impossible to write to

SonarQube安裝異常之Cause: java.sql.BatchUpdateException: Cannot execute statement: impossible to write to

1.異常描述

2018.12.13 11:11:42 ERROR web[o.s.s.ui.JRubyFacade]  Fail to upgrade database
org.sonar.core.properties.PropertiesMapper.deleteGlobalProperty (batch index #1) failed. Cause: java.sql.BatchUpdateException: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT =
STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:127) org.apache.ibatis.executor.
BaseExecutor.flushStatements(BaseExecutor.java:114) org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:109) org.apache.ibatis.executor.BaseExecutor.commit(BaseExecutor.java:201) org.apache.ibatis.executor.CachingExecutor.commit(CachingExecutor.java:104) org.apache.ibatis.session.
defaults.DefaultSqlSession.commit(DefaultSqlSession.java:174) org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:169) org.sonar.core.persistence.DbSession.commit(DbSession.java:58) org.sonar.core.persistence.BatchSession.commit(BatchSession.java:170) org.sonar.core.properties.PropertiesDao.saveGlobalProperties(PropertiesDao.java:229) org.sonar.server.platform.PersistentSettings.saveProperties(PersistentSettings.java:78) org.sonar.server.startup.ServerMetadataPersister.start(ServerMetadataPersister.java:44) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89) org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) org.picocontainer.behaviors.Stored.start(Stored.java:110) org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1015) org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1008) org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:766) org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) org.sonar.server.platform.Platform.startLevel34Containers(Platform.java:116) org.sonar.server.platform.Platform.doStart(Platform.java:81) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:440) org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:304) org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:52) org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306) org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136) org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60) org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) org.jruby.ast.BlockNode.interpret(BlockNode.java:71) org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74) org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139) org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182) org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306) org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136) org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60) org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) org.jruby.ast.BlockNode.interpret(BlockNode.java:71) org.jruby.ast.RescueNode.executeBody(RescueNode.java:221) org.jruby.ast.RescueNode.interpret(RescueNode.java:116) org.jruby.ast.BeginNode.interpret(BeginNode.java:83) org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112) org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:384) org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:336) org.jruby.runtime.BlockBody.call(BlockBody.java:73) org.jruby.runtime.Block.call(Block.java:101) org.jruby.RubyProc.call(RubyProc.java:290) org.jruby.RubyProc.call(RubyProc.java:228) org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:97) java.lang.Thread.run(Thread.java:748)

2.解決方案

2.1 配置修改

[root@izwz91h49n3mj8r232gqwez ~]# vim /etc/my.cnf

新增如下配置

binlog_format=mixed

在這裡插入圖片描述

2.2.重啟mysql服務

[root@izwz91h49n3mj8r232gqwez ~]# service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service

2.3. 重啟sonarqube

[root@izwz91h49n3mj8r232gqwez bin]# pwd
/opt/sonarqube/bin
[root@izwz91h49n3mj8r232gqwez bin]# ll
total 40
drwxr-xr-x 2 root root 4096 Feb 26  2015 jsw-license
drwxr-xr-x 3 root root 4096 Dec  9  2010 linux-ppc-64
drwxr-xr-x 3 root root 4096 Dec  9  2010 linux-x86-32
drwxr-xr-x 3 root root 4096 Dec  9  2010 linux-x86-64
drwxr-xr-x 3 root root 4096 Dec  9  2010 macosx-universal-64
drwxr-xr-x 3 root root 4096 Dec  9  2010 solaris-sparc-32
drwxr-xr-x 3 root root 4096 Dec  9  2010 solaris-sparc-64
drwxr-xr-x 3 root root 4096 Dec  9  2010 solaris-x86-32
drwxr-xr-x 3 root root 4096 Dec  9  2010 windows-x86-32
drwxr-xr-x 3 root root 4096 Dec  9  2010 windows-x86-64
[root@izwz91h49n3mj8r232gqwez bin]# ./linux-x86-64/sonar.sh start

重新開啟sonarqube地址即可