Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Can't import standard Java package
Can't import standard Java package [message #667292] Wed, 27 April 2011 17:38 Go to next message
Aaron  is currently offline Aaron
Messages: 21
Registered: February 2011
Junior Member
I have a Virgo OSGi project that uses Spring Web Services and other Spring projects related to web services security. When I attempt to deploy my bundle to Virgo, I get the following error:
An Import-Package could not be resolved. Caused by missing constraint in bundle <gov.noaa.nws.iris.OasisCapServiceImpl_0.0.1>
             constraint: <Import-Package: org.springframework.ws.soap.security.wss4j; version="0.0.0">
An Import-Package could not be resolved. Caused by missing constraint in bundle <org.springframework.ws.soap.security_2.0.0.RELEASE>
             constraint: <Import-Package: com.sun.xml.wss; version="0.0.0">
An Import-Package could not be resolved. Caused by missing constraint in bundle <com.springsource.com.sun.xml.wss_2.0.0.FCS>
             constraint: <Import-Package: com.sun.org.apache.xml.internal.security.algorithms; version="0.0.0">

The last Import-Package error is causing the previous two Import-Package errors. It says it can't find the com.sun.org.apache.xml.internal.security.algorithms package which is part of standard Java. Virgo's lib/java6-server.profile file contains the following:
 
 com.sun.*

which I thought meant that the com.sun.org.apache.xml.internal.security.algorithms package should be available.

Am I missing something? Do I not understand what the entries in Virgo's lib/java6-server.profile really do?

Thanks,
Aaron
Re: Can't import standard Java package [message #667320 is a reply to message #667292] Wed, 27 April 2011 23:50 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
Note that there are a couple of properties in java6-server.profile which are relevant here. You are seeing com.sun.* in the boot delegation property.

Essentially for packages available from the application class loader (AKA the "system" class loader) such as those included in the JRE, bundles either have to import them and you need to ensure they are exported from the system bundle by changing the org.osgi.framework.system.packages property in java6-server.profile or you need to boot delegate them and bundles must then not import them.

So I think the solution is to add the relevant package(s) to the org.osgi.framework.system.packages property. This will allow resolution to succeed. I think you can still boot delegate com.sun.* as this will simply short-circuit the class loading algorithm for the relevant packages and they'll be loaded using the application/"system" class loader.

Hope that helps!
Re: Can't import standard Java package [message #667603 is a reply to message #667320] Fri, 29 April 2011 17:02 Go to previous messageGo to next message
Aaron  is currently offline Aaron
Messages: 21
Registered: February 2011
Junior Member
Hi Glyn,

That helps a lot. Thanks for the explanation.

Just out of curiosity, what/who determines the packages included in org.osgi.framework.system.packages by default? Are they limited to more commonly used packages? Is there an advantage to limiting the number of packages listed there?... Why not just list all JRE packages in there?

Thanks,
Aaron
Re: Can't import standard Java package [message #667974 is a reply to message #667603] Tue, 03 May 2011 03:46 Go to previous message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
The intention was to list all the Java standard packages in org.osgi.framework.system.packages. Which do you think are missing? If you would like to raise an enhancement bug, please do.
Previous Topic:Problem to deploy many bundles in order from eclipse IDE
Next Topic:Xalan in repository/usr Causes Problems
Goto Forum:
  


Current Time: Thu Jul 24 09:01:45 EDT 2014

Powered by FUDForum. Page generated in 0.03422 seconds