You need to configure “-noimportjava: true” which is (I think) “<_noimportjava>true<_ noimportjava>” in maven-bundle-plugin configuration.
Importing of java.* is allowed in OSGi Core 7. It would appear that you may be compiling against OSGi Core 7 while attempting to deploy on OSGi Core 6 which is not good.
BJ Hargrave
Senior Technical Staff Member, IBM // office: +1 386 848 1781
Open Source Development // mobile: +1 386 848 3788
hargrave@xxxxxxxxxx
From:
osgi-dev <osgi-dev-bounces@xxxxxxxxxxx> on behalf of BINGZHI QIAO <bingzhi.qiao@xxxxxxxxx>
Date: Saturday, July 1, 2023 at 18:53
To: osgi-dev@xxxxxxxxxxx <osgi-dev@xxxxxxxxxxx>
Subject: [EXTERNAL] [osgi-dev] Need help about Importing java.* packages not allowed: java.io error
Hello all, 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:
This Message Is From an Untrusted Sender
|
You have not previously corresponded with this sender.
|
|
|
Hello all,
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>
___________________________________________________________
BINGZHI QIAO
|