>>>>> Grzegorz Grzybek <[email protected]>: > 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.... Well, it probably is... we're in total agreement there... > - 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 Right. But perhaps some stuff I put in jetty.xml could disable the OSGi web whiteboard...? > - 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) Ok, that explains why google (or ChatGPT for that matter) couldn't find anything about this. > 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. ChatGPT hinted about the same thing before it landed on "you can't do this". Then it gave me this jetty.xml, which unfortunately didn't work: https://gist.github.com/steinarb/8eaf57dc9fb37b778e2ea9381124f099#file-jetty-xml-L134 Hm... but what ChatGPT said and what it did is two things, because that jetty.xml has "set" and not "add"...? I will try to make ChatGPT tell me how to add a resource handler in jetty.xml and not replace any existing handler. > May I ask about how does "disabled Whiteboard" look like? anything in the > logs? This is what happens in karaf.log when I uncomment org.ops4j.pax.web.config.file = ${karaf.etc}/jetty.xml in etc/org.ops4j.pax.web.cfg: https://gist.github.com/steinarb/521fcb062ab530280b13c1e88dfd0c89 This line is the last line in karaf.log that mentions /pictures (which is the resource path I am mapping in jetty.xml): https://gist.github.com/steinarb/521fcb062ab530280b13c1e88dfd0c89#file-karaf-log-L60 and there is, as far as I can see, OSGi stuff added after that...? But: With org.ops4j.pax.web.config.file commented out, the OSGi webapps show up and /pictures gets 404 With the comment in front of org.ops4j.pax.web.config.file removed, then /pictures show up, but the OSGi webapps all get 404. > 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 Interesting! Not quite sure what to rip out to use in production code...? Will have to study it closesly.
