Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Fragments: exported package not found in client bundle


The compilation error  "java.lang.Error": Unresolved compilation problems: is happenning because there are compilation errors in your workspace but JDT still creates a class file which can be loaded but will throw the Error at runtime.

PDE only allows fragments to add API (exported packages) to their hosts if the host bundle used the following header

Eclipse-ExtensibleAPI: true

Note that this is *only* used by PDE as an indication that the fragments should be added for classpaths dependencies at compile time.  The Equinox/OSGi Framework always allows fragments to export additional packages when a fragment attaches to a host bundle.

Tom



Gavin <gavin.emploi@xxxxxxxxx>
Sent by: equinox-dev-bounces@xxxxxxxxxxx

06/27/2007 02:13 AM

Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>

To
equinox-dev@xxxxxxxxxxx
cc
Subject
[equinox-dev] Fragments: exported package not found in client bundle





Context: eclipse 3.2.2

Here's the simple fragment experiment that I performed.

I created 3 bundles.

(1) experiment.host

Bundle-SymbolicName: experiment.host
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: experiment.host;version="1.0.0"

(2) experiment.frag

Bundle-SymbolicName: experiment.frag
Fragment-Host: experiment.host;version="1.0.0"
Export-Package: experiment.frag;version="3.3.2"

(3) experiment.main (the bundle accessing package "experiment.frag")

Bundle-SymbolicName: experiment.main
Import-Package: experiment.frag;version="3.3.2",
org.osgi.framework;version="1.3.0"

Observations:

a) In the eclipse workspace, I cannot import package "experiment.faq" inside
the editor of file "experiment/main/internal/Activator.java". The editor
flags the package with error:

 The import experiment.faq.* cannot be resolved.

b) If I start 3 bundles in an equinox launcher, the fragment is attached to
the host correctly.

2 ACTIVE      experiment.host_1.0.0
                  Fragments=4
3 RESOLVED    experiment.main_1.0.0
4 RESOLVED    experiment.frag_1.0.0
                  Master=2

However starting bundle 3 will throw a "java.lang.Error": Unresolved
compilation problems:
The import experiment.frag cannot be resolved

c) If I attach bundle "experiment.fraq" to "system.bundle" instead, then
everything wires up correctly.

Bundle-SymbolicName: experiment.frag
Fragment-Host: system.bundle
Export-Package: experiment.frag;version="3.3.2"

My understanding of fragment bundles is that they allow the contribution of
new packages OR the contribution of new artifacts to the same package in the
host bundle (split package scenario).
Why is my experiment failing ?

Thanks

G

_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev


Back to the top