我正在使用Liferay DXP,並創建了一個服務構建器模塊。在這個模塊中,我必須使用「oracle.jdbc.driver.OracleDriver」類,因爲我開發了一個FinderImpl來添加一個方法。此方法調用一個數據庫中的過程,該數據庫不是Liferay的數據庫,我正在使用其他數據庫進行過程。如何在osgi中添加第三方依賴項Liferay DXP
我在lib/ext中有JDBC驅動程序(ojdbc7.jar)。
的的build.gradle文件是:
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compileOnly group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.1.0"
compileOnly group: "com.liferay", name: "com.liferay.osgi.util", version: "3.0.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.spring.extender", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.6.0"
compileOnly project(":modules:test-manager:test-manager-api")
compileOnly group: "com.oracle", name: "ojdbc7", version: "12.1.0"
}
buildService {
apiDir = "../test--manager-api/src/main/java"
osgiModule = true
propsUtil = "com.test.manager.service.util.ServiceProps"
}
group = "com.test.manager"
的bnd.bnd文件是:
Bundle-Name: test-manager-service
Bundle-SymbolicName: com.test.manager.service
Bundle-Version: 1.0.0
Liferay-Require-SchemaVersion: 1.0.0
Liferay-Service: true
當我部署的模塊我得到這個錯誤:
Error while starting bundle: file:/C:/projects/test/modules/test-manager-service/test-manager-service-service/build/libs/com.test.manager.service-1.0.0.jar
org.osgi.framework.BundleException: Could not resolve module: com.test.manager.service [536]_ Unresolved requirement: Import-Package: oracle.jdbc.driver_ [Sanitized]
at org.eclipse.osgi.container.Module.start(Module.java:429)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1253)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1225)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)
有人知道哪個是問題?以及如何在我的模塊中添加ojdbc7.jar以使用oracle.jdbc.driver.OracleDriver類?
非常感謝你提前! 帕特里夏
由於Liferay論壇已經開始討論,請參閱https://meta.stackexchange.com/questions/141823/why-is-cross-posting-wrong-on-an-external-site並提供參考資料 –