[ 
http://issues.ops4j.org/browse/PAXWICKET-27?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11839#action_11839
 ] 

Stuart McCulloch commented on PAXWICKET-27:
-------------------------------------------

See section 3.6.4 of the core OSGi spec (Package Constraints)

   "Class space consistency can only be ensured if a bundle has only one 
exporter for each package."

and for completeness see these quotes from later in the spec:

   "These constraints ensure that a set of bundles share the same class loader 
for the same package."
   "... the Framework must create one class loader for each bundle that is not 
a fragment"

When you have two bundles import and export a package and a third importing it, 
one of the first two bundles will be chosen as _the_ exporter for that package 
(taking into account version, attributes, etc.) and this bundle will be used to 
satisfy the import on the other bundles. This is why exporting the default 
package (or META-INF) is fundamentally a bad idea, because only one bundle will 
be marked as the exporter.

You can use techniques like Require-Bundle to merge together packages split 
across disparate bundle, but this is very fragile and would cause far more 
problems for you in the future. Far better to use something like the extender 
pattern, like Alin suggested...

> the pax wicket bundle should import 'META-INF'
> ----------------------------------------------
>
>                 Key: PAXWICKET-27
>                 URL: http://issues.ops4j.org/browse/PAXWICKET-27
>             Project: Pax Wicket
>          Issue Type: Bug
>            Reporter: Ittay Dror
>            Assignee: Niclas Hedhman
>
> it is a common idiom for a library to allow other libraries to hook into it 
> by providing some special file (usuall properties) in META-INF. these files 
> are found by using the context class loader and they can then contain 
> reference to classes in the plugin libraries. 
> in pax wicket and jetty (pax web) setup, the context class loader is 
> BundleClassLoader, which uses the pax wicket bundle to load 
> classes/resources. since the bundle doesn't import 'META-INF', it will not 
> find the resources in other libraries (assuming they export 'META-INF')

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.ops4j.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to