Liquibase中的liquibase.exception.DatabaseException

问题描述 投票:0回答:1

在Liquibase中,每当我为大型数据库寻求generateChangeLog时,它都会给我错误,而对于小型数据库则运行正常。

我的错误控制台如下:

cmd命令:

   E:\liquibase-3.3.1-bin>liquibase 
   --driver=com.mysql.jdbc.Driver 
   --classpath=mysql-connector-java-5.1.6-bin.jar 
   --changeLogFile=xml\test11.xml 
   --url="jdbc:mysql://localhost:4928/test" 
   --username=root 
   --password=root 
   --diffTypes="tables,columns, foreignkeys,primarykeys, uniqueconstraints,
    data" generateChangeLog

错误:运行Liquibase发生意外错误:liquibase.exception.DatabaseException:java.lang.StringIndexOutOfBoundsException:字符串索引超出范围:-1

完整轨迹:

liquibase: liquibase.exception.DatabaseException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:155)
        at liquibase.integration.commandline.Main.doMigration(Main.java:939)
        at liquibase.integration.commandline.Main.run(Main.java:177)
        at liquibase.integration.commandline.Main.main(Main.java:96)
Caused by: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at liquibase.command.AbstractCommand.execute(AbstractCommand.java:13)
        at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:153)
        ... 3 more
Caused by: liquibase.exception.DatabaseException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at liquibase.snapshot.jvm.ColumnSnapshotGenerator.snapshotObject(ColumnS
napshotGenerator.java:69)
        at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGen
erator.java:60)
        at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorC
hain.java:50)
        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:163
)
        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.ja
va:241)
        at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnap
shot.java:195)
        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:177
)
        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.ja
va:241)
        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.ja
va:263)
        at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnap
shot.java:195)
        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:177
)
        at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:60)
        at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:37)
        at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.j
ava:25)
        at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGe
neratorFactory.java:126)
        at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGe
neratorFactory.java:119)
        at liquibase.command.DiffCommand.createReferenceSnapshot(DiffCommand.jav
a:190)
        at liquibase.command.DiffCommand.createDiffResult(DiffCommand.java:140)
        at liquibase.command.GenerateChangeLogCommand.run(GenerateChangeLogComma
nd.java:45)
        at liquibase.command.AbstractCommand.execute(AbstractCommand.java:8)
        ... 4 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range:
 -1
        at java.lang.String.substring(Unknown Source)
        at liquibase.util.SqlUtil.parseValue(SqlUtil.java:101)
        at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readDefaultValue(Colum
nSnapshotGenerator.java:345)
        at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readColumn(ColumnSnaps
hotGenerator.java:200)
        at liquibase.snapshot.jvm.ColumnSnapshotGenerator.snapshotObject(ColumnS
napshotGenerator.java:45)
        ... 23 more
indexoutofboundsexception liquibase
1个回答
0
投票

根据the comment of Sergei Visotsky,当存在数据库视图时,似乎会出现此异常。

就我而言,删除视图可以解决问题。

© www.soinside.com 2019 - 2024. All rights reserved.