Teething issues

Hi,

I note that this is using “liquibase-1.9.5.tar.gz”

I hacked at the following:

cat ./samples/commandline/liquibase.properties

classpath: /my/path/to/mysql-connector-java-5.0.4-bin.jar
changeLogFile=samples/changelogs/mysql/complete/included.changelog.xml
username=liquibase
password=liquibase
url=jdbc:mysql://localhost/liquibase
driver=com.mysql.jdbc.Driver
logLevel=SEVERE

This file is verbatim from the examples, but included here for completeness:

$ cat samples/changelogs/mysql/complete/included.changelog.xml
<?xml version="1.0" encoding="UTF-8"?>

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

   
        
            
            Liquibase 0.8 Released
            
        
        
            
            
        
    

   
        
            
        
    

Starting from a fresh database:

mysql> create database liquibase;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on liquibase.* to 'liquibase'@'localhost' identified by 'liquibase';
Query OK, 0 rows affected (0.00 sec)

Some trivial things throw errors:

./liquibase --defaultsFile=./samples/commandline/liquibase.properties diff
Migration Failed: Unknown Reason.  For more information, use the --logLevel flag)
20-Apr-2010 04:46:18 liquibase.commandline.Main main
SEVERE: Unknown Reason
java.lang.NullPointerException
        at liquibase.database.OracleDatabase.getDefaultDriver(OracleDatabase.java:100)
        at liquibase.database.DatabaseFactory.findDefaultDriver(DatabaseFactory.java:93)
        at liquibase.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:45)
        at liquibase.commandline.Main.createDatabaseFromCommandParams(Main.java:755)
	at liquibase.commandline.Main.doMigration(Main.java:585)
	at liquibase.commandline.Main.main(Main.java:97)

Where’s it getting oracle from? Am I missing some libraries? Why should this matter?

When I do an “update” that’s okay, but when I try to roll back:

$ ./liquibase --defaultsFile=./samples/commandline/liquibase.properties rollback
Migration Failed: Unknown Reason.  For more information, use the --logLevel flag)
20-Apr-2010 04:48:51 liquibase.commandline.Main main
SEVERE: Unknown Reason
java.util.NoSuchElementException
	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:813)
	at java.util.HashMap$KeyIterator.next(HashMap.java:845)
	at liquibase.commandline.Main.doMigration(Main.java:669)
	at liquibase.commandline.Main.main(Main.java:97)
$ ./liquibase --defaultsFile=./samples/commandline/liquibase.properties rollback 1
Migration Failed: Could not find tag '1' in the database.  For more information, use the --logLevel flag)
20-Apr-2010 04:48:53 liquibase.commandline.Main main
SEVERE: Could not find tag '1' in the database
liquibase.exception.RollbackFailedException: Could not find tag '1' in the database
	at liquibase.parser.filter.AfterTagChangeSetFilter.(AfterTagChangeSetFilter.java:28)
	at liquibase.Liquibase.rollback(Liquibase.java:268)
	at liquibase.commandline.Main.doMigration(Main.java:669)
	at liquibase.commandline.Main.main(Main.java:97)

If someone could please suggest what these errors mean that’d be great.

Cheers,

Patrick

Most of the issues are from poor error handling, I’ve improved that a bit for 2.0, so hopefully that version will be easier to get going.

Your generateChagngeLog NulllPointerException is because that command expects a baseUrl, baseUsername, basePassword, and baseDriver parameter instead of the non-“base” versions.  The Oracle reference is because we didn’t get a baseDriver passed and so we are going through all the known databases checking if they understand the passed url (in your case null, since you didn’t pass baseUrl and we get a null pointer exception).

The first rollback error you are getting is because the rollback command expects a parameter containing the tag to roll back to, and you did not pass it.  That error message is also improved in 2.0.  The second error is because you have not called liquibase tag 1 to create a tag with the name “1” in the database to roll back to.  What you are probably trying to call is “liquibase rollbackCount 1”

Nathan

Hi Nathan,

Thanks for the reply. I’d be grumpy at the poor error handling if I wasn’t even worse at doing it myself :wink:

I’m sure you must be sick of people asking when 2.0 will be released, but at this stage would you recommend that I continue learning/integrating with/using the old version, or should I just go for 2.0?

Patrick

I would probably go with the latest build of 2.0 from http://liquibase.org/ci/latest.  I’m hoping to get 2.0 final out in the next week or two finally, and if you start with 2.0 you won’t have to worry about any upgrade issues.  The codebase is about as stable as the 1.9 release was.  What I have left is some long-term bugs that existed in 1.9, documentation, and making sure the APIs are finalized so 3rd parties can build on them without worry of them changing.

Nathan

Thanks again!

I’m looking at using liquibase in conjuction with HA-JDBC. I’m not sure if this is a bug of liquibase or HA-JDBC’s, but without the following, I found the process never died:

import liquibase.integration.commandline.Main;

public class PatrickLiquibase {
    public static void main(String args[]) throws Exception {
        liquibase.integration.commandline.Main.main(args);
        // Needed to kill JChannel used by HA-JDBC
        System.exit(0);
    }
}

Would you mind adding that “System.exit(0)” to the end of your main method? Also has anyone else ever been foolish enough to combine these two before?

Patrick

I added the System.exit(0) to trunk, that should be fine.

Nathan