It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Where to put jtds.jar JDBC driver jar file?

I am currently developing a custom field plugin for JIRA. This plugin requires access to an external SQL Server database in order to populate the field with data. I am trying to use the jtds JDBC driver with name "net.sourceforge.jtds.jdbc.Driver" but i am receiving a ClassNotFoundException when attempting to edit or create an issue due to the fact that JIRA can't find the associated "jtds.jar" file. I have tried copying and pasting the .jar file into the \lib directory and many other directories but to no avail. If someone could simply point out which directory to place the "jtds.jar" file into so that JIRA can load and see it.

I have tested that the database is available and the code functions as expected with no errors in a local version of Eclipse. I had the exact error when i tried to run the code in eclipse for the first time until i pointed eclipse to the location of the jtds.jar file and it worked perfectly.

Any help is much appreciated.

4 answers

1 accepted

4 votes
Answer accepted

As Jamie has pointed out, you need to add your jar as a compile dependency, so open the pom.xml that was generated by the SDK and add the following to the dependencies section

<dependency>
    <groupId>net.sourceforge.jtds</groupId>
    <artifactId>jtds</artifactId>
    <version>1.2.4</version>
    <scope>compile</scope>
</dependency>

This developer page gives a lot more info https://developer.atlassian.com/display/DOCS/Setting+OSGi+Manifest+Instructions+in+your+Plugin

Thanks alot James. Adding the additional dependency to the pom.xml file did the trick.

Is it a plugins2 plugin? It might be easier to declare it in your pom with scope: compile, then your plugin will just include it.

Or you could mess around with your bundle-imports (see the docs) to include these classes.

Jamie how can i determine if it is a plugins2 plugin or not? Adding something to the pom.xml seems logical.

In the header of your plugin.xml you will have: plugins-version="2" or 1. If you're using the SDK it will be a plugins2 plugin, so I suggest bundling.

yes it was a plugins 2 plugin.

Did you already try the WEB-INF\lib directory? You could put your JAR there if you do not want to bundle it to a plugin (as Jamie suggested).

yes i have already tried that particular directory. Thanks anyway :)

Plugins 2 plugins can only see classes loaded by their classloader and the system loader, so have no visibility of any classes in web-inf/lib

you can place a jar in tomact/lib(../JIRA/lib) directory.

if it won't work try to access database using JNDI connection

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published Thursday in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

111 views 0 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you