Reputation: 1081
In Liquibase whenever I go for generateChangeLog
for large database it give me error while for small database it run fine.
My error console is as follow:
Command to 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
Error: Unexpected error running Liquibase: liquibase.exception.DatabaseException: java.lang.StringIndexOutO fBoundsException: String index out of range: -1
FULL TRACKTRACE:
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
Upvotes: 2
Views: 4082
Reputation: 514
According to the comment of Sergei Visotsky this exception seems to appear when database views are present.
In my case dropping the views solved the issue.
Upvotes: 2