Message Boards
RE: how to add ojbc6 jar into module
how to add ojbc6 jar into module
Expert Posts: 326 Join Date: 12/20/10 Recent Postshi
i using liferay ce 7.4.2
now i have to connect ext-db via service builder, i use data source provider way.
and i modify my build.gradle
dependencies {
compileOnly group: "com.liferay.portal", name: "release.portal.api"
compileInclude group: 'oracle', name: 'ojdbc6', version: '11.2.0.3'
}
i got noting in my Project and External Dependencies
i change my build.gradle
dependencies {
compileOnly group: "com.liferay.portal", name: "release.portal.api"
compile fileTree(dir: 'lib', include: '**/*.jar')
}
and manually downloaded ojdbc6.jar and copy it into WEB-INF/lib/
my module can be compile, but when i start, i hit exception in my DataSourceProviderImpl (in DataSourceFactoryUtil.initDataSource)
2021-10-06 08:44:22.397 ERROR [pipe-start 1430][DataSourceProviderImpl:33] null
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1364) ~[catalina.jar:9.0.43]
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1187) ~[catalina.jar:9.0.43]
at com.liferay.shielded.container.internal.ShieldedContainerClassLoader.findClass(ShieldedContainerClassLoader.java:79) ~[com.liferay.shielded.container.impl.jar:?]
is there any why to fix it?
thank you.
RE: how to add ojbc6 jar into module (Answer)
New Member Posts: 5 Join Date: 6/27/20 Recent PostsHello,
putting any JAR into module doesn't mean it will be available after you deploy your module. Please read: https://liferay.dev/blogs/-/blogs/osgi-module-dependencies to get some idea how it works.
For ojdbc it's probably the best to put it under tomcat/lib directory to make it global JAR. I did that and I can tell it's a valid way.
Another issue is that you probably don't want to use old ojdbc6 and old Oracle 12c. It's not supported anymore in Liferay and it might simply not work.
Regarding the support - the last issue is that Oracle DB is not longer supported in CE versions, only in DXP. Such support can be added There is a github repository liferay-portal-database-all-in-one-support which explains how you can achieve using Oracle DB but it's not officially supported way.
Your best option is to simply change DB to MySQL or Postgres but if you really need oracle please look into this repository mentioned above or consider using DXP.
RE: RE: how to add ojbc6 jar into module
Expert Posts: 326 Join Date: 12/20/10 Recent Poststhank you, thank you very much.
i will try this, and i found that ojdbc6 is for jdk6, i change the jar.