Using MySQL Driver with WAR Distribution

I'm running TeamCity 5.0.3 with my own Tomcat server. Setting this up was easy enough: I installed Tomcat, picked the WAR distribution of TeamCity, copied it into my webapps directory and then configured Apache to proxy for Tomcat.

Now I've stumbled somewhere I didn't expect any problems: Making TeamCity use a MySQL database.

When I enable the MySQL driver in my .BuildServer/config directory, I get this message:

Database driver is missing or specified incorrectly.
Specified driver class: com.mysql.jdbc.Driver

I tried copying the MySQL Connector/J binary (version 5.1.12) into my tomcat-6/WEB-INF/lib directory and I even unpacked the WAR archive and copied it into TeamCity's own WEB-INF/lib directory, but nothing changes. There's also a WEB-INF folder in my tomcat-6/webapps directory, but it's missing a lib subdirectory.

Can anyone more knowledgeable with Java than me tell me where I'm supposed to place that MySQL Connector?



The driver should be put into <teamcity web application>/WEB-INF/lib
However, depending on the Tomcat configuration there can be differences in .war deployments.
Most bullet-proof way seems to unpack the .war into a directory under <tomcat home>/webapps and then delete the .war - this way you can put the driver into WEB-INF/lib under the directory.


Well, I tried that (as written in my original post) - also deleting the WAR archive, of course - without any effect.

I guess I'll have to read up on Tomcat and Java module loading after all

Will report back if I find the cause.



Anyway, you can use .tar.gz TeamCity distribution (either to work with or to see how the application is packaged). The drivers jars need to be put into the same place where hsqlbd.jar is located.
Also, the latest TeamCity EAP allows to put database drived into .BuildServer/lib/jdbc directory


As far as I can recall, I tried various versions of the MySQL Connector, placed right besides hsqldb.jar back then with no success.

I tried it again today with the current 5.1 (#13300) EAP and the jdbc driver placed in the .BuildServer/lib/jdbc directory and it worked on the first attempt.

Problem solved, thanks!


Please sign in to leave a comment.