Hi,
I'm building a OSGI bundle using gradle. I have embedded the dependent jars
in my OSGI bundle and when I try to run the bundle in servicemix it gives me
a missing requirement error for the same jar that is already present im the
bundle. I have also updated the dependent jars in BUNDLE-CLASSPATH but still
for some reason I get the following errors -
org.osgi.framework.BundleException: Unresolved constraint in bundle
RMI-RTL-CACHE [181]: Unable to resolve 181.0: missing requirement [181.0]
package; (&(package=javax.ws.rs)(version>=2.0.0)(!(version>=3.0.0)))
I'm new to OSGI and gradle hence finding it hard to fix this issue. Please
guide. I'm using apache service mix 4.5.3 on a Ubuntu machine with Sun java
7.
My gradle build is as below -
*******************************************************************
apply plugin: 'java'
apply plugin: 'osgi'
// apply plugin: 'groovy'
apply plugin: 'application'
repositories {
mavenCentral()
}
configurations {
extraLibs
}
dependencies {
compile group: 'net.sf.ehcache', name: 'ehcache', version: '2.8.0'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.5'
compile 'javax.ws.rs:javax.ws.rs-api:2.0'
compile group: 'org.osgi', name: 'osgi_R4_core', version: '1.0'
compile 'org.json:json:20131018'
testCompile 'junit:junit:4.8.2'
extraLibs 'net.sf.ehcache:ehcache:2.8.0'
extraLibs 'org.slf4j:slf4j-api:1.7.5'
extraLibs 'javax.ws.rs:javax.ws.rs-api:2.0'
extraLibs 'org.json:json:20131018'
}
version = '1.0'
jar {
into('') {
from configurations.extraLibs
}
manifest {
version = '1.0.0'
symbolicName = 'CACHE'
instruction 'Bundle-Activator',
'com.cache.activator.CacheActivator'
instruction 'Bundle-Classpath',
'.,ehcache-2.8.0.jar,javax.ws.rs-api-2.0.jar,json-20131018.jar,slf4j-api-1.7.5.jar'
}
}
**********************************************************************
and my manisfest file that gets generated is as below -
***********************************************************************
Manifest-Version: 1.0
Export-Package:
com.cache.constants;version="1.0.0",com.cache.service;uses:="net.sf.ehcache,javax.ws.rs";version=
"1.0.0",com.cache.activator;uses:="com.cache.impl,org.osgi.framework,com.cache.beans";version="1.0.
0",com.cache.impl;uses:="com.cache.service,
net.sf.ehcache";version="1.0.0",com.cache.rest.impl;uses
:="com.cache.service,com.cache.impl,org.jso
n,com.cache.beans";version="1.0.0",com.cache.beans;version="1.0.0"
Bundle-Classpath: .,ehcache-2.8.0.jar,javax.ws.rs-api-2.0.jar,json-201
31018.jar,slf4j-api-1.7.5.jar
Bundle-Version: 1.0.0
Tool: Bnd-1.50.0
Bundle-Name: Caching-Service
Bnd-LastModified: 1393141173000
Bundle-Activator: com.cache.activator.CacheActivator
Created-By: 1.7.0_45 (Oracle Corporation)
Bundle-ManifestVersion: 2
Bundle-SymbolicName: CACHE
Import-Package: javax.ws.rs;version="[2.0,3)",net.sf.ehcache;version="
[2.8,3)",org.json,org.osgi.framework;version="[1.3,2)"
*************************************************************************
I have copied the files so there maybe some line breaks at inappropriate
places. Please ignore that.
Please suggest how can I resolved this. I've have been looking over the net
and tried couple of things but none work.
--
View this message in context:
http://servicemix.396122.n5.nabble.com/Service-Mix-not-resolving-embedded-jar-dependencies-in-an-OSGI-bundle-tp5719265.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.