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

Getting liquibase.executor.jvm.JdbcExecutor error for Azure Cosmos DB Mongo DB API #569

Open
prakash-hulamani opened this issue Oct 4, 2024 · 0 comments

Comments

@prakash-hulamani
Copy link

Hello Team,

I am seeing below error while inserting the data in Azure Cosmos DB Mongo DB API

For this I have downloaded the below .jar as well, could someone suggest why it's still looking for "liquibase.executor.jvm.JdbcExecutor"

liquibase-mongodb-4.29.2.jar
liquibase-cosmosdb-4.29.2.jar
liquibase-core.jar
slf4j-simple.jar
slf4j-api.jar
mongodb-driver-sync-5.2.0.jar
mongodb-driver-core-3.0.0.jar
mongo-java-driver-3.9.1.jar

=================

liquibase.properties

Cosmos DB MongoDB API connection details

url=mongodb://srecosmos-liquibase1.mongo.cosmos.azure.com:10255/liquibase1_db?ssl=true&retrywrites=false
username=srecosmos-liquibase1
password=XXXXXXXXXXXXXXX

Changelog file location

changeLogFile=src/main/resources/db/changelog/db.changelog-master.xml

=================

changelog.xml

    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:mongodb="http://www.liquibase.org/xml/ns/mongodb"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd
    http://www.liquibase.org/xml/ns/mongodb http://www.liquibase.org/xml/ns/mongodb/liquibase-mongodb-latest.xsd">

<changeSet id="1" author="alex">
    <mongodb:insertMany collectionName="insertManyTest1">
        <mongodb:documents>
            [
            { id: 2 },
            { id: 3,
              address: { nr: 1, ap: 5}
            }
            ]
        </mongodb:documents>

    </mongodb:insertMany>
</changeSet>

=================

ERROR: Exception Details
[2024-10-04 13:36:18] INFO [liquibase.ui] ERROR: Exception Details
ERROR: Exception Primary Class: ClassCastException
[2024-10-04 13:36:18] INFO [liquibase.ui] ERROR: Exception Primary Class: ClassCastException
ERROR: Exception Primary Reason: class liquibase.executor.jvm.JdbcExecutor cannot be cast to class liquibase.nosql.executor.NoSqlExecutor (liquibase.executor.jvm.JdbcExecutor and liquibase.nosql.executor.NoSqlExecutor are in unnamed module of loader java.net.URLClassLoader @38082d64)
[2024-10-04 13:36:18] INFO [liquibase.ui] ERROR: Exception Primary Reason: class liquibase.executor.jvm.JdbcExecutor cannot be cast to class liquibase.nosql.executor.NoSqlExecutor (liquibase.executor.jvm.JdbcExecutor and liquibase.nosql.executor.NoSqlExecutor are in unnamed module of loader java.net.URLClassLoader @38082d64)
ERROR: Exception Primary Source: MongoDB 0
[2024-10-04 13:36:18] INFO [liquibase.ui] ERROR: Exception Primary Source: MongoDB 0
[2024-10-04 13:36:18] INFO [liquibase.command] Command execution complete
[2024-10-04 13:36:18] SEVERE [liquibase.integration] class liquibase.executor.jvm.JdbcExecutor cannot be cast to class liquibase.nosql.executor.NoSqlExecutor (liquibase.executor.jvm.JdbcExecutor and liquibase.nosql.executor.NoSqlExecutor are in unnamed module of loader java.net.URLClassLoader @38082d64)
liquibase.exception.CommandExecutionException: liquibase.exception.UnexpectedLiquibaseException: java.lang.ClassCastException: class liquibase.executor.jvm.JdbcExecutor cannot be cast to class liquibase.nosql.executor.NoSqlExecutor (liquibase.executor.jvm.JdbcExecutor and liquibase.nosql.executor.NoSqlExecutor are in unnamed module of loader java.net.URLClassLoader @38082d64)
at liquibase.command.CommandScope.execute(CommandScope.java:258)
at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:51)
at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:21)
at picocli.CommandLine.executeUserObject(CommandLine.java:2045)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
at picocli.CommandLine.execute(CommandLine.java:2174)
at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$2(LiquibaseCommandLine.java:404)
at liquibase.Scope.child(Scope.java:200)
at liquibase.Scope.child(Scope.java:176)
at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$3(LiquibaseCommandLine.java:379)
at liquibase.Scope.child(Scope.java:200)
at liquibase.Scope.child(Scope.java:176)
at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:376)
at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:97)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at liquibase.integration.commandline.LiquibaseLauncher.main(LiquibaseLauncher.java:116)
Caused by: liquibase.exception.UnexpectedLiquibaseException: java.lang.ClassCastException: class liquibase.executor.jvm.JdbcExecutor cannot be cast to class liquibase.nosql.executor.NoSqlExecutor (liquibase.executor.jvm.JdbcExecutor and liquibase.nosql.executor.NoSqlExecutor are in unnamed module of loader java.net.URLClassLoader @38082d64)
at liquibase.nosql.changelog.AbstractNoSqlHistoryService.hasDatabaseChangeLogTable(AbstractNoSqlHistoryService.java:136)
at liquibase.nosql.changelog.AbstractNoSqlHistoryService.init(AbstractNoSqlHistoryService.java:111)
at liquibase.command.core.helpers.DatabaseChangelogCommandStep.checkLiquibaseTables(DatabaseChangelogCommandStep.java:141)
at liquibase.command.core.helpers.DatabaseChangelogCommandStep.run(DatabaseChangelogCommandStep.java:91)
at liquibase.command.CommandScope.execute(CommandScope.java:220)
... 21 more
Caused by: java.lang.ClassCastException: class liquibase.executor.jvm.JdbcExecutor cannot be cast to class liquibase.nosql.executor.NoSqlExecutor (liquibase.executor.jvm.JdbcExecutor and liquibase.nosql.executor.NoSqlExecutor are in unnamed module of loader java.net.URLClassLoader @38082d64)
at liquibase.nosql.changelog.AbstractNoSqlHistoryService.getExecutor(AbstractNoSqlHistoryService.java:92)
at liquibase.ext.mongodb.changelog.MongoHistoryService.existsRepository(MongoHistoryService.java:97)
at liquibase.nosql.changelog.AbstractNoSqlHistoryService.hasDatabaseChangeLogTable(AbstractNoSqlHistoryService.java:134)
... 25 more

Could you please suggest the correct way to insert the data into Azure Cosmos DB,

Thanks

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

No branches or pull requests

1 participant