Message Boards

how to add non osgi jar in global

Scarletake Bwi, modified 2 Years ago.

how to add non osgi jar in global

Expert Posts: 326 Join Date: 12/20/10 Recent Posts

hi

i try use ojdbc8.jar in my module, and i know it's non-osgi

so i download the jar and put it in <TOMCAT>\lib\ext

and check module.framework.system.packages.extra from portal.properties, in liferay ce 7.4.2 ga3, oracle.jdbc is already in the list

module.framework.system.packages.extra=\
    com.ibm.crypto.provider,\
    com.ibm.db2.jcc,\
    com.microsoft.sqlserver.jdbc,\
    com.mysql.cj.jdbc,\
    com.mysql.jdbc,\
    com.p6spy.engine.spy,\
    com.sun.security.auth.module,\
    com.sybase.jdbc4.jdbc,\
    oracle.jdbc,\ <===========here
    org.postgresql,\
    org.hsqldb.jdbc,\
    org.mariadb.jdbc,\
    sun.misc,\
    sun.net.util,\
    sun.security.provider,\
    \
    #
    # WebSocket Support
    #
    \
    com.ibm.websphere.wsoc,\
    io.undertow.websockets.jsr,\
    javax.websocket,\
    javax.websocket.server,\
    org.apache.tomcat.websocket.server,\
    weblogic.websocket.tyrus

and i modify my build.gradle

dependencies {
    compileOnly group: "com.liferay.portal", name: "release.portal.api"
    compileOnly group: 'com.oracle.database.jdbc', name: 'ojdbc8', version: '21.3.0.0'
}

but it still get ClassNotFoundException, the message shows :oracle.jdbc.OracleDriver cannot be found by com.test.ci.plm_1.0.0"

can anyone help?

thumbnail
Fernando Paz, modified 2 Years ago.

RE: how to add non osgi jar in global

New Member Posts: 11 Join Date: 9/16/16 Recent Posts

Hi AFAIK you need make a OSGI module for suport it.  Check this HOW TO url https://github.com/amusarra/liferay-portal-database-all-in-one-support. Hope it helps!!

Scarletake Bwi, modified 2 Years ago.

RE: RE: how to add non osgi jar in global

Expert Posts: 326 Join Date: 12/20/10 Recent Posts

hi Fernando

thank you for reply.

i will try it, but it looks likw for liferay ce to use oracle/sql server as main database, but i just want to connect external database to query some data.

anyway, i will feedbake the result doday, again, thank you.

Scarletake Bwi, modified 2 Years ago.

RE: RE: how to add non osgi jar in global

Expert Posts: 326 Join Date: 12/20/10 Recent Posts

hi 

after i read liferay-portal-database-all-in-one-support

i have to say it's powerful, but it cannot help in my case. 

it's for someone who want use Oracle or MS-Sql or DB2 to be main database of liferay 7.X

but my request is read a exernal database data from liferay.

Scarletake Bwi, modified 2 Years ago.

RE: RE: how to add non osgi jar in global

Expert Posts: 326 Join Date: 12/20/10 Recent Posts

hi Fernando

i find your example project, sb-extdb

i will try this. i am not sure it can work in 7.4.2 or not, hope it work

before i try, allow me to ask a domn question

base on the project, is that mean, the only thing i have to do, is download the all-in-one jar, and put it in ROOT/lib?

i do not have to do anything in bnd.bnd or build.gradle?

my target is oracle, and my liferay use jdk8