jettyapache-karafpax-webfusefabric

Karaf & Pax Web jetty specific SslConnectionFactory


I'm trying to setup a specific jetty SSL context factory inside Karaf (in fact, Fabric8 (www.fabric8.io)).

I do this directly into the jetty.xml file: <New id="sslContextFactory" class="fr.maatg.pandora.sl.jetty.GridSslContextFactory"> ... </New>

When I start the container, Pax Web generate an exception ( full exception https://gist.github.com/jrevillard/adb8e0bc0b1e9b568a67):

Caused by: java.lang.ClassNotFoundException: fr.maatg.pandora.sl.jetty.GridSslContextFactory not found by org.ops4j.pax.web.pax-web-jetty [100] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532) at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955) at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_51] at org.eclipse.jetty.util.Loader.loadClass(Loader.java:100) at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.nodeClass(XmlConfiguration.java:366) at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(XmlConfiguration.java:767) at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:404) at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:334) at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:281) ... 16 more

Could someone tell me how I can use my specific factory ?

Jerome


Solution

  • As the pax-web-jetty bundle doesn't support a dynamic import of "third-party" packages you'll need to create an extra fragment bundle that contains this class and attach it to the pax-web-jetty bundle. A working sample on how to add this to pax-web-jetty can be found at the pax web samples

    In short the fragment bundle manifest needs to contain a Fragment host. With the felix-bundle-plugin it needs to look like this:

    <Fragment-Host>org.ops4j.pax.web.pax-web-jetty</Fragment-Host>