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

"java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver" error

Hi All ,

I am trying to access the jira oracle database in my groovy class which i am using in behaviour plugin . i get the following error

java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver

The driver jar is present in /lib folder and i am even able to see the results when i run the below script in the script runner panel for scripts

import groovy.sql.Sql
import com.atlassian.jira.ComponentManager

Sql sql = Sql.newInstance("jdbc:oracle:thin:@localhost:1521:orcl",
    "mizan", "mizan", "oracle.jdbc.OracleDriver")
def sqlString="select * from parent where parent='TP_1.0.0'"

List row = sql.rows(sqlString)

return row.parent

But when i try to run my groovy class in the behaviours plugin i get the error .

What might be the cause ? do i have to import some package ? do i have to add the oracle-jdbc jar in some directoy ?

can someone please help me with this ?

below is part of my groovy class

import groovy.sql.Sql
public class Test extends FieldBehaviours {

public void setTest() {
    FormField formComponent = getFieldById(fieldChanged)
    FormField formSubcomponent = getFieldByName("Test1")
    Object componentFormValue = formComponent.getFormValue()
	Sql sql = Sql.newInstance("jdbc:oracle:thin:@localhost:orcl",
    "mizan", "mizan", "oracle.jdbc.OracleDriver");

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

5 votes
Answer accepted

It's classloader problems. If the oracle jar was a valid OSGi bundle, like the mysql one, it's relatively simple, however I doubt the oracle one is.

I think you will need to rebuild the plugin - info on the same problem here

You should try the groovy sql part of your script in the script runner. Going forward I will use the same strategy for classloading in the behaviours plugin. In the meantime you need to add the dep to the pom and rebuild.

Hi Jamie ,

When i run the groovy sql part in script runner it work and i am able to see the database values as output.

OK, that's good in that when I update behaviours, you will no longer need to rebuild it. But doesn't help you much right now :-(

The other thing to do is load the class in the context of the web-inf/lib classloader... but that may lead to even more confusing problems. Probably adding to the pom and rebuild is your best bet atm.

Which version of maven? And which version of the plugin? For jira4 you should run:

mvn -P jira4 -Dmaven.test.skip=true clean package

(assuming the latest version).

Not sure but i guess i was able to add oracle jdbc in behaviours when i added below code in pom


however now i get these errors .

"[WARNING] 'build.pluginManagement.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.codehaus.mojo:cobertura-maven-plugin @ com.atlassian.pom:atlassian-base-pom:22, C:\Documents and Settings\Administrator\.m2\repository\com\atlassian\pom\atlassian-base-pom\22\atlassian-base-pom-22.pom, line 395, column 25
[ERROR] 'build.plugins.plugin[org.codehaus.gmaven:gmaven-plugin].dependencies.dependency.scope' for org.seleniumhq.selenium:selenium-java:jar must be one of [compile, runtime, system] but is 'test'. @ line 169, column 32
[ERROR] 'build.plugins.plugin[org.codehaus.gmaven:gmaven-plugin].dependencies.dependency.scope' for junit:junit:jar must be one of [compile, runtime, system] but is 'test'. @ line 176, column 32
[WARNING] 'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @

i have to still make a jar and test it for my script .

I am using atlassian plugin sdk 3.7 .... and Behaviours-jira-0.4.7 .

and your mvn command line?

Maven is version 2 , The above command does not complete its gives a outofmemory failure , i did atlas-clean and again did atlas-run i get this error "Couldn't detect an AMPS product to dispatch to" .

Found this so removed the <scope> and now it does not give any error but unable to do atlas-run it give error "Couldn't detect an AMPS product to dispatch to" . is there some otherway to build the source of behaviours plugin ?

Hi Jamie ,

I am stuck here i am not able to rebuild the Behaviours plugin from its source . Am i missing something ? can you please help me with this ?

I am not sure what your issue with maven is, and don't have time to debug that. But if you create an issue in the JBHV project including the jira version you need to target I'll attach a custom build.

Ok , il do that . thanx .

Hi Jamie ,

Can you please provide me the source code for Behaviours plugin version 0.5.0 compatible with Jira 5 , i need to add oracle driver .

I was not able to get it using browse source link on marketplace .

Thank you .

0 votes
Joe Clark Atlassian Team Mar 07, 2012

Try adding a dependency to the oracle-jdbc driver in your plugin's pom.xml and set the <scope> to "provided"

Hi Joseph ,

I am trying to add the dependency in Behaviours plugin , for adding the dependency im following this approach

i run the following command

atlas-mvn install:install-file -Dfile=oracle-jdbc15- \
-DartifactId=oracle -Dversion= -Dpackaging=jar -DgeneratePom=true

I get an error

[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Invalid task 'oracle-jdbc15-': you must specify a valid lif
ecycle phase, or a goal in the format plugin:goal or pluginGroupId:pluginArtifac
[INFO] ------------------------------------------------------------------------

how to tackle this ?

Am i going wrong somewhere ?

Add maven dependency to pom.xml file, something like:

<!-- Oracle Database 10g Release 2 ( JDBC Drivers -->

Hi Xrakan ,

I get this error when i add the dependency in the pom

"Missing artifact"

You must find correct oracle mvn dependency (mayby on oracle sites), this is only example. Probably groupId, artifactId is not correct.




If it does not work - it looks that Oracle dont have public maven repository, than copy somewhere you driver jar file and try in pom reference it by system scope and system path (


The same error . I even tried manually adding dependency through eclipse and even netbeans .

If someone has done this before can someone please provide the behaviours jar with oracle-jdbc drivers if possible .

Community showcase
Asked in Atlassian Account

Upcoming AMA with the Atlassian Identity Product Managers!

"Atlassian Account" is a space where you can raise questions about your Atlassian Account and your identity across all of our Atlassian Cloud Products. This involves understanding User Managemen...

67 views 1 6
View question

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