Jetty Uber Jar with additional Datasource & Oracle Driver

Hi,

i would like to use the Uber Jar deployment method to put my application into a Docker container. In order to achieve this I followed this description: Distributed Uber JAR Deployment - CUBA Platform. Developer’s Manual

In the application I use an additional datasource which is an Oracle DB. Running the app through studio everything worked fine, since I was able to put the “ojdbc6.jar” to the corresponding directory in the tomcat deploy folder.

For the Uber Jar deployment I tried out to add a dependency to biuld.gradle like this:

configure(coreModule) {

  dependencies {
      //...
      compile files("$project.rootDir/lib/ojdbc7.jar")

  }

}

but it seems not to work properly. When I run the app it says: OracleDriver was not found.

I also thought about - since i’m in a Docker container, that I could also put the Oracle driver jar into the container and run the app (“java -jar”) with the additional reference to the Oracle Driver jar. However, it seems to be not very obvious (see e.g. here: Call "java -jar MyFile.jar" with additional classpath option - Stack Overflow) so I thought it might be interesting to know how you would approach this situation…

Bye
Mario

1 Like

Hi Mario,

I tried to build uber JAR with the ORACLE driver and it works. Check that Uber JAR contains OracleDriver.class in the jar path \LIB-INF\shared\oracle\jdbc\.

If driver class doesn’t exist try to perform assembling uber JAR using the command:
gradlew clean assemble buildUberJar

Thank you,
Andrey