Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Import-Package error for already-deployed dependency
Import-Package error for already-deployed dependency [message #1626115] Fri, 20 February 2015 20:53 Go to next message
Ryan Bennett is currently offline Ryan BennettFriend
Messages: 3
Registered: February 2015
Junior Member
Hi all,

I'm trying to deploy a package to Virgo with a dependency on org.glassfish.jersey.core.jersey-common_2.14.0, which itself depends on javax.annotation. I'm getting the following message in the log when I do so:

An Import-Package could not be resolved. Resolver error data <Import-Package: javax.annotation; version="[1.2.0,2.0.0)">. Caused by missing constraint in bundle <org.glassfish.jersey.core.jersey-common_2.14.0>
             constraint: <Import-Package: javax.annotation; version="[1.2.0,2.0.0)">


The thing is, I am already deploying javax.annotation-api prior to this bundle being loaded. Some lines above the error in the log, I see two versions of javax-annotation being loaded:

Bundle javax.annotation_1.1.0.v201108011116, BundleEvent STARTED 
Bundle javax.annotation-api_1.2.0, BundleEvent STARTED 


The second bundle is a jar which I'm deploying with my package. Looking at the MANIFEST.MF for javax.annotation-api-1.2.jar, I see that it exports the exact package that is "missing" according to the error message:

Export-Package: javax.annotation;version="1.2",javax.annotation.security;version="1.2",javax.annotation.sql;version="1.2"


Has anyone encountered anything like this?
Re: Import-Package error for already-deployed dependency [message #1630567 is a reply to message #1626115] Mon, 23 February 2015 09:04 Go to previous messageGo to next message
Florian Waibel is currently offline Florian WaibelFriend
Messages: 160
Registered: June 2010
Senior Member
Hi,

what flavor and version of Virgo are you using? Could you provide a simple example to reproduce the issue?

Regards,
florian
Re: Import-Package error for already-deployed dependency [message #1631035 is a reply to message #1630567] Mon, 23 February 2015 14:50 Go to previous messageGo to next message
Florian Waibel is currently offline Florian WaibelFriend
Messages: 160
Registered: June 2010
Senior Member
Hi,

I tried with the latest successful build from our Jenkins[1] and dropped the following bundles into the pickup folder:


  • hk2-api-2.4.0-b11.jar
  • hk2-utils-2.4.0-b11.jar
  • javax.annotation-api-1.2.jar
  • javax.ws.rs-api-2.0.1.jar
  • jersey-common-2.14.jar
  • jersey-guava-2.16.jar
  • org.apache.servicemix.bundles.javax-inject-1_2.jar
  • osgi-resource-locator-1.0.1.jar


osgi> headers 133 | grep Bundle
Bundle headers:
 Bundle-Description = Java(TM) Common Annotations 1.2 API Design Specification
 Bundle-DocURL = https://glassfish.java.net
 Bundle-License = https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html
 Bundle-ManifestVersion = 2
 Bundle-Name = javax.annotation API
 Bundle-SymbolicName = javax.annotation-api
 Bundle-Vendor = GlassFish Community
 Bundle-Version = 1.2


osgi> headers 150 | grep Bundle
Bundle headers:
 Bundle-Description = Jersey core common packages
 Bundle-DocURL = http://www.oracle.com/
 Bundle-License = http://glassfish.java.net/public/CDDL+GPL_1_1.html
 Bundle-ManifestVersion = 2
 Bundle-Name = jersey-core-common
 Bundle-SymbolicName = org.glassfish.jersey.core.jersey-common
 Bundle-Vendor = Oracle Corporation
 Bundle-Version = 2.14.0
 Created-By = Apache Maven Bundle Plugin


osgi> bundle 150 | grep javax.annotation
    javax.annotation; version="1.2.0"<javax.annotation-api_1.2.0 [133]>


osgi> clload javax.annotation.PostConstruct 150

Successfully loaded [javax.annotation.PostConstruct] using class loader from:
  150	org.glassfish.jersey.core.jersey-common
  		[provided by 133 javax.annotation-api]


As you can see the Jersey bundle is wired to the javax.annotation-api bundle and able to load the provided classes.

Hope this helps,
florian

[1] https://hudson.eclipse.org/virgo/view/Ripplor%20Repositories/job/virgo.packaging.snapshot/
Re: Import-Package error for already-deployed dependency [message #1631374 is a reply to message #1630567] Mon, 23 February 2015 19:06 Go to previous messageGo to next message
Ryan Bennett is currently offline Ryan BennettFriend
Messages: 3
Registered: February 2015
Junior Member
I'm not sure of how to tell which flavor or Virgo I'm dealing with, but the bundles for org.eclipse.virgo.___ are all of version 3.6.3. I've also tried the same package on a Virgo with org.eclipse.virgo packages of version 3.6.2.RELEASE, and the package deploys without a problem.

As for reproducing the issue, it looks like you just loaded the same two packages that I'm having the issue with.

Could you post the whole manifest for javax-annotation-api? The one I'm using looks like this:

Manifest-Version: 1.0
Export-Package: javax.annotation;version="1.2",javax.annotation.securi
 ty;version="1.2",javax.annotation.sql;version="1.2"
Implementation-Version: 1.2
Built-By: romano
Specification-Vendor: Oracle Corporation
Tool: Bnd-0.0.255
Bundle-Name: javax.annotation API
Created-By: 1.7.0_09 (Oracle Corporation)
Bundle-Vendor: GlassFish Community
Implementation-Vendor: GlassFish Community
Implementation-Vendor-Id: org.glassfish
Bundle-Version: 1.2
Build-Jdk: 1.7.0_09
Bnd-LastModified: 1366998437922
Bundle-ManifestVersion: 2
Bundle-License: (removed due to forum policy)
Bundle-Description: Java(TM) Common Annotations 1.2 API Design Specifi
 cation
Specification-Version: 1.2
Import-Package: javax.annotation;version="1.2",javax.annotation.securi
 ty;version="1.2",javax.annotation.sql;version="1.2"
Bundle-SymbolicName: javax.annotation-api
Bundle-DocURL: (removed due to forum policy)
Extension-Name: javax.annotation
Archiver-Version: Plexus Archiver


One thing that I noticed was that the bundle is importing the same packages that it exports. Does this imply an additional dependency for javax-annotation-api?
Re: Import-Package error for already-deployed dependency [message #1632391 is a reply to message #1631374] Tue, 24 February 2015 08:42 Go to previous messageGo to next message
Florian Waibel is currently offline Florian WaibelFriend
Messages: 160
Registered: June 2010
Senior Member
An overview of available flavors / deliverables is available here: https://eclipse.org/virgo/deliverables/

I used the latest Virgo Server for Apache Tomcat with the unmodified bundle available from Maven Central: http://search.maven.org/#artifactdetails|javax.annotation|javax.annotation-api|1.2|jar

Should a bundle import its own exported packages?
http://felix.apache.org/documentation/tutorials-examples-and-presentations/apache-felix-osgi-faq.html#should-a-bundle-import-its-own-exported-packages
Re: Import-Package error for already-deployed dependency [message #1632995 is a reply to message #1632391] Tue, 24 February 2015 16:09 Go to previous message
Ryan Bennett is currently offline Ryan BennettFriend
Messages: 3
Registered: February 2015
Junior Member
Thanks for the link about importing exported packages. Additionally, I just tried loading the jars one by one on a fresh install of both Virgo Nano and Virgo Tomcat 3.6.3, and jersey-common loaded without errors.

Unfortunately, the Virgo I need to run this on cannot be replaced or reinstalled as it is part of a packaged product. Is there any configuration specific to the Virgo server that could be causing this, since we're not seeing the same scenario on a fresh install?
Previous Topic:How build Tomcat OSGi Bundle
Next Topic:Virgo 3.6.2 library load error (folder is expected as jar archive)
Goto Forum:
  


Current Time: Wed Sep 26 10:18:40 GMT 2018

Powered by FUDForum. Page generated in 0.01899 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top