Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liquibase fails against DocumentDB using the liquibase-mongodb extension #244

Closed
JonasJSchreiber opened this issue Mar 13, 2022 · 0 comments · Fixed by #245
Closed

Liquibase fails against DocumentDB using the liquibase-mongodb extension #244

JonasJSchreiber opened this issue Mar 13, 2022 · 0 comments · Fixed by #245

Comments

@JonasJSchreiber
Copy link

JonasJSchreiber commented Mar 13, 2022

Using liquibase 4.8.0 and liquibase-mongodb extension 4.8.0. The issue is that in the AbstractRunCommandStatement class, there is a checkResponse() call to a Document which asks for key("ok") and tries to read it as a Double when it is an Integer.

Took me a while to get here, running Spring Boot + DocumentDB + liquibase. A few pointers to anyone who stumbles across this using a similar stack:

  • use the jks keystore method for attaining connectivity. If you use the programmatic approach with AbstractMongoConfig you won't have the ability to enable tls/ssl on the MongoConnection that liquibase maintains.
  • DocumentDB does not support Document Validation. So you'll need to set the liquibase.mongodb.supportsValidator System property to false. This can be done with something like System.setProperty("liquibase.mongodb.supportsValidator", "false");
  • add &retryWrites=false to the connection string liquibase uses.

Stack trace follows.

2022-03-13 11:12:19.752 ERROR 32116 --- [  restartedMain] c.talksoft.convapi.utils.LiquibaseUtils  : Exception: 
...
Caused by: liquibase.exception.DatabaseException: Could not execute
	at liquibase.nosql.executor.NoSqlExecutor.execute(NoSqlExecutor.java:189)
	at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1279)
	at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1261)
	at liquibase.changelog.ChangeSet.execute(ChangeSet.java:661)
	... 128 common frames omitted
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double
	at org.bson.Document.getDouble(Document.java:278)
	at liquibase.ext.mongodb.statement.AbstractRunCommandStatement.checkResponse(AbstractRunCommandStatement.java:77)
	at liquibase.ext.mongodb.statement.AbstractRunCommandStatement.run(AbstractRunCommandStatement.java:60)
	at liquibase.ext.mongodb.statement.AbstractRunCommandStatement.run(AbstractRunCommandStatement.java:55)
	at liquibase.ext.mongodb.statement.AbstractRunCommandStatement.execute(AbstractRunCommandStatement.java:51)
	at liquibase.ext.mongodb.statement.AbstractRunCommandStatement.execute(AbstractRunCommandStatement.java:36)
	at liquibase.nosql.executor.NoSqlExecutor.execute(NoSqlExecutor.java:187)
	... 131 common frames omitted
	```
@nvoxland nvoxland linked a pull request May 24, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant