Closed io7m closed 2 years ago
In order to have a module called osgi.core
with Atomos on the module path you must use the appropriate osgi.core
facade provided by Atomos for the framework you are using (Equinox or Felix).
https://search.maven.org/remotecontent?filepath=org/apache/felix/atomos/osgi.core/8.0.0/osgi.core-8.0.0-AtomosEquinox.jar https://search.maven.org/remotecontent?filepath=org/apache/felix/atomos/osgi.core/8.0.0/osgi.core-8.0.0-AtomosFelix.jar
You use the classifier AtomosEquinox
or AtomosFelix
depending on which framework you have.
<dependency>
<groupId>org.apache.felix.atomos</groupId>
<artifactId>osgi.core</artifactId>
<version>8.0.0</version>
<classifier>AtomosEquinox|AtomosFelix</classifier>
<scope>provided</scope>
</dependency>
Ah, thank you! It was the classifier
that was the problem in my case. I was using the plain org.apache.felix.atomos:osgi.core
artifact without specifying a classifier.
Somewhat related to #52, it seems that it's not really possible to write a straightforward "host" program that's JPMS modularized. There are conflicts between the various OSGi artifacts that cause a number of issues.
I don't doubt that it would be possible to work around them using
bnd
and various class and module-rewriting magic, but I feel like it really should be possible to at least get a program to build and run without them.I've put together a trivial example here that simply tries to start up an essentially empty framework from a
main
method without any tooling:https://github.com/io7m/atomos20220505
Note that in order to compile the code, there needs to be a dependency on the
osgi.core
module (due to dependencies on the core classes by the Framework API). If theosgi.core
module isn't on the module path, the build obviously fails. If theosgi.core
module is on the module path, the build succeeds but the JVM then refuses to start due to multiple modules having the same packages.I suspect I might be in the minority with trying to start up an OSGi container from a JPMS program, but... It's pretty bad that it's apparently not possible.