我想使用liquibase标签功能。首先,我将以下命令运行到cmd(使用liquibase.properties设置等)
liquibase --changeLogFile=changeLog.xml update
其中changeLog.xml包含如下:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet id="1" author="ivan">
<createTable tableName="customer">
<column name="id" type="varchar2(42)" />
<column name="name" type="varchar2(42)" />
</createTable>
</changeSet>
</databaseChangeLog>
并且没有错误发生。
现在,我想使用以下命令标记当前数据库状态:
liquibase --changeLogFile=changeLog.xml tag exampletag
我也尝试使用以下命令
liquibase tag exampletag
唉,两次尝试都失败并出现相同的错误消息,如下所示
Unexpected error running Liquibase: Unknown Reason
如何通过命令行传递命令来正确标记当前状态的数据库?谢谢!
更新
这是我从运行第一个命令获得的堆栈跟踪。而且,我正在使用Liquibase 3.2.0
DEBUG 6/11/14 2:42 PM: liquibase: Connected to N603066@jdbc:oracle:thin:@10.111.48.125:1521:orcl
DEBUG 6/11/14 2:42 PM: liquibase: Setting auto commit to false from true
DEBUG 6/11/14 2:42 PM: liquibase: Computed checksum for 1402468965639 as 984dfd7dd9a2496bb4b3c74eeafa6a64
DEBUG 6/11/14 2:42 PM: liquibase: Executing QUERY database command: select count(*) from N603066.DATABASECHANGELOGLOCK
DEBUG 6/11/14 2:42 PM: liquibase: Executing QUERY database command: SELECT LOCKED FROM N603066.DATABASECHANGELOGLOCK WHERE ID=1 FOR UPDATE
DEBUG 6/11/14 2:42 PM: liquibase: Lock Database
DEBUG 6/11/14 2:42 PM: liquibase: Executing UPDATE database command: UPDATE N603066.DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = 'LD418102Y (10.111.48.204)', LOCKGRANTED = to_date('2014-06-11 14:42:45', 'YYYY-MM-DD HH24:MI:SS') WHERE ID = 1 AND LOCKED = 0
INFO 6/11/14 2:42 PM: liquibase: Successfully acquired change log lock
DEBUG 6/11/14 2:42 PM: liquibase: Executing QUERY database command: SELECT MD5SUM FROM N603066.DATABASECHANGELOG WHERE MD5SUM IS NOT NULL
DEBUG 6/11/14 2:42 PM: liquibase: Executing QUERY database command: select count(*) from N603066.DATABASECHANGELOGLOCK
DEBUG 6/11/14 2:42 PM: liquibase: Executing QUERY database command: SELECT COUNT(*) FROM N603066.DATABASECHANGELOG
DEBUG 6/11/14 2:42 PM: liquibase: Executing EXECUTE database command: UPDATE N603066.DATABASECHANGELOG SET TAG = 'exampletag' WHERE DATEEXECUTED = (SELECT MAX(DATEEXECUTED) FROM N603066.DATABASECHANGELOG)
DEBUG 6/11/14 2:42 PM: liquibase: Release Database Lock
DEBUG 6/11/14 2:42 PM: liquibase: Executing UPDATE database command: UPDATE N603066.DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1
INFO 6/11/14 2:42 PM: liquibase: Successfully released change log lock
Unexpected error running Liquibase: Unknown Reason
SEVERE 6/11/14 2:42 PM: liquibase: Unknown Reason
liquibase.exception.DatabaseException: java.lang.NullPointerException
at liquibase.changelog.StandardChangeLogHistoryService.tag(StandardChangeLogHistoryService.java:306)
at liquibase.database.AbstractJdbcDatabase.tag(AbstractJdbcDatabase.java:834)
at liquibase.Liquibase.tag(Liquibase.java:695)
at liquibase.integration.commandline.Main.doMigration(Main.java:939)
at liquibase.integration.commandline.Main.run(Main.java:170)
at liquibase.integration.commandline.Main.main(Main.java:89)
Caused by: java.lang.NullPointerException
at liquibase.changelog.StandardChangeLogHistoryService.tag(StandardChangeLogHistoryService.java:304)
... 5 more
For more information, use the --logLevel flag
答案 0 :(得分:1)
此错误已在Liquibase 3.2.1中修复。