为ORACLE创建支持OSGi的jar(适用于Spring Roo - ORACLE db集成)

问题描述 投票:4回答:3

我遇到了Spring Roo / Oracle OSGi驱动程序问题,其他许多问题已经解决,似乎已经解决了。

“Springsource目前无法托管OSGi包装的Oracle驱动程序”,所以看来你需要将现有的非OSGi包装起来。

我一直在跟踪here的步骤与Oracle 11g的驱动程序,版本2的驱动程序。

完全陷入第11步,

  1. 从Felix存储库中删除有问题的OSGI驱动程序: 使用“osgi ps”检索要删除的OSGI包的ID。 使用“osgi headers”获取相应OSGI包的Bundle-SymbolicName。可能是com.oracle.roo.jdbc.ojdbc5com.oracle.roo.jdbc.ojdbc6。 使用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是一滴悬崖。

spring oracle osgi
3个回答
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-roo-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 = …

检查bundle com-oracle-roo-jdbc(68)的详细信息,特别是“Bundle-SymbolicName”值

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

而已。删除。


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
投票

因此,截至2016年(Spring Roo 1.3.2),谁曾经在寻找如何卸载OSGi,以下是对我有用的东西。

roo> osgi uninstall --bundleSymbolicName“com.oracle.roo.jdbc.ojdbc6”

捆绑'com.oracle.roo.jdbc.ojdbc6':已卸载!

© www.soinside.com 2019 - 2024. All rights reserved.