Import-Package necessary for org.xml.sax? [message #874786] |
Mon, 21 May 2012 10:39  |
Eclipse User |
|
|
|
I'm trying to run a system consisting of two bundles A and B. A exports a package foo.bar containing a class ConfigWrapper, which is implemented by using org.apache.commons.configuration. commons-configuration.jar is contained in the lib folder of A and is part of the Bundle classpath.
Classes of bundle B use foo.bar.ConfigWrapper, and the manifest of B contains "Import-Package: foo.bar".
My problem is, that ConfigWrapper cannot be instantiated because of a NoClassDefFoundError: org/xml/sax/EntityResolver.
I have a solution for this, but I cannot believe that this is necessary: If I add org.xml.sax and several related packages to the list of imported packages of A, the NoClassDefFoundError disappears.
Do I really have to scan all externally provided libraries for their dependencies on javax.*, org.xml.*, org.w3c.* et cetera and name those in the Import-Packages section of the manifest file? Or do I miss an important point?
Thanks for your help
Rolf
|
|
|
|
|
|
Re: Import-Package necessary for org.xml.sax? [message #875711 is a reply to message #874786] |
Wed, 23 May 2012 04:05   |
Eclipse User |
|
|
|
Hi Rolf,
by default only exposed JRE packages are java.* and javax.*.
This is maintained by execution environment profiles. Profiles shipped
with standard Equinox are files with .profile extension in root of
org.eclipse.osgi_*.jar (* means version) archive.
Check what your profile contains because my Indigo
org.eclipse.osgi_3.7.2.v20120110-1415.jar's JavaSE-1.7.profile file
contains (among others):
org.osgi.framework.system.packages = \
...
org.xml.sax,\
org.xml.sax.ext,\
org.xml.sax.helpers
So org.xml.sax.EntityResolver should be available to any bundle
out-of-the-box....
Anyway, declaring these "not-so-common" packages as imported is not
weird but absolutely normal and always working approach.
Also, you may have been interested to read
*
http://blog.springsource.org/2009/01/19/exposing-the-boot-classpath-in-osgi/
* or http://wiki.eclipse.org/Equinox_Boot_Delegation
Cheers
Libor
On 05/21/2012 04:39 PM, Rolf Hauck wrote:
> I'm trying to run a system consisting of two bundles A and B. A exports
> a package foo.bar containing a class ConfigWrapper, which is implemented
> by using org.apache.commons.configuration. commons-configuration.jar is
> contained in the lib folder of A and is part of the Bundle classpath.
> Classes of bundle B use foo.bar.ConfigWrapper, and the manifest of B
> contains "Import-Package: foo.bar".
> My problem is, that ConfigWrapper cannot be instantiated because of a
> NoClassDefFoundError: org/xml/sax/EntityResolver.
> I have a solution for this, but I cannot believe that this is necessary:
> If I add org.xml.sax and several related packages to the list of
> imported packages of A, the NoClassDefFoundError disappears.
> Do I really have to scan all externally provided libraries for their
> dependencies on javax.*, org.xml.*, org.w3c.* et cetera and name those
> in the Import-Packages section of the manifest file? Or do I miss an
> important point?
>
> Thanks for your help Rolf
>
|
|
|
Re: Import-Package necessary for org.xml.sax? [message #875933 is a reply to message #875711] |
Wed, 23 May 2012 11:17  |
Eclipse User |
|
|
|
You can also try to make use of org.osgi.framework.bootdelegation
property in config.ini to list org.xml
org.osgi.framework.bootdelegation=org.xml
Libor
On 05/23/2012 10:05 AM, Libor Jelinek wrote:
> Hi Rolf,
> by default only exposed JRE packages are java.* and javax.*.
>
> This is maintained by execution environment profiles. Profiles shipped
> with standard Equinox are files with .profile extension in root of
> org.eclipse.osgi_*.jar (* means version) archive.
>
> Check what your profile contains because my Indigo
> org.eclipse.osgi_3.7.2.v20120110-1415.jar's JavaSE-1.7.profile file
> contains (among others):
>
> org.osgi.framework.system.packages = \
> ...
> org.xml.sax,\
> org.xml.sax.ext,\
> org.xml.sax.helpers
>
> So org.xml.sax.EntityResolver should be available to any bundle
> out-of-the-box....
>
> Anyway, declaring these "not-so-common" packages as imported is not
> weird but absolutely normal and always working approach.
>
> Also, you may have been interested to read
> *
> http://blog.springsource.org/2009/01/19/exposing-the-boot-classpath-in-osgi/
>
> * or http://wiki.eclipse.org/Equinox_Boot_Delegation
>
> Cheers
> Libor
>
> On 05/21/2012 04:39 PM, Rolf Hauck wrote:
>> I'm trying to run a system consisting of two bundles A and B. A exports
>> a package foo.bar containing a class ConfigWrapper, which is implemented
>> by using org.apache.commons.configuration. commons-configuration.jar is
>> contained in the lib folder of A and is part of the Bundle classpath.
>> Classes of bundle B use foo.bar.ConfigWrapper, and the manifest of B
>> contains "Import-Package: foo.bar".
>> My problem is, that ConfigWrapper cannot be instantiated because of a
>> NoClassDefFoundError: org/xml/sax/EntityResolver.
>> I have a solution for this, but I cannot believe that this is necessary:
>> If I add org.xml.sax and several related packages to the list of
>> imported packages of A, the NoClassDefFoundError disappears.
>> Do I really have to scan all externally provided libraries for their
>> dependencies on javax.*, org.xml.*, org.w3c.* et cetera and name those
>> in the Import-Packages section of the manifest file? Or do I miss an
>> important point?
>>
>> Thanks for your help Rolf
>>
|
|
|
Powered by
FUDForum. Page generated in 0.54450 seconds