Hello everyone, I’m a beginner. I encountered an error while debugging the Liquibase source code. Below is the code I’m debugging and the exception message. Can any experts help me out?
@Test
public void liTest(){
//jdbc:mysql://localhost:3306/datawarehouse
//"--url=jdbc:gbase://0.0.0.0:8888/datawarehouse",
String[] commandLineArgs = {
"--driver=com.gbase.jdbc.Driver",
"--classpath=/Users/liyangzhou/cdrcb/lib/gbase-connector-java-8.3.81.53-build52.8-bin.jar",
"--url=jdbc:mysql://localhost:3306/datawarehouse",
"--username=dwh",
"--password=dwh",
"generateChangeLog",
"--outputFile=/Users/liyangzhou/cdrcb/dw/changelog-output.xml",
"--log-level=debug"
};
LiquibaseCommandLine liquibaseCommandLine = new LiquibaseCommandLine();
// Run the Liquibase command
int exitCode = liquibaseCommandLine.execute(commandLineArgs);
// Check the exit code to determine success or failure
if (exitCode == 0) {
System.out.println("Changelog generated successfully.");
} else {
System.err.println("Changelog generation failed.");
}
java.lang.NullPointerException
at liquibase.integration.commandline.LiquibaseCommandLine.logMdcData(LiquibaseCommandLine.java:427)
at liquibase.integration.commandline.LiquibaseCommandLine.lambda$null$2(LiquibaseCommandLine.java:381)
at liquibase.Scope.child(Scope.java:206)
at liquibase.Scope.child(Scope.java:182)
at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$3(LiquibaseCommandLine.java:358)
at liquibase.Scope.child(Scope.java:206)
at liquibase.Scope.child(Scope.java:182)
at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:356)
at liquibase.LiquibaseCommandLineTest.liyangzhouTest(LiquibaseCommandLineTest.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Changelog generation failed.