bundrun based executable jar - 'ClassNotFoundException: sun.misc.Unsafe' at runtime

26 views
Skip to first unread message

Milen Dyankov

unread,
Sep 19, 2017, 9:35:28 AM9/19/17
to bndtool...@googlegroups.com
I build an executable jar from a bndrun and it all works fine until runtime. 
Then it turns out one of the bundles at some point throws 

java.lang.ClassNotFoundException: sun.misc.Unsafe

Leaving aside the fact they shouldn't be using it and given than I can not change the bundle, what are my options to solve that?

Best,
Milen

BJ Hargrave

unread,
Sep 19, 2017, 9:46:43 AM9/19/17
to bndtool...@googlegroups.com
Add sun.misc to bootdelegation:

-runproperties: org.osgi.framework.bootdelegation="sun.*,com.sun.*"


--
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

Milen Dyankov

unread,
Sep 19, 2017, 10:05:21 AM9/19/17
to bndtool...@googlegroups.com
Thanks BJ, 

that of course works! What got me confused was `-runsystempackages`  instruction which is what I tried without success.

 

On Tue, Sep 19, 2017 at 3:46 PM, BJ Hargrave <b...@bjhargrave.com> wrote:
Add sun.misc to bootdelegation:

-runproperties: org.osgi.framework.bootdelegation="sun.*,com.sun.*"


On Tue, Sep 19, 2017 at 9:35 AM Milen Dyankov <milend...@gmail.com> wrote:
I build an executable jar from a bndrun and it all works fine until runtime. 
Then it turns out one of the bundles at some point throws 

java.lang.ClassNotFoundException: sun.misc.Unsafe

Leaving aside the fact they shouldn't be using it and given than I can not change the bundle, what are my options to solve that?

Best,
Milen

--
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-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
BJ

--
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-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Neil Bartlett

unread,
Sep 19, 2017, 10:07:30 AM9/19/17
to bndtool...@googlegroups.com
runsystempackages would work if the bundle in question imported sun.misc... which it really should! But since you said the bundle cannot be changed, delegation is the way forward. 

Neil
Reply all
Reply to author
Forward
0 new messages