On Tue, Dec 26, 2023 at 5:52 PM Silvio Bierman <silvio@jambo.software>
wrote:

> Hello all,
>
> I am using Felix framework 7.0.5 and am trying to create a bundle that
> embeds Jetty 12. Once I put the Jetty dependencies inside the bundle
> starting it does no longer cause ServiceEvents in the ServiceListeners I
>

I am not sure if I understand your issue in the entirety but here is
something:

Are you embedding the entire Jetty JARs into your own OSGi bundle? I am
doing this and I had an issue where the ServiceLoader services were not
being registered with OSGi and were not being provided/wired into
ServiceLoader.load() calls. In the end, I had to add all the
Require-Capability and Provide-Capability into my own OSGi bundle's
META-INF/MANIFEST.MF. This is a snippet from the pom.xml:

<Require-Capability>
osgi.extender; filter:="(osgi.extender=osgi.serviceloader.processor)",
osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)",
osgi.serviceloader;filter:="(osgi.serviceloader=javax.servlet.ServletContainerInitializer)";resolution:=optional;cardinality:=multiple,
osgi.serviceloader;filter:="(osgi.serviceloader=org.eclipse.jetty.http.HttpFieldPreEncoder)";cardinality:=multiple,
osgi.serviceloader;filter:="(osgi.serviceloader=org.eclipse.jetty.webapp.Configuration)";cardinality:=multiple,
osgi.serviceloader;filter:="(osgi.serviceloader=org.eclipse.jetty.xml.ConfigurationProcessorFactory)";resolution:=optional;cardinality:=multiple,
osgi.serviceloader;filter:="(osgi.serviceloader=org.eclipse.jetty.util.security.CredentialProvider)";resolution:=optional;cardinality:=multiple,
osgi.serviceloader;filter:="(osgi.serviceloader=org.eclipse.jetty.security.Authenticator$Factory)";resolution:=optional;cardinality:=multiple,
osgi.serviceloader;filter:="(osgi.serviceloader=org.eclipse.jetty.io.ssl.ALPNProcessor$Server)";resolution:=optional;cardinality:=multiple
</Require-Capability>
<Provide-Capability>
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.http.HttpFieldPreEncoder";register:="org.eclipse.jetty.http.Http1FieldPreEncoder",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.http.HttpFieldPreEncoder";register:="org.eclipse.jetty.http2.hpack.HpackFieldPreEncoder",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.io.ssl.ALPNProcessor$Server";register:="org.eclipse.jetty.alpn.java.server.JDK9ServerALPNProcessor",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.webapp.WebXmlConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.webapp.WebInfConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.webapp.WebAppConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.webapp.ServletsConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.webapp.MetaInfConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.webapp.JspConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.webapp.JndiConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.webapp.JmxConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.webapp.JaspiConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.webapp.JaasConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.webapp.FragmentConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.plus.webapp.PlusConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.plus.webapp.EnvConfiguration",
osgi.serviceloader;osgi.serviceloader="org.eclipse.jetty.webapp.Configuration";register:="org.eclipse.jetty.annotations.AnnotationConfiguration"
</Provide-Capability>

This requires use of Apache SPI-Fly.


> have registered on the BundleContext. The bundle does not instantiate
> anything Jetty related yet (well, it did but I removed all code that did
> anything with Jetty), only the dependencies are in the POM and they are
> embedded in the bundle with
> <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> which
> causes the Jetty jars to appear inside the packaged bundle.
>
> When I remove the <Embed-Dependency/> the ServiceEvents occur as
> expected. But I need the Jetty dependencies in the bundle.
>
> Any ideas?
>
> Kind regards,
>
> Silvio
>

-- 

-- 
VH

-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to