I've made my own data sources bundle in an attempt to expose data sources for my web apps. The relevant bean in my module-context.xml looks like this:
The osgi-context.xml file then exposes this bean as a service.Code:<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" p:driverClassName="oracle.jdbc.OracleDriver" p:url="${ds.url}" p:username="${ds.username}" p:password="${ds.password}" p:initialSize="${ds.initial.size}" p:maxIdle="${ds.max.idle}" p:maxActive="${ds.max.active}" p:maxWait="${ds.max.wait}" init-method="createDataSource" destroy-method="close" />
My MANIFEST.MF looks like this:
I'm using bundlor to generate this manifest from this template.mf:Code:Manifest-Version: 1.0 Bundle-Classpath: . Built-By: statum Bundle-Name: Data Sources Created-By: Apache Maven Import-Bundle: com.springsource.oracle.jdbc;version="[10.2.0.2,10.2.0. 2]" Bundle-Vendor: Company Bundle-Version: 1.0.0 Build-Jdk: 1.6.0_13 Bundle-ManifestVersion: 2 Import-Package: javax.sql;version="0",org.apache.commons.dbcp;version= "[1.2.2.osgi, 1.2.2.osgi]" Bundle-SymbolicName: com.company.si.datasources Archiver-Version: Plexus Archiver
Though, I had to manually build the jar, pull out the generated MANIFEST.MF, then stick it in /src/main/resources/META-INF, as dm server would not pick it up otherwise, but that is another discussion.Code:Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-SymbolicName: com.company.si.datasources Bundle-Version: 1.0.0 Bundle-Name: Data Sources Bundle-Vendor: Company Import-Bundle: com.springsource.oracle.jdbc;version="[10.2.0.2,10.2.0.2]" Import-Template: javax.sql;version="0" , org.apache.commons.dbcp.*;version="[1.2.2.osgi, 1.2.2.osgi]"
When I attempt to deploy this bundle, I get the following error in dm server:
I used STS to install the Oracle JDBC buncle. Does this mean I have something wrong in my manifest, or does it mean that the Oracle bundle provided in the SSER has a bad manifest? I viewed the manifest for the bundle and it does export javax.resource (javax.resource;version="[1.5.0, 2.0.0)"), as well as some subpackages.Code:[2009-05-22 16:51:02.031] onnection(2)-10.102.0.26 <SPDE0018E> Unable to install application from location 'file:///C:/dmserver/stage/datasources.jar'. Could not satisfy constraints for bundle 'com.company.si.datasources' at version '1.0.0'. Cannot resolve: com.company.si.datasources Resolver report: Bundle: com.springsource.oracle.jdbc_10.2.0.2 - Missing Constraint: Import-Package: javax.resource; version="[1.5.0,2.0.0)"
Has anyone else spent hours just trying to use a data source?I'm trying not to think about how easy this was before.
-Scott


I'm trying not to think about how easy this was before.
