Search code examples
glassfishosgideclarative-services

Backporting OSGI DS component to OSGI R4


I have a component which was developed for Apache Karaf 4.0.5. However, it turns out it needs to be deployed on glassfish 4, which is based on an older version of Felix. I get this message when trying to deploy it:

missing requirement [319.0] osgi.extender; (&(osgi.extender=osgi.component)(version>=1.3.0)(!(version>=2.0.0)))

However, my pom file does not show any explicit dependency on osgi.component. I think I must have used some OSGI R5 (or R6?) specific feature, but I don't know which would cause this error.

How can I either convince glassfish to accept my bundle, or change the bundle's build / pom so that I get warnings when trying to use OSGI features dependent on R5 or later?


Solution

  • You are probably using a recent version of bnd to generate your bundle and its metadata. Bnd will generate the requirement on the osgi.component extender (This is DS) when your bundle has DS components and either you require something new in DS 1.3 like field injection or you are using the very latest version of bnd.

    You can disable the generation of the requirement in your bundle with the bnd instruction:

    -dsannotations-options: norequirements

    https://bnd.bndtools.org/instructions/dsannotations-options.html