Horrible user experience on upgrading HSQLDB to MySQL

I've just upgraded our TeamCity installation from 1.2 to 2.0 (final release, build 4111). That went very smoothly, except that I got a JavaScript exception on the TC webpage until I cleared my cache. Anyway, then I decided to upgrade our existing database to MySQL using the intstructions at http://www.jetbrains.net/confluence/display/TCD/MigratingtoMySQL+database (the full upgrade). Here's what happened:


SET CP=server.jar;mysql-connector-java-5.0.5-bin.jar;hsqldb.jar;dbunit-2.2.jar
F:\TeamCity>F:\TeamCity\jre\bin\java -cp %CP% jetbrains.buildServer.serverSide.H
SQL2MySQL F:\TeamCity\.BuildServer mysql://intranet/teamcity TeamCity password
Exception in thread "main" java.lang.NoClassDefFoundError: jetbrains/buildServer
/serverSide/HSQL2MySQL


NoClassDefFoundError? What? Where? Now, to a Java developer it may be blatantly obvious what happened, but I'm not a Java developer, so it took me quite a while to work this out. I searched these forums, JIRA, Google. Eventually I read and re-read the instructions and found what I did wrong. So, second attempt:


F:\TeamCity\webapps\ROOT\WEB-INF\lib>F:\TeamCity\jre\bin\java -cp %CP% jetbrains
.buildServer.serverSide.HSQL2MySQL F:\TeamCity\.BuildServer mysql://intranet/tea
mcity TeamCity password
Thu Apr 19 14:37:34 EST 2007 .BuildServer path: F:\TeamCity\.BuildServer
Thu Apr 19 14:37:34 EST 2007 Connecting to the source database jdbc:hsqldb:file:
F:\TeamCity\.BuildServer\system\buildserver
Thu Apr 19 14:39:52 EST 2007 Connecting to the target database mysql://intranet/
teamcity
Exception in thread "main" java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at jetbrains.buildServer.serverSide.HSQL2MySQL.main(HSQL2MySQL.java:87)


No suitable driver? Huh? What? More searching in the forums, JIRA and Google to no avail. Eventually I looked at the example right at the bottom of the page, which was the only indication that you're supposed to prepend jdbc[/B] to the database URL. Again, this may have been obvious to a Java developer, but how is anyone else supposed to know? Third attempt:


F:\TeamCity\webapps\ROOT\WEB-INF\lib>F:\TeamCity\jre\bin\java -cp %CP% jetbrains
.buildServer.serverSide.HSQL2MySQL F:\TeamCity\.BuildServer jdbc:mysql://intrane
t/teamcity TeamCity password
Thu Apr 19 14:42:04 EST 2007 .BuildServer path: F:\TeamCity\.BuildServer
Thu Apr 19 14:42:04 EST 2007 Connecting to the source database jdbc:hsqldb:file:
F:\TeamCity\.BuildServer\system\buildserver
Thu Apr 19 14:43:50 EST 2007 Connecting to the target database jdbc:mysql://intr
anet/teamcity
Thu Apr 19 14:43:51 EST 2007 Initializing schema...
Exception in thread "main" java.lang.NoClassDefFoundError: com/intellij/openapi/
diagnostic/Logger
at jetbrains.buildServer.serverSide.impl.DatabaseUtil.]]>(DatabaseU
til.java:49)
at jetbrains.buildServer.serverSide.impl.DBSchema.initDB(DBSchema.java:5
5)
at jetbrains.buildServer.serverSide.HSQL2MySQL.main(HSQL2MySQL.java:90)


NoClassDefFoundError? Bloody hell, not that again! I'm positive I'm following ALL the instructions this time. More fruitless searching. Eventually it occurs to me to check for a file named openapi.jar and add it to the CP variable. This is not in the instructions. Has it actually worked for anyone else or was it just not tested?! Fourth attempt:


F:\TeamCity\webapps\ROOT\WEB-INF\lib>F:\TeamCity\jre\bin\java -cp %CP% jetbrains
.buildServer.serverSide.HSQL2MySQL F:\TeamCity\.BuildServer jdbc:mysql://intrane
t/teamcity TeamCity password
Thu Apr 19 14:47:58 EST 2007 .BuildServer path: F:\TeamCity\.BuildServer
Thu Apr 19 14:47:58 EST 2007 Connecting to the source database jdbc:hsqldb:file:
F:\TeamCity\.BuildServer\system\buildserver
Thu Apr 19 14:49:42 EST 2007 Connecting to the target database jdbc:mysql://intr
anet/teamcity
Thu Apr 19 14:49:42 EST 2007 Initializing schema...
TABLES to be converted: (29) [[agent, agent_sources_version, build_queue, cancel
ed_info, compiler_output, deleted_build_types, failed_tests_output, granted_lice
nse, history, ignored_tests, paused_build_types, personal_vcs_changes, personal_
vcs_history, remember_me, remote_run_build_types, running, server, server_proper
ty, statistics, test_info, user, user_blocks, user_notification_events, user_pro
jects_order, user_projects_visibility, user_property, user_watch_type, vcs_chang
es, vcs_history]]
Thu Apr 19 14:49:45 EST 2007 Exporting data to F:\DOCUME1\ADMINI1.ARM\LOCALS~1
\Temp\TC-export3195.dtd / F:\DOCUME1\ADMINI1.ARM\LOCALS~1\Temp\TC-export3194.x
ml
Exception in thread "main" org.dbunit.dataset.DataSetException: java.sql.SQLExce
ption: out of memory
at org.dbunit.database.DatabaseDataSet.getTable(DatabaseDataSet.java:234
)
at org.dbunit.database.DatabaseTableIterator.getTable(DatabaseTableItera
tor.java:70)
at org.dbunit.dataset.filter.AbstractTableFilter$FilterIterator.getTable
(AbstractTableFilter.java:111)
at org.dbunit.dataset.stream.DataSetProducerAdapter.produce(DataSetProdu
cerAdapter.java:61)
at org.dbunit.dataset.xml.FlatXmlWriter.write(FlatXmlWriter.java:86)
at org.dbunit.dataset.xml.FlatXmlDataSet.write(FlatXmlDataSet.java:238)
at jetbrains.buildServer.serverSide.HSQL2MySQL.doExport(HSQL2MySQL.java:
0)
at jetbrains.buildServer.serverSide.HSQL2MySQL.main(HSQL2MySQL.java:32)
java.sql.SQLException: out of memory
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
at org.dbunit.database.AbstractResultSetTable.(AbstractResultSetTa ble.java:91) at org.dbunit.database.ForwardOnlyResultSetTable.]]>(ForwardOnlyResul
tSetTable.java:50)
at org.dbunit.database.ForwardOnlyResultSetTableFactory.createTable(Forw
ardOnlyResultSetTableFactory.java:45)
at org.dbunit.database.DatabaseDataSet.getTable(DatabaseDataSet.java:230
)
at org.dbunit.database.DatabaseTableIterator.getTable(DatabaseTableItera
tor.java:70)
at org.dbunit.dataset.filter.AbstractTableFilter$FilterIterator.getTable
(AbstractTableFilter.java:111)
at org.dbunit.dataset.stream.DataSetProducerAdapter.produce(DataSetProdu
cerAdapter.java:61)
at org.dbunit.dataset.xml.FlatXmlWriter.write(FlatXmlWriter.java:86)
at org.dbunit.dataset.xml.FlatXmlDataSet.write(FlatXmlDataSet.java:238)
at jetbrains.buildServer.serverSide.HSQL2MySQL.doExport(HSQL2MySQL.java:
0)
at jetbrains.buildServer.serverSide.HSQL2MySQL.main(HSQL2MySQL.java:32)


The machine has plenty of free memory (over 3GB available). I thought I'd try running it again just to see what happens and it gave me:

ERROR: TARGET DATABASE MUST BE EMPTY[/B]

The instructions didn't mention any way of overwriting and existing database. I had to manually drop all the tables before I could try again and, of course, I just got the same error. So, after all that wasted time I get nowhere. Each upgrade attempt took a while, as well, since it seemed to be reading the HSQLDB file first before going any further. This is really not up to the standard of JetBrains, guys and the upgrade process needs major improvements.

1. Your customer may be a developer, but not a Java or MySQL developer. They shouldn't have to figure out class paths and MySQL URLs and such things. Provide an upgrade tool that does all this for them. Even a simple batch file would have been very helpful and would only have taken you 2 minutes to write (and test!) JIRA: http://www.jetbrains.net/jira/browse/TW-2431

2. In the absence of that tool the error messages should be a lot better. They should tell a user (who, again, is not a Java developer) what's actually wrong. Also, it should validate parameters at the start, without making the user wait a few minutes while it does some of the work.

3. The instructions should be updated to add openapi.jar to the classpath. Wasn't this tested?

4. The actual exception needs to be fixed, of course. JIRA: http://www.jetbrains.net/jira/browse/TW-2432

2 comments

OK, I finally got it working. The workaround is to specify -Xmx512m[/B] in the command line, as mentioned at http://www.jetbrains.net/confluence/display/TW/HowtoDebug+problems

F:\TeamCity\jre\bin\java -cp %CP% -Xmx512m jetbrains.buildServer.serverSide.HSQL2MySQL F:\TeamCity\.Buil//intranet/teamcity TeamCity password[/B]

That's yet another thing that might not have seemed like much to a Java developer, but I only found it by accident while troubleshooting another TeamCity problem.

0

evgeny0 wrote:

Thank you, we appreciate your your feedback. Documentation and migration
tool will be updated to make things easier for users not familiar with java.


--
Alexey Gopachenko
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.