Deal of the Day

Home » Main » Manning Forums » 2009 » OSGi in Depth

Thread: Using a custom classloader with an osgi bundle

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 2 - Pages: 1 - Last Post: Nov 21, 2011 4:52 PM by: dwschulze
dwschulze

Posts: 36
Registered: 9/16/05
Using a custom classloader with an osgi bundle
Posted: Nov 17, 2011 11:18 AM
  Click to reply to this thread Reply

We need to prevent reverse engineering of our Java source code - or at least make it difficult to do. We currently distribute .war files, but they could be converted to osgi bundles. I'm considering encrypting the .jar files which would require a custom classloader to decrypt the .jar files. Here is a dormant product which used this approach:

www.componio.com/support/jinstaller/jinstaller_faq.html

We are using Glassfish 3.1, but I can't find anything on what it would take to replace the appropriate Glassfish classloader (probably the archive classloader) with a custom classloader that would decrypt our .jar files.

Would distributing our binaries as OSGI bundles make it easier to incorporate a custom classloader to decrypt the .jar files?

Thanks.

adcalves

Posts: 28
Registered: 3/5/09
Re: Using a custom classloader with an osgi bundle
Posted: Nov 17, 2011 5:58 PM   in response to: dwschulze in response to: dwschulze
  Click to reply to this thread Reply

Hi,

Yes, I believe so, in two fronts:

1) OSGi would allow you to modularize your solution, so you could divide your application into bundles that need to be encrypted and bundles that do not (e.g. less important utility code). This would improve the efficiency of your application, as it would avoid you from having to decrypt everything at runtime.

2) It is easier to plug-in class-loader in an OSGi env.

Rgds,

dwschulze

Posts: 36
Registered: 9/16/05
Re: Using a custom classloader with an osgi bundle
Posted: Nov 21, 2011 4:52 PM   in response to: adcalves in response to: adcalves
  Click to reply to this thread Reply

Great. Where do I look for some guidance or an example on how to do this?

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff
Manning Developmental Editor