eclipse-ee4j / eclipse-ee4j/jersey
OSGi / Spifly Provider for jakarta.ws.rs.ext.RuntimeDelegate cannot be found
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
I have an OSGI environment with jersey-common 3.1.9, jakarta.ws.rs 3.1.0 and spifly 1.3.7
On startup console says
```
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: Provider for jakarta.ws.rs.ext.RuntimeDelegate cannot be found
at jakarta.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:118)
at jakarta.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:88)
at jakarta.ws.rs.core.Response$ResponseBuilder.newInstance(Response.java:776)
at jakarta.ws.rs.core.Response.status(Response.java:522)
at jakarta.ws.rs.core.Response.status(Response.java:533)
at jakarta.ws.rs.core.Response.ok(Response.java:566)
at ch.elexis.core.services.es.NoRemoteEventService.(NoRemoteEventService.java:8)
at ch.elexis.core.services.es.ElexisServerService.(ElexisServerService.java:72)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
... 146 more
Caused by: java.lang.ClassNotFoundException: Provider for jakarta.ws.rs.ext.RuntimeDelegate cannot be found
at jakarta.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:163)
at jakarta.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:103)
... 154 more
```
`jakarta.ws.rs.ext.RuntimeDelegate` is available within `jersey-common` and the `/META-INF/services/jakarta.ws.rs.ext.RuntimeDelegate` file exists.
It is, however, NOT being picked up by spifly. This is due to `/META-INF/MANIFEST.MF` not containing the required `Require-Capability` and `Provide-Capability` entries. See https://aries.apache.org/documentation/modules/spi-fly.html#specconf for details.
For example:
`logback-classic` correctly writes this info to `MANIFEST-MF` in https://github.com/qos-ch/logback/blob/5610c96b4d705a4fe6ded9c42d4f47cb92bbbd95/logback-classic/pom.xml#L343
while `jersey-common` does not do so in https://github.com/eclipse-ee4j/jersey/blob/d9658aa3064236abf1280f16e1705454e5d0b599/core-common/pom.xml#L150C25-L150C120
So adding the resp. extension should make OSGI Spifly pick up the required RuntimeDelegate and make it run, while it should not change behaviour for non-osgi uses of the bundle.
Contributor guide
Assessment
This issue has not been assessed yet.