Issue for getting features list using org.apache.karaf.features ?

asked 2016-06-17 00:21:11 -0800

pande.gaurav gravatar image

Hi,

We are using org.apache.karaf.features jar(3.0.6 version) as a dependency for our maven project using karaf framework.

First issue is, using this dependency,some imports are not getting resolved such as : org.apache.karaf.features.internal.FeaturesServiceImpl; org.apache.karaf.features.internal.BundleManager;

We want to get bundles and features list using APIs not through the command line.

We are able to get the bundles list using org.osgi.framework, second issue is if somehow imports are resolved, we are getting error for features list. The code is as follows :

URI uri = new URI("mvn:org.opendaylight.cardinal/cardinal-features/0.1.0-SNAPSHOT/xml/features"); BundleContext bundleContext = FrameworkUtil.getBundle(MyClass.class).getBundleContext(); Bundle[] list= bundleContext.getBundles(); BundleManager bundleManager = new BundleManager(bundleContext); FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager); svc.addRepository(uri); Repository[] repositories = svc.listRepositories(); Feature[] features = repositories[0].getFeatures();

For any uri, we are getting this error:

org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'null', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDHandler.getSchemaDocument1(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDHandler.getSchemaDocument(Unknown Source) at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source) at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source) at javax.xml.validation.SchemaFactory.newSchema(Unknown Source) at org.apache.karaf.features.internal.FeatureValidationUtil.validate(FeatureValidationUtil.java:112) at org.apache.karaf.features.internal.FeatureValidationUtil.validate(FeatureValidationUtil.java:68) at org.apache.karaf.features.internal.FeaturesServiceImpl.validateRepository(FeaturesServiceImpl.java:164) at org.apache.karaf.features.internal.FeaturesServiceImpl.internalAddRepository(FeaturesServiceImpl.java:235) at org.apache.karaf.features.internal.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:186) at org.apache.karaf.features.internal.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:174)

Kindly help to resolve it.

edit retag flag offensive close merge delete