2011-09-05 16 views
4

我遇到了大量其他人遇到並似乎已解決的Spring Roo/Oracle OSGi驅動程序問題。爲ORACLE創建啓用OSGi的jar(用於Spring Roo - ORACLE數據庫集成)

「Springsource目前無法託管OSGi包裝的Oracle驅動程序」,因此看起來您需要將現有的非OSGi包裝在一起。

我一直在這裏以下步驟:

http://nidget.wordpress.com/2011/07/21/how-to-osgify-an-oracle-jdbc-driver-with-spring-roo/ 與驅動程序的Oracle 11g第2版的驅動程序。

得到完全被卡住11步,

 
11. Remove the faulty OSGI driver from the Felix repository: 
- Use 「osgi ps」 to retrieve the ID of the OSGI bundle to remove. 
- Use 「osgi headers」 to get the Bundle-SymbolicName of the corresponding OSGI bundle. Probably 「com.oracle.roo.jdbc.ojdbc5″ or 「com.oracle.roo.jdbc.ojdbc6″. 
- Use 「osgi uninstall –bundleSymbolicName com.oracle.roo.jdbc.ojdbcx「 

我沒有背景,OSGi的所有,儘管得到「com.sun.security.auth.module」缺少當您運行依賴指示

roo> database reverse engineer --shema xxx
無法繼續使用osgi階段從OSGi中卸載這些依賴關係。

任何人都可以通過控制檯轉儲命令來做到這一點,但是不合理。

非常感謝 - Roo允許一個基本的應用程序建立真正的快速,但roo-oracle是一個懸崖,相比其他一切的易用性和速度。

回答

2

在我的文章中提到的命令(http://nidget.wordpress.com/2011/07/21/how-to-osgify-an-oracle-jdbc-driver-with-spring-roo /)是roo命令。

roo> osgi ps 
START LEVEL 99 
ID State Level Name 
[ 0] [Active ] [ 0] System Bundle (3.0.7) 
[ 1] [Active ] [ 1] jansi (1.5) 
… 
[ 68] [Resolved ] [ 1] com-oracle-roo-jdbc (11.2.0.2_0001) 

這顯示了COM-Oracle的袋鼠-JDBC束的ID:68

roo> osgi headers 

… 
com-oracle-roo-jdbc (68) 
———————— 
Bnd-LastModified = 1309962402810 
Build-Jdk = 1.6.0_07 
Built-By = jplandrain 
Bundle-Description = This bundle wraps the standard Maven artifact: ojdbc5-11.2.0.2. 
Bundle-License = http://www.oracle.com 
Bundle-ManifestVersion = 2 
Bundle-Name = com-oracle-roo-jdbc 
Bundle-SymbolicName = com.oracle.roo.jdbc.ojdbc5 
Bundle-Vendor = Oracle (wrapped into an OSGi bundle by the Spring Roo project build system) 
Bundle-Version = 11.2.0.2_0001 
Created-By = Apache Maven Bundle Plugin 
Export-Package = … 

檢查束COM-Oracle的袋鼠-JDBC細節(68),特別是,「Bundle-SymbolicName」值

roo> osgi uninstall com.oracle.roo.jdbc.ojdbc5 

就是這樣。刪除。

+0

感謝您的文章 - 原文有助於我走上正軌 - 但對於從未處理過osgi的人來說,當我開始打開生成的JAR並干涉MANIFEST.MF時, DIR。可能值得修改原來的帖子,打開清單,從進口部分刪除以下「...」,然後運行roo> osgi install --url file:/// c:\ path \ to \ current \ dir \ oracle \ file_generated_by_wrapper.jar好的,這是手持 - 但Roo是爲了讓它變得簡單... – Alex

+0

接受。感謝您的澄清 - 特別是您的原始文章http://nidget.wordpress.com/2011/07/21/how-to-osgify-an-oracle-jdbc-driver-with-spring-roo/ – Alex

3
NOTE: "CMD>" indicates from the command prompt, "roo>" indicates from within the roo shell, which can be accessed from the command prompt, by typeing "roo", provided the roo binary in on the environment path.  

爲了解決這個問題我做: 通過與Oracle jar文件目錄:

[1] CMD> mvn install:install-file -Dfile=ojdbc5-11.2.0.2.jar -DgroupId=com.oracle -DartifactId=ojdbc5 -Dversion=11.2.0.2 -Dpackaging=jar 

[2] start roo, and run: 
roo> addon create wrapper --topLevelPackage com.oracle.roo.JDBC --groupId com.oracle --artifactId ojdbc5 --version 11.2.0.2 --vendorName Oracle --licenseUrl http://www.oracle.com 

[3] need to remove some dependencies from the generated file (com.oracle.roo.jdbc.ojdbc5-11.2.0.2.0001.jar in this case), open jar in 7zip or other and edit manifest.MF file and remove from the "Import-Package:" bit in MINIFEST.MF: 
com.sun.security.auth.module 
oracle.i18n.text, 
oracle.i18n.text.converter 
oracle.ons,oracle.security.pki 

[4] install the following dependencies (get from http://ebr.springsource.com/repository/app/, search on this site for the groupIds below) into mvn: 

CMD> mvn install:install-file -Dfile=com.springsource.javax.resource-1.5.0.jar -DgroupId=javax.resource -DartifactId=com.springsource.javax.resource -Dversion=1.5.0 -Dpackaging=jar 

CMD> mvn install:install-file -Dfile=com.springsource.javax.transaction-1.1.0.jar -DgroupId=javax.transaction -DartifactId=com.springsource.javax.transaction -Dversion=1.1.0 -Dpackaging=jar 

CMD> mvn install:install-file -Dfile=ojdbc5.jar -DgroupId=com.oracle -DartifactId=ojdbc5 -Dversion=11.2.0.2 -Dpackaging=jar 

[5] in roo, run 

roo> osgi install --url file:///c:\users\alex\com.springsource.javax.transaction-1.1.0.jar 
roo> osgi install --url file:///c:\users\alex\com.springsource.javax.resource-1.5.0.jar 
roo> osgi install --url file:///c:\path\to\current\dir\oracle\file_generated_by_wrapper.jar 


[6] to check these files have made it ok type 

roo> osgi ps 

gives: 

[ 62] [Active  ] [ 1] Spring Roo - Wrapping - jline (0.9.94.0010) 
[ 63] [Active  ] [ 1] Spring Roo - Wrapping - json-simple (1.1.0.0010) 
[ 64] [Active  ] [ 1] Spring Roo - Wrapping - protobuf-java-lite (2.3.0.0001) 
[ 65] [Active  ] [ 1] Spring User Agent Analysis - Client (1.0.2.RELEASE) 
[ 69] [Active  ] [ 1] Java Resource API (1.5.0) 
[ 70] [Active  ] [ 1] com-oracle-roo-jdbc (11.2.0.2_0001) 
[ 72] [Installed ] [ 1] Java Transaction API (1.1.0) 

basically 'Active' is what you want - 

run: 

roo> osgi start --url file:///c:\users\alex\com.springsource.javax.transaction-1.1.0.jar 

to change 'Installed' to 'Active' 

[7] in roo, run: 
roo> database reverse engineer --schema <schema> 

if you get a 'Framework error' then you need to open up the manifest of your jar and delete more oracle imports (the above list *should* be sufficient) - only remove from the imports section tho. 

once you've changed the jar, reload into OSGi with: 

roo> osgi uninstall --bundleSymbolicName com.oracle.roo.jdbc.ojdbc5 
roo> osgi start --url file:///c:\users\alex\com.oracle.roo.jdbc.ojdbc5-11.2.0.2.0001.jar 

re-run: 

roo> database reverse engineer --schema <schema> 

to verify. Add a table into the schema and get DBA to grant access to get stuff to actually be generated. 
+0

我注意到我目前的問題是,Roo不斷拉動10g而不是11g庫導入 - 目前正在努力尋找roo如何做到這一點。還得到'java.lang.IllegalStateException:java.lang。IllegalArgumentException:無法獲取物理類型元數據的類型'做'roo>字段字符串--fieldName transactionId --notNull'所以roo-oracle集成不是家和幹 – Alex

+0

Got Roo使用oracle - 需要導入資源和事務(匹配上面的mvn導入),一個用於oracle ojdbc5 jar,一個用於新生成的osgi jar,確保DBA授予對象創建權限(在用戶表上?),並且Roo應該開始工作。 (我將修改帖子以包含所需的pom.xml導入 - 星期一) – Alex

+1

我還必須刪除'oracle.xdb'的導入。但在此之後,它的工作。 – SpaceTrucker

0

因此,截至2016年(Spring Roo 1.3.2)誰曾經搜索過如何卸載OSGi,下面是對我有用的東西。

袋鼠> OSGi的卸載--bundleSymbolicName 「com.oracle.roo.jdbc.ojdbc6」

捆綁 'com.oracle.roo.jdbc.ojdbc6':卸載!

相關問題