Bug 372928 - Optional Bundles aren't resolved properly
Summary: Optional Bundles aren't resolved properly
Status: RESOLVED WORKSFORME
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: equinox.framework-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2012-02-29 20:23 EST by Nepomuk Seiler CLA
Modified: 2012-03-01 15:13 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nepomuk Seiler CLA 2012-02-29 20:23:22 EST
I found a curious bug with e4, gemini jpa and OSGi "require bundle - optional".
My database (hsql) throws an exception, which I wasn't able to see at first (see http://www.eclipse.org/forums/index.php/m/800276/). 

It was an "DefClassNotFound" Exception, because I use "require bundle" with the additional "optional" field. I try to figure out a smaller use case than mine.

BuildID: I20120127-1145

cheers,
Muki
Comment 1 Remy Suen CLA 2012-02-29 21:50:18 EST
So it works with Eclipse 3.8?
Comment 2 David Williams CLA 2012-02-29 22:04:38 EST
And, are you aware, for Juno (3.8 and 4.2) we are changing so that optional dependencies are (normally) not installed greedily, like they used to be. 

See bug 247099 and the p2 Publisher wiki [1] for some history and details on this issue of greedy vs. non-greedy requirements. 

In short, if you need it, you should include it in a feature.  

[1] http://wiki.eclipse.org/Equinox/p2/Publisher

Or ... could be something else ... just thought it might be related.
Comment 3 Nepomuk Seiler CLA 2012-03-01 04:12:46 EST
I will try to reproduce the error with 3.8. Currently I'm only use 4.2M5.

I had a look at http://wiki.eclipse.org/Equinox/p2/Publisher , but I don't think it has to do with p2 as this for bundle installation. All my bundles are already in the launch configuration and ACTIVE.
Comment 4 Nepomuk Seiler CLA 2012-03-01 04:46:51 EST
I could not reproduce the error in a small example with 4.2M5 nor with 3.8M1. I will try to figure out if this is related to EclipseLink or Eclipse Gemini JPA.

sorry for the inconvenience.
Comment 5 Thomas Watson CLA 2012-03-01 11:22:38 EST
(In reply to comment #4)
> I could not reproduce the error in a small example with 4.2M5 nor with 3.8M1. I
> will try to figure out if this is related to EclipseLink or Eclipse Gemini JPA.
> 
> sorry for the inconvenience.

Should I close this bug and you can reopen if you have more details?  At this point I am not sure what the issue is.  If you can reproduce it again then I suggest trying to refresh the bundle in question and see if it gets wired to the optional requirement.  (from an osgi> console prompt run the "refresh <bundle id>" command for the bundle ID that has the optional dependency.
Comment 6 Nepomuk Seiler CLA 2012-03-01 14:33:30 EST
Please mark this bug as closed. I will reopen it if I can reproduce the error correctly with a sample application.
Comment 7 Thomas Watson CLA 2012-03-01 15:13:09 EST
(In reply to comment #6)
> Please mark this bug as closed. I will reopen it if I can reproduce the error
> correctly with a sample application.

One thing that could be at play is the Export-Package "uses" directive.  It could be that we are not able to find a consistent class space when we wire up the optional requirement.  So instead of failing to resolve the bundle altogether we simply drop the optional import.