Embedding dependencies in a URCap

If you need to embed a necessary bundle for your URCap plugin, please refer to the Apache Felix Maven Bundle Plugin.

The bundle must be “embedded” inside the .urcap file, which essentially is a .jar file.
Please check your pom.xml file for the <Embed-Dependency> tag, and embed the bundle through here.

You can check is the dependency is a success, by checking the .jar file after build for the referenced dependency.

Besides from embedding the necessary classes, OSGi will also expect MANIFEST.mf to include the correct Export-Package packages. However if the dependency already is a valid OSGi-bundle, this will happen automatically.

Please note, that since the URCap API uses generic OSGi, you should check out relevant Maven and OSGi manuals for further documentation.

1 Like

Hello,

I was able to embed the bundle in a urcap. I validated that the bundle is working with the Remote Shell. But the embedded bundle was not loaded automatically. Specifically, here is what I did on the Remove Shell:

  • -> ps # my embedded bundle is not listed
  • -> install file:///opt/usrim/[path-to-bundle]bundle.jar
  • -> ps # my bundle is in the installed state
  • -> start [my-bundle-id]
  • -> ps # by bundle is in the Active state, The Activator is executed.

My question is, how can I automatically load and start my embedded bundle?

Thanks.

Pierre

@poproulx

It seems you have not embedded the dependency in your URCap?
But just has a bundle placed somewhere in the controller?

You should embed the dependency using <Embed-Dependency> tag, so you have exactly one bundle, which would be your .urcap file.
If you have issues making this work, please upload your pom.xml file so I might investigate it.

I want to be sure that I did not misunderstand your original post. This tag can be used to embed an additional OSGi bundle in my URCap? Is that right? So if I emded an additional bundle I should expect its Activator to be executed in addition to the URCap’s Activator. Is that right?

To answer your questions, I’m pretty sure I did use the tag since I can see my embedded bundle in the folder bundle.jar-embedded in the felix-cache. Here are my two pom.xml. The first one is the urcap. The second one is the OSGi addition bundle.

@jbm Can you take a look at my previous post. Thanks.

Hi,

i faced a related issue today as i tried to use third-party jars and update their version with a urcap remote update. It seems that the embedded jars are not updated until their zombie copies in the felix-cache folder are dropped and replaced by the updated embedded jar from the urcap update.

Is there a way to clear these embedded jars in the felix cache folder on deployment?

Hi,

i found out that using mvn clean install instead mvn install solves the cache issue. It’s more likely a build lifecycle issue than a cache problem :wink:

1 Like