Services delared via SCR do not get reflected in the OBR xml as a capability while those with Blueprint do (I am building via Maven Bundle Plugin).
The tag below as an example does NOT appear in the xml for a bundle with SCR services:
<capability name='service'>
<p n='service' v='com.abc.xyz'/>
</capability>
By adding the "Export-Service" header, we get the capability tag in OBR for the SCR service, but the "Export-Service" header is deprecated.
The OBR deploy fails when there is a requirement for a service in a particular bundle and the capability is not found.
Related
I have an osgi bundle which was deployed in apache karaf using the feature.xml and service injection is done using blueprint.xml. How to deploy the same bundle in Weblogic OSGI container.
https://docs.oracle.com/middleware/1212/wls/WLPRG/osgi.htm#WLPRG764
I followed the steps mentioned in the above link. Copied the OSGI jar in the WL_HOME/server/osgi-lib location and restarted the server, but was not able to start it. Am i missing some thing?
Note:- I was able to deploy a simple OSGI jar without any dependencies by copying the jar in the osgi-lib folder.
You need to install the Aries blueprint bundles.
Good day.
I am trying to get the benefits of OBR in my application. I took Karaf Cave (4.0.0) as OBR implementation and org.apache.felix.bundlerepository (2.0.4) as OBR client. I successfully configured the repository itself but I can't properly use it.
The problem is: when I install the bundle via OBR and all its dependencies are already installed in OSGI runtime, it is installed successfully. But if some of the requirements are missing, I got an "Unsatisfied requirements" error, which is odd, since I know for sure that all the resources which resolves these requirements are present in the OBR descriptor and all links to them are valid.
Why aren't they resolved automatically? How to configure OBR client to work with Karaf Cave?
I also tried OBR implementation from Sonatype Nexus (OBR plugin) and found out that the OBR descriptor generated by Cave, and the one generated by Nexus, are differ. Moreover:
the one generated by Cave is OSGI compendium spec compliant
the one generated by Nexus is not, but works like a charm with org.apache.felix.bundlerepository - the problem is not reproduced.
I am completely confused.
The step sequence to reproduce the problem (reproduced on Apache Karaf 4.0.0):
1) Installing Karaf Cave:
feature:repo-add cave
feature:install cave-server cave-http
2) Creating a cave repository:
cave:create-repository test
cave:proxy-repository test file:///path/to/some/local/maven/repo
On this step I am able to successfully retrieve an OBR descriptor from
http://localhost:8181/cave/http/test-repository.xml
3) Install the OBR client and register 'test' cave repository from Karaf:
feature:install obr
obr:url-add http://localhost:8181/cave/http/test-repository.xml
4) Try to deploy some OBR resources with obr:deploy
I have a KAR file which I produced for Apache Karaf.
Now to get my KAR to run in Karaf 2.4.1 I must manually type into Karaf console the following to allow declarative services to work.
features:install scr
Is there a way for my KAR file to instruct Karaf to install this scr automatically?
The point is that I would like to be able to deploy a KAR by just dropping it into Karaf deploy folder without having to do any manual command.
A KAR contains a features XML file, correct? Add the scr feature into your features XML file as a dependent feature. See the section on Dependent Features in Karaf Provisioning.
I'm developing an OSGI bundle for parsing a PDF file using PDFBox library. I use maven to build the project and Karaf as the OSGI container. The PDFBox library is OSGI compatible so I thought this would be easy. But I just can't get the deployment model right.
In a traditional web app I would build a single WAR-file containing all the dependencies and put it in a Servlet container and it would get deployed. On the other hand the only way I've figured how to install an osgi bundle is by doing it by hand. I have to create an installation instruction file that lists all the dependencies that have to be manually downloaded and copied to the Karaf deploy folder, and be sure to do it in the right order. I feel like I'm back in the stone ages.
There has got to be an easier way, right? I still use maven to declare dependencies but I just have to use the provided scope. It would be great if those dependencies could be automatically installed.
I'm using the maven-bundle-plugin to generate a bundle from my application. It does generate an OBR repository(repository.xml) and I tried installing my bundle using obr karaf plugin but it still doesn't help with dependencies.
There are different possibilities for provisioning bundles. I prefer to install a bundle using Maven via the Karaf console such as:
install mvn:org.apache.pdfbox/pdfbox/1.8.4
If you don't want to install every bundle one by one, you could use so called features as described here. A feature lists all needed bundles:
<feature name='my-project' version='1.0.0'>
<feature version='2.4.0'>camel-spring</feature>
<bundle start-level='80' start='false'>mvn:com.mycompany.myproject/myproject-dao</bundle>
<bundle start-level='85' start='false'>mvn:com.mycompany.myproject/myproject-service</bundle>
<bundle start-level='85' start='false'>mvn:com.mycompany.myproject/myproject-camel-routing</bundle>
</feature>
You add a feature via Karaf console:
features:addUrl mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.0.0-m2/xml/features
features:install nmr
Instead of the mvn handler, you could also use the file handler:
features:addUrl file:base/features/features.xml
I am looking for a way to reach my vision. What is the best way to go?
Here is my vision:
I would like to build a captain casa app via maven (as a war file).
Then i would like to create a osgi bundle from the builded war via maven.
Next i would like build a artifact which could be downloaded and started via java webstart (jnlp).
The jnlp file should be download the osgi environment with web container support (maybe jetty osgi service), next download osgi bundled war. Then the osgi container and the jetty service should be started and my war should be deployed. Finally the app is running local in a osgi environment.
There are many questions to be answered:
How can i build a captain casa app via maven to a war?
Which maven plugin should be used to build the osgi bundle (pax, maven-bundle-plugin, tycho, ...) What are the differnce?
How to build a jnlp artifact via maven which can deployed on a site?
How must be modified the osgi bundle to support java webstart?
Known informations:
Blog entry to prepare osgi bundle for java webstart.
many pages to maven plugins, such as pax, maven-bundle-plugin, tycho, bnd, ...
It might be worth asking this as 3 separate questions, but when building Web application Bundles I use the maven-bundle-plugin version 2.2.0 (currently unreleased, so you'll need to depend on a snapshot).
Then I use the following file structure:
src/main/java - any .java files
src/main/resources - any non .java files that should be on the classpath
src/main/webapp - static content, images, html files jsps and so on
Then inside the pom once you have configured the normal data for the maven-bundle-plugin you specify the following:
<_wab>src/main/webapp</_wab>
this will cause the static content to be pulled into the bundle and the bundle to be structured with the classes and resources in the WEB-INF/classes directory.