TeamCity telling me Oracle Database is blank

I have TeamCity setup to use an oracle database.  Here are the contents of my database.properties file:


connectionUrl=jdbc:oracle:thin:@<server>:1521:orcldev
connectionProperties.user=<user>

connectionProperties.password=<password>

This setup is currently working and TeamCity is happy.  However, my plugin is also connecting to the databse and is causing issues because I am not using Connection Pools.  I have modified the code to use Connection Pools from the Oracle provided UCP.jar.  In order for it to work I needed to add UCP.jar and ojcdb14.jar to <TeamCityInstallation>\webapps\ROOT\WEB-INF\lib folder (otherwise I was getting class path errors when trying to use things in the UCP.jar). This is working in my test environment without any issue.

The issue is when I try and deploy this to my production environment.  As soon as I add ojcdb14.jar to <TeamCityInstallation>\webapps\ROOT\WEB-INF\lib TeamCity tells me my database is empty and that it must be built.  If I remove the file, it's fine again.

Any ideas why placing the ocjdb14.jar file in <TeamCityInstallation>\webapps\ROOT\WEB-INF\lib would cause it to think the database is empty?  I should also mention that it is correctly identifying it as an Oracle database and the URL is correct.  I don't see anywhere that the Username is presented in the logs, but I assume they are also being read correctly.

Thanks in advance for the help,
~Alex
4 comments
Comment actions Permalink

Hello Alex,

I'm highly recommend to use our documentation how to develop plugins for TeamCity:
http://confluence.jetbrains.net/display/TCD7/Developing+TeamCity+Plugins

All plugin jars must be packaged as described in
http://confluence.jetbrains.net/display/TCD7/Plugins+Packaging
Please never place any jars into <TeamCityInstallation>\webapps\ROOT\WEB-INF\lib directory.

If some plugins jars conflict with TeamCity ones, please use the use-separate-classloader="true" – it should help.

One additional note: TeamCity is not designed to share its database with other applications (even plugins), so making any changes into TC database can cause TC data corrupted.

What kind of plugin do make? Why does it need the database access?

0
Comment actions Permalink

Hello Leonid,

I am aware of how I need to package my addon.  I have been using this addon successfully for around six months.

The addon replaces a manual process at our company that ties any changes we make to the source code directly to our bug tracking system.  I added tables to the TemCity database to hold this information.  The plugin only ever writes to these new tables, although I do get information from some standard TeamCity tables as well.  The addon will also not allow the build of a Build Configuration until all of the bug tracking information is filled out.  To do this, it constently checks the database.

During original development, I was using the ojdb14.jar to create a connection to the Oracle database.  This JAR was packaged with the plugin and everything was fine.  In the code, I was using the OracleDataSource from the oracle.jdbc.pool namespace.  I erroneously thought this was handling pooling, when it does not.  Oracle provides a seperate JAR file, ucp.jar, to handle connection pooling.

I modified the plugin to use this new jar and packaged everything up in the Plugin like I was suppose to, but java was throwing an exception saying it couldn't find the class oracle.jdbc.pool.OracleDataSource (which is a parameter of the connection pool to determine the types of connections).  What it looked like to me is that my Plugin was able to call the ucp.jar file, but then the ucp.jar couldn't find the ojdb14.jar file.  To reiterate, my plugin could call both the ucp.jar file and the ojdb14.jar file which were packaged with the plugin.  The only fix I found for this was to place both the ucp.jar and ojdb14.jar into the <TeamCityInstallation>\webapps\ROOT\WEB-INF\lib directory.  I admit, I do not like this fix because it seems like I am now using the same JAR from two different locations, and would be open to a better solution.

I will try setting use-separate-classloader="true".  Hopefully that will do what I need it to do.  Unfortunately, I am also working on other projects, so I will not be able to work on this for a few days.  When I am able, I will reply to this if it works or not.

Thanks for your speedy reply,
~Alex Y.

0
Comment actions Permalink

Hello Alex,

thanks for the explanation.

I'd like to note also that the structure of TeamCity database is changed each major version.

0
Comment actions Permalink

So I suppose "a few days" was highly optimistic on my part. I am finally done with my other work and was able to tackle this issue again.

I decided to scrap the idea of connection pooling in favor of a relatively easy to implement fix: Polling frequency.

What I ended up doing is reducing the amount of calls to the database by adding a method to track the last time I checked the database (I imagine this is what the Quiet Period of the VSS check is).

So now my code will only hit the database once every minute (configurable in a properties file), instead of as fast as it can (which in hindsight should have screamed out to me something was going to break).

I have yet to attempt to roll it out in our Production environment, but I'm confident it will solve the issue and I shouldn't have any issues with the database telling me it's blank.

Thanks for the help.
~Alex Y.

0

Please sign in to leave a comment.