Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,297,842
Community Members
 
Community Events
165
Community Groups

JDBC Driver Loading in Jira 8.0.0+

Hello there,

since one of the recent updates in the last the three months we're unable to get our oracle-database connector plugin to run. 

I've tried numerous aproaches to solve our problems but none of them seem to help.

 

To assist in this matter I created an example plugin: https://github.com/sixenvi/dbConTest

 

The last 3 commits show the ways I tried to get ahold of the driver.

 

The error message is always: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver not found by com.example.dbConTest even though when I execute this code in groovy it appears to be loaded:

import groovy.sql.Sql
import java.sql.Driver

def driver = Class.forName('oracle.jdbc.OracleDriver').newInstance() as Driver

 

I tried to put the ojdbc driver in the libs folder and also bundling it in the plugin (which was how I did it before one update broke it).

 

I really don't get where I'm going wrong here, especially because it was working before. Please can anyone help me, I'm descending into madness here.

2 answers

1 accepted

1 vote
Answer accepted
Andy Heinzer Atlassian Team May 30, 2019

Hi Leroy,

Don't fret.  You're not crazy.  Jira stopped bundling the Oracle jdbc driver with our installers back in version 7.7 (about January 2018), see the upgrade notes for details: JIRA Core 7.7.x upgrade notes  I expect that the same came to the SDK versions about the same time.

So that would explain why this was probably working in an older version of the SDK.  However since Jira 7.7, all subsequent versions won't have this driver by default.  Instead you will need to download this from Oracle directly, and then copy this file into that $JIRAINSTALL/lib/ directory so Jira can use this when it starts up.

I see you mentioned trying to do this, so I would like to know more about what specific file you downloaded to use here.  I would expect that you could go to this page: https://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html

And download the file called odbc8.jar and copy that specific file into this /lib/ folder.   In my SDK setup finding that folder can be a bit more difficult.  In the SDK version I currently have installed, I just ran a

atlas-run-standalone --product jira

Then I went to my http://localhost:2990/jira/ and from there you can go to the system info page to see where the path is by looking at the catalina.home value.  In my case this was

/Applications/Atlassian/atlassian-plugin-sdk-8.0.7/bin/amps-standalone-jira-LATEST/target/container/tomcat8x/apache-tomcat-8.5.35/

From there there is a /lib/ directory under this that you should be able to correctly add this jdbc driver jar file to.  Provided this jar file exists in the directory when Jira starts up, Jira itself, or any other plugin code should then be able to access the classes offered by that jar file.

Please let me know the results.

Andy

Yes! Thank you that helped me. But what was confusing to me, is that I thought (and still think), that my plugin seems to be bundling the driver in the jar file, judging by the filesize that increases by 4 MB after including it in my pom.xml.

So I'm really wondering why my plugin doesn't load the driver it came along with but I guess that's some jdbc-thing to have it placed in the lib folder and loaded at startup rather than by the Plugin-Manager.

 

Thanks again for your help Andy.

Like Andy Heinzer likes this

In my SDK setup finding that folder can be a bit more difficult. [...]

Thanks for the hint, Andy!

We got a similar exception from Bitbucket SDK:

[INFO] Caused by: net.java.ao.builder.UnloadableJdbcDriverException: Could not load JDBC driver <oracle.jdbc.OracleDriver>
[INFO] at net.java.ao.builder.SupportedDatabase.checkDriverLoaded(SupportedDatabase.java:122)
[INFO] at net.java.ao.builder.SupportedDatabase.getDataSource(SupportedDatabase.java:104)
[INFO] at net.java.ao.builder.SupportedDatabase$5.getDatabaseProvider(SupportedDatabase.java:52)
[INFO] at net.java.ao.builder.DatabaseProviderFactory.getDatabaseProvider(DatabaseProviderFactory.java:8)
[INFO] at net.java.ao.builder.EntityManagerBuilderWithDatabaseProperties.build(EntityManagerBuilderWithDatabaseProperties.java:20)
[INFO] at it.bancaifis.change.ao.ChangeEntityManager.<init>(ChangeEntityManager.java:24)
[INFO] at it.bancaifis.change.ao.DeployService.<init>(DeployService.java:21)
[INFO] at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:203)
[INFO] ... 9 common frames omitted
[INFO] Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver not found by com.atlassian.activeobjects.activeobjects-plugin [23]
[INFO] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639)
[INFO] at java.lang.Class.forName0(Native Method)
[INFO] at java.lang.Class.forName(Class.java:264)
[INFO] at net.java.ao.builder.SupportedDatabase.getDriverClass(SupportedDatabase.java:142)
[INFO] at net.java.ao.builder.SupportedDatabase.checkDriverLoaded(SupportedDatabase.java:120)
[INFO] ... 16 common frames omitted

 We saw our running Bitbucket Server instance got Oracle JDBC driver at $BITBUCKET_SERVER\app\WEB-INF\lib\ojdbc8-12.2.0.1-atlassian-hosted.jar, so we copy that into our plug-in workspace at target\bitbucket\app\WEB-INF\lib\ojdbc8-12.2.0.1-atlassian-hosted.jar but it doesn't seem enough...

Any advice?

Thanks in advance.

Cheers.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you