Reputation: 38132
With Apache Felix 6.0.1 I'm getting the following error when initializing the OSGi framework:
ERROR: Error parsing system bundle statement.
org.osgi.framework.BundleException: Exported package names cannot be zero length.
at org.apache.felix.framework.util.manifestparser.ManifestParser.normalizeExportClauses(ManifestParser.java:865)
at org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:217)
at org.apache.felix.framework.ExtensionManager$ExtensionManagerRevision.update(ExtensionManager.java:977)
at org.apache.felix.framework.ExtensionManager$ExtensionManagerRevision.access$000(ExtensionManager.java:885)
at org.apache.felix.framework.ExtensionManager.updateRevision(ExtensionManager.java:378)
at org.apache.felix.framework.Felix.init(Felix.java:744)
at org.apache.felix.framework.Felix.init(Felix.java:637)
I didn't get this error with Apache Felix 5.x
And I couldn't find any JAR which has an empty package names declaration except my executable JAR, which is not an OSGi bundle at all.
Why do I get this error?
Update
The issue seems to be with the bundle goal of the Maven Bundle Plugin v4.1.0
In one startup JAR with bundle packaging I have:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<versions>
<module.b.osgi.version.clean>${project.version}</module.b.osgi.version.clean>
</versions>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>cleanVersions</goal>
</goals>
</execution>
</executions>
</plugin>
In a properties file with resource filtering set to true I have:
org.osgi.framework.system.packages.extra=${module-b.packages}
module-b.packages=${module-a.packages}, \
org.mymodule.b;version="${module.b.osgi.version.clean}", \
${foo-${foo.specification.version}}
In the generated target/classes directory I have as expected:
org.osgi.framework.system.packages.extra=${module-b.packages}
module-b.packages=${module-a.packages}, \
org.mymodule.b;version="0.14.0.SNAPSHOT", \
${foo-${foo.specification.version}}
But in the JAR it then suddenly looks like this:
org.osgi.framework.system.packages.extra=${module-b.packages}
module-b.packages=${module-a.packages}, \
org.mymodule.b;version="0.14.0.SNAPSHOT", \
Somehow ${foo-${foo.specification.version}}
got stripped to empty string!
Update 2
As this happens in the startup code, my current work-around is to change the packaging type back to jar. The OSGi clean version still gets substituted, but the Manifest file doesn't contain any OSGi entries anymore.
Upvotes: 0
Views: 288
Reputation: 38132
I think it is a regression bug in the Maven Bundle Plugin.
I've filed an issue here: https://issues.apache.org/jira/browse/FELIX-5980
Upvotes: 1