Application export as standalone zip

57 views
Skip to first unread message

Tobias Niehues

unread,
Apr 19, 2016, 7:25:54 AM4/19/16
to bndtools-users
Hi,

I need to distribute an application based on a bndrun-configuration. Using the bnd-launcher which wraps all required bundles, felix framework and all options into a single jar, which works fine, but not under all circumstances: One bundle needs to register a java security provider at runtime (in this case bouncycastle, which is available as an osgi-bundle), but fails to do so, because the signature of the provider-jar can not be verified when it is embedded into the launching bundle. My configuration works fine when each bundle is installed directly into the osgi framework. Wrapping the framework and all bundles into a single launcher jar may therefore not be an option for me.

What I need may be a custom gradle task to create a distribution which looks something like the default felix installation:
mybndrunconfiguration.zip
  - bin/felix.jar
  - bundle
    - all runbundles
  - conf
    - config.properties
    - launcher.properties (defines which bundles to launch etc)
  - start.sh/bat (launches bin/felix.jar with given configuration)

Before I start implementing this task myself, does something like this already exist? What approach would you suggest? Should this new task depend on the runbundles-task?

- Tobias

BJ Hargrave

unread,
Apr 19, 2016, 8:33:02 AM4/19/16
to bndtool...@googlegroups.com
Did you look at the gradle export and runbundles tasks?

--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--
BJ

Tobias Niehues

unread,
Apr 19, 2016, 10:53:08 AM4/19/16
to bndtools-users
Yes, I did. I think I need to implement a custom ProjectLauncher

Peter Kriens

unread,
Apr 19, 2016, 4:29:23 PM4/19/16
to bndtool...@googlegroups.com
Do you put bouncy castle on the -runpath? This should work and we should fix it if it is not working.

Kind regards,

Peter Kriens

Tobias Niehues

unread,
Apr 20, 2016, 3:11:18 AM4/20/16
to bndtools-users
Hello Peter,

putting bouncycastle on the runpath solved my problem. Thank you! I wasn't aware of this parameter, what it does and why.

I found some information about the parameter in the documentation:

Peter Kriens

unread,
Apr 20, 2016, 9:38:32 AM4/20/16
to bndtool...@googlegroups.com
Good!

Kind regards,

Peter Kriens


Carma Robot

unread,
Aug 21, 2016, 5:32:06 PM8/21/16
to bndtools-users
Hello all,

I'm trying to do the same thing: use the Bouncy Castle cryptographic provider from a bndtools project in eclipse. Unfortunately, I'm not having much luck. Is there any chance you could post the exact "-runpath" configuration to make this work? Here's what I have tried so far using bndtools 3.20 in Eclipse Mars:

-runpath: org.bouncycastle.jce.provider;version='1.54'

This gets me:
Status ERROR: bndtools.core code=0 Cannot find /error/org.bouncycastle.jce.provider;version=1.54 Not found in [bnd-cache, JpmRepository [writable=false, name=Central, location=~/.bnd/shacache, digest=1ACDEDEB89F1D950D67B73D481EB7736DF65EEDB], Local, Release, Distro] null

So I check if the bcprov jar is actually in the ~/.bnd cache and I actually find it:
$ find . -name bcprov*jar
./shacache/shas/1ACDEDEB89F1D950D67B73D481EB7736DF65EEDB/bcprov-1.54.0.jar

So then I try:
-runpath: bcprov-1.54.0.jar;version='1.54'

And get:
Status ERROR: bndtools.core code=0 Cannot find /error/bcprov-1.54.0.jar;version=1.54 Not found in [bnd-cache, JpmRepository [writable=false, name=Central, location=~/.bnd/shacache, digest=1ACDEDEB89F1D950D67B73D481EB7736DF65EEDB], Local, Release, Distro] null

Also tried:
-runpath: bcprov-1.54.0.jar;version='1.54'

Also tried with an absolute path:
-runpath: /home/redacted/.bnd/shacache/shas/1ACDEDEB89F1D950D67B73D481EB7736DF65EEDB/bcprov-1.54.0.jar

Also tried:
-runpath: org.bouncycastle.*;version='1.54'

Which starts up fine but I don't actually see the provider when I do Security.getProviders(). Would really appreciate some help with this.

Tobias Niehues

unread,
Aug 22, 2016, 2:54:20 AM8/22/16
to bndtools-users
Hi,

try "-runpath: bcprov;version='[1.54.0,1.54.1)'"

-Tobias

Carma Robot

unread,
Aug 22, 2016, 9:18:27 AM8/22/16
to bndtools-users
Thank you Tobias. Your suggestion worked.

I'm curious how you knew that was the right format to specify the dependency in the runpath. Can you please help educate me so I can figure it out by myself the next time I might have to add a dependency this way?

Tobias Niehues

unread,
Aug 22, 2016, 9:49:36 AM8/22/16
to bndtools-users
Have a look at the jar's manifest. runpath and runbundles rely on the Bundle-SymbolicName to identify the correct bundle. In case of bouncycastle it is not a fully qualified named, but just "bcprov" (against the common practice)

- Tobias

Carma Robot

unread,
Aug 23, 2016, 6:01:20 PM8/23/16
to bndtools-users
Thanks for the follow-up response Tobias, very helpful.

Carma Robot

unread,
Aug 24, 2016, 1:30:07 AM8/24/16
to bndtools-users
Another question about the "-runpath:" property: how does this property relate to org.osgi.framework.bootdelegation? Is there a way to specify boot delegation with bnd?

Peter Kriens

unread,
Aug 24, 2016, 2:27:50 AM8/24/16
to bndtool...@googlegroups.com
Just specify it as a -runproperty. These properties are given to the framework.

Kind regards,

Peter Kriens

Reply all
Reply to author
Forward
0 new messages