-
Notifications
You must be signed in to change notification settings - Fork 77
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
MigrationException: Error executing command. Cause: null #220
Comments
Hello @szj-coder , Please provide more information so that we can reproduce the exception.
|
Hello @harawata , The exception is currently considered to be between database.driverClass: com.mysql.cj.jdbc.Driver
database.url: jdbc:mysql://xxxxxx.amazonaws.com.cn:3306/xxx?useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai I'm very sorry, I can't provide other information, in the process of troubleshooting the problem, I found that there are contradictions between the logs here and the exceptions in try, and I think there is room for optimization |
I honestly do not understand what you are doing. :D Anyway, please let us know if you find more info for us to work with. |
I modified the exception logic, and the following code was cleaned up while (e instanceof MigrationException) {
e = e.getCause();
} Exception Stack:
The reason for the exception is tablename case mismatch |
Could you post the entire stack trace, please? |
@harawata Take a look at the exception thrown here,you can simulate the change log table does not exist to view stack information migrations/src/main/java/org/apache/ibatis/migration/operations/PendingOperation.java Lines 49 to 51 in 9d53336
Error message will be erased here migrations/src/main/java/org/apache/ibatis/migration/operations/PendingOperation.java Lines 92 to 94 in 9d53336
|
@szj-coder |
@harawata Stack trace is here Here is the stack trace after my modification |
I agree that the information is not good enough and it should be fixed, but we need to reproduce the problem first (reproducing the problem is always the first step).
|
Since my code uses the lowercase com.xxx.pip.migration.mysql.MultiMigrationSetup#doIt public void doIt(DataSource dataSource, String profile) throws Exception {
String migrationPath = new StringBuilder("META-INF/migrations/").append(profile).append("/scripts/").toString();
Enumeration<URL> paths = DefaultMigrationSetup.class.getClassLoader().getResources(migrationPath);
ComplexMigrationLoader migrationLoader = new ComplexMigrationLoader(migrationPath, paths);
migrationLoader.init();
DataSourceConnectionProvider dataSourceConnectionProvider = new DataSourceConnectionProvider(dataSource);
// changelog table is Exists?
if (!checkChangelogExists(dataSourceConnectionProvider)) {
createChangelogTable(dataSourceConnectionProvider);
}
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
PrintStream printStream = new PrintStream(byteArrayOutputStream);
logger.info("Migrating **Pending** SQL scripts");
DatabaseOperationOption databaseOperationOption = new DatabaseOperationOption();
databaseOperationOption.setSendFullScript(false);
databaseOperationOption.setThrowWarning(false);
databaseOperationOption.setAutoCommit(false);
databaseOperationOption.setChangelogTable("changelog");
new PendingOperation().operate(dataSourceConnectionProvider, migrationLoader, databaseOperationOption, printStream);
new UpOperation().operate(dataSourceConnectionProvider, migrationLoader, databaseOperationOption, printStream);
logger.info(new String(byteArrayOutputStream.toByteArray()));
printStream.close();
} Stack trace:
Hope this information can help you |
Thanks for the info, @szj-coder ! |
This should be fixed in the latest 3.3.11-SNAPSHOT. |
Hi,
I'm using
mybatis-migration:3.3.9
for data migration and I'm getting a strange exception, only when I deploy in Amazon cloud environment, I can't locate the exception based on the exception stack information.Please consider cleaning up the following code in PendingOperation.java and DownOperation.java and UpOperation.java
Thanks
The text was updated successfully, but these errors were encountered: