-
Choerodon平台版本:0.6.0
-
运行环境:自主搭建
-
问题描述:
knowledgebase_service项目在idea中单独启动,初始化数据库时,执行
init-local-database-csn.sh 脚本时报错 -
执行的操作:脚本中的目录以及jar包都存在,target/choerodon-tool-liquibase-0.9.0.RELEASE.jar,都是存在的,脚本中的数据库连接信息按照自己的信息修改的,然后执行这个脚本
-
报错信息(请尽量使用代码块或系统截图的形式展现):
请使用 init-local-database.sh 这个脚本去初始化
您好,我又使用了init-local-database.sh这个脚本执行,报的错一样
y::2019-07-04-add-column-is-sync-es::shinan.chenX@gmail.com: Change Set script/db/kb_page.groovy::2019-07-04-add-column-is-sync-es::shinan.chenX@gmail.com failed. Error: Table ‘knowledgebase_service.kb_page’ doesn’t exist [Failed SQL: ALTER TABLE knowledgebase_service.kb_page ADD is_sync_es TINYINT(1) UNSIGNED DEFAULT 0 NULL COMMENT ‘是否已经同步到ES中’]
2019-12-04 17:01:59.753 INFO 2694 — [ main] liquibase : script/db/kb_page.groovy::2019-07-04-add-column-is-sync-es::shinan.chenX@gmail.com: Successfully released change log lock
2019-12-04 17:01:59.760 ERROR 2694 — [ main] i.choerodon.liquibase.LiquibaseExecutor : 数据库初始化任务失败, message: Migration failed for change set script/db/kb_page.groovy::2019-07-04-add-column-is-sync-es::shinan.chenX@gmail.com:
Reason: liquibase.exception.DatabaseException: Table ‘knowledgebase_service.kb_page’ doesn’t exist [Failed SQL: ALTER TABLE knowledgebase_service.kb_page ADD is_sync_es TINYINT(1) UNSIGNED DEFAULT 0 NULL COMMENT ‘是否已经同步到ES中’], exception:
liquibase.exception.MigrationFailedException: Migration failed for change set script/db/kb_page.groovy::2019-07-04-add-column-is-sync-es::shinan.chenX@gmail.com:
Reason: liquibase.exception.DatabaseException: Table ‘knowledgebase_service.kb_page’ doesn’t exist [Failed SQL: ALTER TABLE knowledgebase_service.kb_page ADD is_sync_es TINYINT(1) UNSIGNED DEFAULT 0 NULL COMMENT ‘是否已经同步到ES中’]
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:619) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:79) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.Liquibase.update(Liquibase.java:214) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.Liquibase.update(Liquibase.java:192) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.Liquibase.update(Liquibase.java:188) ~[liquibase-core-3.5.5.jar!/:na]
at io.choerodon.liquibase.LiquibaseExecutor.load(LiquibaseExecutor.java:276) ~[choerodon-liquibase-0.11.0.RELEASE.jar!/:0.11.0.RELEASE]
at io.choerodon.liquibase.LiquibaseExecutor.runToDb(LiquibaseExecutor.java:193) ~[choerodon-liquibase-0.11.0.RELEASE.jar!/:0.11.0.RELEASE]
at io.choerodon.liquibase.LiquibaseExecutor.execute(LiquibaseExecutor.java:97) ~[choerodon-liquibase-0.11.0.RELEASE.jar!/:0.11.0.RELEASE]
at io.choerodon.liquibase.StartupRunner.run(StartupRunner.java:28) [classes!/:0.11.0.RELEASE]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:792) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:776) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE]
at io.choerodon.liquibase.LiquibaseTools.main(LiquibaseTools.java:18) [classes!/:0.11.0.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [choerodon-tool-liquibase-0.11.0.RELEASE.jar:0.11.0.RELEASE]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [choerodon-tool-liquibase-0.11.0.RELEASE.jar:0.11.0.RELEASE]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [choerodon-tool-liquibase-0.11.0.RELEASE.jar:0.11.0.RELEASE]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [choerodon-tool-liquibase-0.11.0.RELEASE.jar:0.11.0.RELEASE]
Caused by: liquibase.exception.DatabaseException: Table ‘knowledgebase_service.kb_page’ doesn’t exist [Failed SQL: ALTER TABLE knowledgebase_service.kb_page ADD is_sync_es TINYINT(1) UNSIGNED DEFAULT 0 NULL COMMENT ‘是否已经同步到ES中’]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:309) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:113) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1277) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1259) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:582) ~[liquibase-core-3.5.5.jar!/:na]
… 21 common frames omitted
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘knowledgebase_service.kb_page’ doesn’t exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2491) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2449) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:845) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:745) ~[mysql-connector-java-5.1.47.jar!/:5.1.47]
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95) ~[HikariCP-2.7.9.jar!/:na]
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) ~[HikariCP-2.7.9.jar!/:na]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:307) ~[liquibase-core-3.5.5.jar!/:na]
… 26 common frames omitted
2019-12-04 17:01:59.778 INFO 2694 — [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@2781e022: startup date [Wed Dec 04 17:01:42 CST 2019]; root of context hierarchy
2019-12-04 17:01:59.782 INFO 2694 — [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2019-12-04 17:01:59.783 INFO 2694 — [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans
2019-12-04 17:01:59.878 INFO 2694 — [ Thread-2] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated…
2019-12-04 17:01:59.889 INFO 2694 — [ Thread-2] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
服务版本是多少?
你好,knowledgebase_service是0.19.0的tag,数据库用的账号密码有knowledgebase_service库的权限,脚本里
MAVEN_LOCAL_REPO路径正确能找到
执行还是报上面的错误
看报错信息是knowledgebase_service.kb_page这张表找不到 数据库有这张表了吗?
或者重新创建数据库初始化试试看
你好,knowledgebase_service服务本地启动了,相应的网关服务基础服务等也在本地启动了,在知识库创建空间的时候报sql异常
org.springframework.jdbc.BadSqlGrammarException:
Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘rank,book_id ) VALUES( 1,1,‘2019-12-12 11:48:54.274’,1,‘2019-12-12 11:48:54.274’’ at line 1
The error may involve io.choerodon.kb.infra.mapper.WorkSpaceMapper.insert-Inline
The error occurred while setting parameters
SQL: INSERT INTO kb_workspace ( object_version_number,created_by,creation_date,last_updated_by,last_update_date,id,name,organization_id,project_id,route,parent_id,rank,book_id ) VALUES( ?,?,?,?,?,?,?,?,?,?,?,?,? )
Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘rank,book_id ) VALUES( 1,1,‘2019-12-12 11:48:54.274’,1,‘2019-12-12 11:48:54.274’’ at line 1
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘rank,book_id ) VALUES( 1,1,‘2019-12-12 11:48:54.274’,1,‘2019-12-12 11:48:54.274’’ at line 1
本地调用接口传参是怎样的?