Hello

ChatGPT tells me that it is using org.ops4j.pax.web.config.file at all
> that causes the OSGi web whiteboard to be disabled, and it tells me that
> there is nothing I could but into jetty.xml to enable the OSGi web
> whiteboard.


If ChatGPT says that, it is a filthy liar....

   - org.ops4j.pax.web.config file is a config admin initial content for
   Pax web and it configures Pax Web and Whiteboard - it doesn't disable it
   - you can't enable Whiteboard in jetty.xml, because it's a Jetty
   configuration file, which effectively doesn't know anything about OSGi.
   It's Pax Web that makes Jetty OSGi-aware (at runtime, because statically
   Jetty libs indeed include OSGi headers)

The only thing that I can think of is that you've configured jetty.xml by
replacing the only handler of the server - you should add handlers, not
replace them.

May I ask about how does "disabled Whiteboard" look like? anything in the
logs?

BTW - there's an OSGi example for registering (programmatically) a Jetty
resource handler - because Pax Web _can_ detect Handler OSGi services. See
https://github.com/ops4j/org.ops4j.pax.web/blob/e15cb08d433e2d500519b65f4a0cb7c273f4399a/pax-web-itest/pax-web-itest-container/pax-web-itest-jetty/src/test/java/org/ops4j/pax/web/itest/jetty/config/JettyHandlerServiceIntegrationTest.java#L75-L104

kind regards
Grzegorz Grzybek

niedz., 22 lut 2026 o 21:32 Steinar Bang <[email protected]> napisał(a):

> >>>>> Steinar Bang <[email protected]>:
>
> >>>>> Grzegorz Grzybek <[email protected]>:
> >> With Pax Web Jetty feature comes default jetty.xml which contains this
> for
> >> example:
> [snip!]
>
> > Here is the stuff I added to jetty.xml:
> >
> https://gist.github.com/steinarb/8eaf57dc9fb37b778e2ea9381124f099#file-jetty-xml-L134
>
> > Then I enabled the config with
> >
> https://gist.github.com/steinarb/6784d5659ed1ef6f90d83146556cf349#file-org-ops4j-pax-web-cfg-L27
>
> ChatGPT tells me that it is using org.ops4j.pax.web.config.file at all
> that causes the OSGi web whiteboard to be disabled, and it tells me that
> there is nothing I could but into jetty.xml to enable the OSGi web
> whiteboard.
>
> ChatGPT recommends I write a servlet to serve files from a directory.
> Seems a bit excessive...?
>
> I was hoping to be able to serve a directory at the same time as running
> the OSGi web whiteboard, without requiring any code to do so.
>
> If not I guess I could create a OSGi web whiteboard component that
> derives from ResourceServlet, is fixed to the /pictures context path and
> uses a karaf configuration to set the local path on disk to serve up?
>
> That component doesn't have to be tied into anything else.
>
>

Reply via email to