Universal Robots+

Add third-party jar to URCap: Missing requirements

Hello,

I’m trying to to add a third-party jar to my URCap (Java Media Framework/JMF), but can’t figure out how to do that.

I add a new dependency to my pom.xml file:

<dependency>
<groupId>javax.media</groupId>
<artifactId>jmf</artifactId>
<version>2.1.1e</version>
</dependency>

Then I’ve used the “Embed-Dependency” tag, as suggested in these two topics:


<Embed-Dependency>!javax.media*</Embed-Dependency>

After doing so, “mvn install” will work and shows the state “BUILD SUCCESS”. When I open the generated .urcap file I can
also see the jar inside the .urcap file.
But when I install the URCap, the URcap is marked with a yellow warning sign and shows the following error:

org.osgi.framework.BundleException: Unable to resolve com.test.urcap [334](R 334.0): missing requirement [com.test.urcap [334](R 334.0)] osgi.wiring.package; (osgi.wiring.package=com.ms.awt) Unresolved requirements: [[com.test.urcap [334](R 334.0)] osgi.wiring.package; (osgi.wiring.package=com.ms.awt)]

I’ve tried several things to fix this, e.g. the suggestions from these two forum topics:


I’ve also used Eclipse to generate a MANIFEST.MF file/OSGi bundle for the third-party jar. But the result is always
the same, “mvn install” runs just fine, but execution of the installed URCap does not work.

What am I missing? Is there a working example with third-party jars?

Thank you very much.

1 Like

Anyone an idea or has an example?
Continued on trying different things out, but always the same error message…

I had a similar error at some point with another package, I am pretty sure that ‘osgi.wiring.package=com.ms.awt’ means you’re missing the dependency ‘com.ms.awt’, although i don’t know which package that dependency belongs to.
I resolved my error by finding my missing dependencies on https://mvnrepository.com/ and adding these as dependencies in my pom file, although it did require a large amount of dependencies (as some of the dependencies i added, had their own dependencies). There might be a better way of doing this, but I have not found it :slight_smile:

1 Like

Thank you very much for the replay and help.
I’ll try this out and make some research about “com.ms.awt”.

The answer of thomas gave me the correct hints:
The line " osgi.wiring.package=com.ms.awt" inside the error message is important as it shows which elements have to be added to the Import-Packages tag. When I add com.ms.awt it shows me the same error message again, but with a different package. I add the package, try again and so on until no more error messages appear.
Then I had to make some changes to the syntax (found out by google) and it works now. :slightly_smiling_face:

So my complete pom looks like this:
<Import-Package> com.ur.urcap.api*;version="[1.3.0,2.0.0)", javax.media*;resolution:=optional, com.ms.awt*;resolution:=optional, com.ms.net.wininet*;resolution:=optional, com.ms.security*;resolution:=optional, com.sun.net.ssl.internal.ssl*;resolution:=optional, netscape.security*;resolution:=optional, sun.audio*;resolution:=optional, sun.awt.image*;resolution:=optional, * </Import-Package>

<Embed-Dependency> !javax.media, !org.osgi.core, !com.ur.urcap.api, *; scope=compile|runtime </Embed-Dependency>

I had to add only one dependency for jmf:
<dependency> <groupId>javax.media</groupId> <artifactId>jmf</artifactId> <version>2.1.1e</version> </dependency>

2 Likes