I tried to deploy my bundle in a karaf container 4.2.16. ( Using AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) and OSGI 6.0.0)
When my bundle was installing, i'm facing this issue with error message below :
org.osgi.framework.BundleException: Importing java.* packages not allowed:
java.io at org.apache.felix.framework.util.manifestparser.ManifestParser.normalizeImportClauses(ManifestParser.java:349)
at org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:181)
at org.apache.felix.framework.BundleRevisionImpl.<init>(BundleRevisionImpl.java:117)
at org.apache.felix.framework.BundleImpl.createRevision(BundleImpl.java:1282)
at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:113)
at org.apache.felix.framework.Felix.installBundle(Felix.java:3042)
at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:167)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.installOrUpdateBundle(DirectoryWatcher.java:1037)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:963)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:884)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:489)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
Maybe i forgot something, please help, i tried also modifying the pom.xml, but always the same result :
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven-bundle-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>!*</Export-Package>
<Import-Package>java.*,*</Import-Package>
<Private-Package>
io.abc.restapi.*
</Private-Package>
</instructions>
</configuration>