{"id":20713845,"url":"https://github.com/diffplug/osgix","last_synced_at":"2025-06-15T15:36:41.094Z","repository":{"id":57718788,"uuid":"49996934","full_name":"diffplug/osgiX","owner":"diffplug","description":"Expose the entire JRE to OSGi  using extension bundles","archived":false,"fork":false,"pushed_at":"2020-12-31T21:10:43.000Z","size":77,"stargazers_count":23,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-11T06:49:44.566Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diffplug.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-20T01:58:18.000Z","updated_at":"2024-12-02T18:12:11.000Z","dependencies_parsed_at":"2022-09-26T22:30:34.150Z","dependency_job_id":null,"html_url":"https://github.com/diffplug/osgiX","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/diffplug/osgiX","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2FosgiX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2FosgiX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2FosgiX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2FosgiX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diffplug","download_url":"https://codeload.github.com/diffplug/osgiX/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2FosgiX/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259998432,"owners_count":22943815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T02:27:39.645Z","updated_at":"2025-06-15T15:36:41.068Z","avatar_url":"https://github.com/diffplug.png","language":null,"readme":"# \u003cimg align=\"left\" src=\"osgiX.png\"\u003e OsgiX: Expose the entire JRE to OSGi\u003cbr\u003e\u0026nbsp;using extension bundles\n\nIf you've been working with OSGi, you've certainly seen this error before: `Unresolved requirement: Import-Package: sun.misc`\n\nThe cause of the problem is that OSGi doesn't supply the entire JRE to its bundles - it only provides the most standardized packages.  This means that non-standard packages like `sun.misc` and `sun.reflect` aren't available to your bundles, even though they are in common usage.\n\nThe easiest way to fix this is with an **extension bundle**.  This is a fragment bundle which contains nothing besides a manifest that looks like this:\n\n```\nExport-Package: sun.misc\nFragment-Host: system.bundle; extension:=framework\nBundle-SymbolicName: com.diffplug.osgi.extension.sun.misc\nBundle-ManifestVersion: 2\nManifest-Version: 1.0\n```\n\nThis forces the OSGi system bundle to export the `sun.misc` package, thus fixing the `Unresolved requirement` errors.\n\n## MavenCentral coordinates\n\nThis project provides extension bundles for the following packages:\n\n* `sun.misc` ([MavenCentral](http://search.maven.org/#artifactdetails%7Ccom.diffplug.osgi%7Ccom.diffplug.osgi.extension.sun.misc%7C0.0.0%7Cjar))\n* `sun.reflect` ([MavenCentral](http://search.maven.org/#artifactdetails%7Ccom.diffplug.osgi%7Ccom.diffplug.osgi.extension.sun.reflect%7C0.0.0%7Cjar))\n* `com.sun.net.httpserver` ([MavenCentral](http://search.maven.org/#artifactdetails%7Ccom.diffplug.osgi%7Ccom.diffplug.osgi.extension.com.sun.net.httpserver%7C0.0.0%7Cjar))\n\nThey are available on MavenCentral at coordinates following this convention:\n\n* `com.diffplug.osgi:com.diffplug.osgi.extension.\u003cpackage\u003e:0.0.0`\n\n## Other packages\n\nIf you need an extension bundle for a different package, file an issue and we'd be happy to publish it for you.  Or you can make your own bundle using the following recipe:\n\n* set the `PKG` variable in `gradle.properties`\n* run `gradlew build`\n* your extension bundle will be in `build/libs`\n\n## Alternatives to extension bundles\n\nFor a more detailed description of what's going on, [the Spring blog has a detailed article](http://spring.io/blog/2009/01/19/exposing-the-boot-classpath-in-osgi/).  We're pretty convinced that the extension bundles provided above are the fastest and clearest ways to address this issue, but here's a summary of the alternatives.\n\nAnother way to accomplish this same effect is to set `org.osgi.framework.system.packages=sun.misc,sun.reflect`.  This will fix import errors around `sun.misc` and `sun.reflect`, but now you will have new errors about `javax.swing` and every other standard java package.  By setting this property, you are overriding all of the framework default packages, so you're likely to cause new problems.\n\nIf you happen to be using OSGi 4.2 or later, you can set `org.osgi.framework.system.packages.extra=sun.misc,sun.reflect`, and it will simply add those two packages to the system default packages.  This has the exact same effect as including the extension bundles for `sun.misc` and `sun.reflect`.\n\nA slightly different choice is to set `org.osgi.framework.bootdelegation=sun.misc.*,sun.reflect.*`.  This will fix the errors, but will do so by automatically providing these packages to all bundles, whether they imported them or not.  It's a subtle difference, and it usually doesn't matter, but you can try it if you want.\n\n## Acknowledgements\n\n* Thanks to Spring for their [excellent blog post](http://spring.io/blog/2009/01/19/exposing-the-boot-classpath-in-osgi/) on this subject.\n* Maintained by [DiffPlug](http://www.diffplug.com/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiffplug%2Fosgix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiffplug%2Fosgix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiffplug%2Fosgix/lists"}