ops4j / org.ops4j.pax.web

OSGi R7 Http Service, Whiteboard and Web Applications (OSGi CMPN Release chapters 102, 140 and 128) implementation using Jetty 9, Tomcat 9 or Undertow 2.
https://ops4j1.jira.com/wiki/display/paxweb/Pax+Web
Other
144 stars 183 forks source link

[8.0.x] Where is JSF Support? #1725

Closed pleaseEnterPassword closed 1 year ago

pleaseEnterPassword commented 2 years ago

Hello,

I just upgraded to pax-web 8.0.2 and I am missing the JSF support? It is comment out in the features.xml of pax-web. Did you forget to integrate the JSF support in the new pax web version?

grgrzybek commented 2 years ago

Indeed - I've disabled specific JSF features. The point is that there's good amount of enhancements related to:

If you look at the JSF samples, there's good amount of them - ordinary WARs, thin WARs (where myfaces/primefaces libraries are installed externally as bundles) and even CDI.

I decided that there's nothing special needed from Pax Web project to handle JSF. Of course there may be scenarios you're missing, so pretty please share the details.

If you have some use cases that stopped working, please describe them. Maybe you want some JSF "services" to be provided by Pax Web itself? I don't know JSF much (I never used it tbh), so you're the expert here ;)

pleaseEnterPassword commented 2 years ago

Hello @grgrzybek

we having some Problem, but JSF itself seems to work. We are using cxf and it registers the CXFNonSpringServlet on the context path / Our WAB (containing the JSF) is also deployed on the context path /

In previous versions of pax.web this was no problem, but somehow in the current version the jsf servlet is not working when cxf is also bind on / If we change the context path of our wab the jsf servlet is working as expected. Sadly we cannot change the context binding of cxf (or at least we don't know how) Do you have any advices how we can solve this problem?

Thanks

grgrzybek commented 2 years ago

Thanks for the details - indeed, having a CXF servlet (registered using HttpService) and a WAB using the same context (/) may cause problems (though Pax Web improved it much, / context was kind of special).

1717 fixed some issues related to these conflicts, so if you could, please check if Pax Web 8.0.4 works for you - it contains more integration tests related to / context sharing. If there's still a problem, I'll have an existing test to check your particular problem ;)

pleaseEnterPassword commented 2 years ago

Hi @grgrzybek

We use the pax web version 8.0.2 in the karaf version 4.4.0. We tried to override the pax web version with the fixed version in the karaf (we package the karaf with the karaf maven plugin). Sadly this didnt work as expected. We get the following error:

[INFO] Startup stage [INFO] Loading startup repositories [INFO] Resolving startup features and bundles [INFO] Features: framework-logback, pax-web-specs/8.0.5, pax-web-core/8.0.5, pax-web-websockets/8.0.5, pax-web-jetty/9.4.48.v20220622, pax-web-jetty-extras/9.4.48.v20220622, pax-web-jetty-websockets/9.4.48.v20220622, pax-web-jetty-http2/9.4.48.v20220622, pax-web-jetty-http2-jdk8/9.4.48.v20220622, pax-web-jetty-http2-jdk9/9.4.48.v20220622, pax-web-http-jetty/8.0.5, pax-web-tomcat/9.0.64, pax-web-tomcat-websockets/9.0.64, pax-web-http-tomcat/8.0.5, pax-web-undertow/2.2.18.Final, pax-web-undertow-websockets/2.2.18.Final, pax-web-http-undertow/8.0.5, pax-web-jsp/8.0.5, pax-web-whiteboard/8.0.5, pax-web-war/8.0.5, pax-web-karaf/8.0.5 [INFO] Bundles: [INFO] ------------------------------------------------------------------------

[...]

[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.4.0:assembly (default-assembly) on project server-karaf-platform: Unable to build assembly: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=pax-web-jetty-http2-jdk9; type=karaf.feature; version=9.4.48.v20220622; filter:="(&(osgi.identity=pax-web-jetty-http2-jdk9)(type=karaf.feature)(version>=9.4.48.v20220622))" [caused by: Unable to resolve pax-web-jetty-http2-jdk9/9.4.48.v20220622: missing requirement [pax-web-jetty-http2-jdk9/9.4.48.v20220622] osgi.identity; osgi.identity=org.eclipse.jetty.alpn.java.server; type=osgi.bundle; version="[9.4.48.v20220622,9.4.48.v20220622]"; resolution:=mandatory [caused by: Unable to resolve org.eclipse.jetty.alpn.java.server/9.4.48.v20220622: missing requirement [org.eclipse.jetty.alpn.java.server/9.4.48.v20220622] osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=9.0))"]] -> [Help 1]

Do you have any idea how we can replace the pax web version in karaf? (We also created a bug in the jira of the karaf project https://issues.apache.org/jira/browse/KARAF-7505 ) Thanks

grgrzybek commented 2 years ago

You seem to have installed pax-web-jetty-http2-jdk9 feature, but at the same time you're getting:

missing requirement [org.eclipse.jetty.alpn.java.server/9.4.48.v20220622] osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=9.0))"]]

which means you're running on at most JDK8.

You have to install (if you http2 support for Jetty in the first place) only pax-web-jetty-http2-jdk8.

pleaseEnterPassword commented 2 years ago

We installed the new karaf version with the inlucded pax-web 8.0.6 version. Sadly we still have the same behaviour. Do you have any ideas how to solve this issue?

thanks and Regards

grgrzybek commented 2 years ago

Which Java version are you using and which features did you install?

pleaseEnterPassword commented 2 years ago

We are using the following java version:

openjdk version "11.0.16.1" 2022-08-12
OpenJDK Runtime Environment (build 11.0.16.1+1)
OpenJDK 64-Bit Server VM (build 11.0.16.1+1, mixed mode)

We have the following features installed and started:

Name                              (0x Version          │ Required │ State       │ Repository                        │ Description
pax-jdbc-spec                     (0x 1.5.3            │          │ Started     │ org.ops4j.pax.jdbc-1.5.3          │ Provides OSGi JDBC Service spec
pax-jdbc                          (0x 1.5.3            │          │ Started     │ org.ops4j.pax.jdbc-1.5.3          │ Provides JDBC Service support
pax-jdbc-config                   (0x 1.5.3            │          │ Started     │ org.ops4j.pax.jdbc-1.5.3          │ Provides JDBC Config support
pax-jdbc-h2                       (0x 1.5.3            │ x        │ Started     │ org.ops4j.pax.jdbc-1.5.3          │ Provides JDBC H2 DataSourceFactory
pax-jdbc-mariadb                  (0x 1.5.3            │ x        │ Started     │ org.ops4j.pax.jdbc-1.5.3          │ Provides JDBC Mariadb DataSourceFactory
pax-jdbc-jtds                     (0x 1.5.3            │ x        │ Started     │ org.ops4j.pax.jdbc-1.5.3          │ Provides JDBC jTDS DataSourceFactory
pax-jdbc-pool-c3p0                (0x 1.5.3            │ x        │ Started     │ org.ops4j.pax.jdbc-1.5.3          │ Provides JDBC Pooling using C3P0
jpa                               (0x 2.7.3            │ x        │ Started     │ aries-jpa-2.7.3                   │ OSGi Persistence Container
transaction-api                   (0x 1.2.0            │          │ Started     │ enterprise-4.4.1                  │
transaction-manager-geronimo      (0x 3.1.3            │          │ Started     │ enterprise-4.4.1                  │ Geronimo Transaction Manager
transaction                       (0x 2.0.0            │ x        │ Started     │ enterprise-4.4.1                  │ OSGi Transaction Manager
hibernate                         (0x 5.6.7.Final      │ x        │ Started     │ enterprise-4.4.1                  │ Hibernate JPA engine support
jndi                              (0x 4.4.1            │ x        │ Started     │ enterprise-4.4.1                  │ OSGi Service Registry JNDI access
jdbc                              (0x 4.4.1            │ x        │ Started     │ enterprise-4.4.1                  │ JDBC service and commands
camunda-commons                   (0x 1.6.1            │          │ Started     │                                   │
camunda-models                    (0x 7.10.0           │          │ Started     │                                   │
camunda-spin                      (0x 1.6.3            │ x        │ Started     │                                   │
camunda-dmn                       (0x 7.10.0           │          │ Started     │                                   │
camunda-core                      (0x 7.10.0           │ x        │ Started     │                                   │
pax-web-specs                     (0x 8.0.6            │ x        │ Started     │ org.ops4j.pax.web-8.0.6           │ Jakarta web APIs and related bundle fragments add
pax-web-core                      (0x 8.0.6            │ x        │ Started     │ org.ops4j.pax.web-8.0.6           │ Core Pax Web bundles
pax-web-websockets                (0x 8.0.6            │ x        │ Started     │ org.ops4j.pax.web-8.0.6           │ Pax Web bundles for Web Sockets (JSR 356) support
pax-web-jetty                     (0x 9.4.48.v20220622 │ x        │ Started     │ org.ops4j.pax.web-8.0.6           │ Jetty 9 bundles
pax-web-jetty-websockets          (0x 9.4.48.v20220622 │ x        │ Started     │ org.ops4j.pax.web-8.0.6           │ Jetty 9 bundles for Web Sockets support
pax-web-jetty-http2               (0x 9.4.48.v20220622 │ x        │ Started     │ org.ops4j.pax.web-8.0.6           │ Jetty 9 bundles for HTTP/2 support
pax-web-http-jetty                (0x 8.0.6            │ x        │ Started     │ org.ops4j.pax.web-8.0.6           │ Http Service implementation using Jetty 9
pax-web-jsp                       (0x 8.0.6            │ x        │ Started     │ org.ops4j.pax.web-8.0.6           │
pax-web-whiteboard                (0x 8.0.6            │ x        │ Started     │ org.ops4j.pax.web-8.0.6           │ Whiteboard Service implementation
pax-web-war                       (0x 8.0.6            │ x        │ Started     │ org.ops4j.pax.web-8.0.6           │ Web Applications implementation
pax-web-karaf                     (0x 8.0.6            │ x        │ Started     │ org.ops4j.pax.web-8.0.6           │ Pax Web Karaf integration
asm                               (0x 9.3.0            │          │ Started     │ specs-4.4.1                       │
spifly                            (0x 1.3.4            │ x        │ Started     │ specs-4.4.1                       │
aries-proxy                       (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Aries Proxy
aries-blueprint                   (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Aries Blueprint
feature                           (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Features Support
shell                             (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Karaf Shell
shell-compat                      (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Karaf Shell Compatibility
deployer                          (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Karaf Deployer
bundle                            (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Provide Bundle support
config                            (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Provide OSGi ConfigAdmin support
diagnostic                        (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Provide Diagnostic support
instance                          (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Provide Instance support
jaas                              (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Provide JAAS support
log                               (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Provide Log support
package                           (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Package commands and mbeans
service                           (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Provide Service support
system                            (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Provide System support
pax-web-http                      (0x 8.0.6            │ x        │ Started     │ standard-4.4.1                    │ Pax Web OSGi HTTP Service
http                              (0x 8.0.6            │          │ Started     │ standard-4.4.1                    │ Transition feature for backward compatibility
pax-web-http-whiteboard           (0x 8.0.6            │ x        │ Started     │ standard-4.4.1                    │ Pax Web OSGi HTTP Whiteboard support
pax-web-http-war                  (0x 4.4.1            │ x        │ Started     │ standard-4.4.1                    │ Turn Karaf as a full WebContainer
war                               (0x 4.4.1            │ x        │ Started     │ standard-4.4.1                    │ Transition feature for backward compatibility
kar                               (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Provide KAR (KARaf archive) support
ssh                               (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Provide a SSHd server on Karaf
management                        (0x 4.4.1            │          │ Started     │ standard-4.4.1                    │ Provide a JMX MBeanServer and a set of MBeans in
jasypt-encryption                 (0x 4.4.1            │ x        │ Started     │ standard-4.4.1                    │ Advanced encryption support for Karaf security
scr                               (0x 4.4.1            │ x        │ Started     │ standard-4.4.1                    │ Declarative Service support
pax-url-wrap                      (0x 2.6.11           │          │ Started     │ standard-4.4.1                    │ Wrap URL handler
wrap                              (0x 2.6.11           │ x        │ Started     │ standard-4.4.1                    │ Transition feature to pax-url-wrap
jolokia                           (0x 1.7.1            │ x        │ Started     │ standard-4.4.1                    │ Jolokia monitoring support
standard                          (0x 4.4.1            │ x        │ Started     │ standard-4.4.1                    │ Wrap feature describing all features part of a st
pax-transx-tm-api                 (0x 0.5.2            │          │ Started     │ pax-transx-0.5.2                  │
pax-transx-tm-geronimo            (0x 0.5.2            │          │ Started     │ pax-transx-0.5.2                  │
cxf-specs                         (0x 3.3.4            │          │ Started     │ cxf-3.3.4                         │
cxf-core                          (0x 3.3.4            │          │ Started     │ cxf-3.3.4                         │
cxf-commands                      (0x 3.3.4            │ x        │ Started     │ cxf-3.3.4                         │
cxf-wsdl                          (0x 3.3.4            │          │ Started     │ cxf-3.3.4                         │
cxf-rt-security                   (0x 3.3.4            │          │ Started     │ cxf-3.3.4                         │
cxf-http                          (0x 3.3.4            │          │ Started     │ cxf-3.3.4                         │
cxf-bindings-soap                 (0x 3.3.4            │          │ Started     │ cxf-3.3.4                         │
cxf-jaxws                         (0x 3.3.4            │ x        │ Started     │ cxf-3.3.4                         │
cxf-jaxrs                         (0x 3.3.4            │ x        │ Started     │ cxf-3.3.4                         │
cxf-jackson                       (0x 3.3.4            │          │ Started     │ cxf-3.3.4                         │
cxf-rs-description-openapi-v3     (0x 3.3.4            │ x        │ Started     │ cxf-3.3.4                         │
cxf-databinding-jaxb              (0x 3.3.4            │          │ Started     │ cxf-3.3.4                         │
grgrzybek commented 2 years ago

Hmm, in the above list I see neither pax-web-jetty-http2-jdk8 nor pax-web-jetty-http2-jdk9... And when using Karaf 4.4.1, you should have proper EE entires in etc/jre.properties and etc/config.properties.

Are you now getting the same:

missing requirement [org.eclipse.jetty.alpn.java.server/9.4.48.v20220622] osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=9.0))"

you've mentioned in July?

pleaseEnterPassword commented 2 years ago

no, i removed the jdk and jdk9 version, but i still have the problem that my wab is deployed on / but not reachable

karaf@root()> web:context-list 
Bundle ID │ Symbolic Name                                 │ Context Path │ Context Name      │ Rank │ Service ID │ Type        │ Scope   │ Registration Properties
──────────┼───────────────────────────────────────────────┼──────────────┼───────────────────┼──────┼────────────┼─────────────┼─────────┼───────────────────────────────────────────────────────────
196       │ org.apache.cxf.cxf-rt-transports-http         │ /            │ default           │ MAX  │ 0          │ HttpService │ static* │ httpContext.id=default
          │                                               │              │                   │      │            │             │         │ httpContext.path=/
          │                                               │              │                   │      │            │             │         │ osgi.http.whiteboard.context.httpservice=default
          │                                               │              │                   │      │            │             │         │ osgi.http.whiteboard.context.path=/
333       │ org.jolokia.osgi                              │ /            │ context:132800408 │ MAX  │ 0          │ HttpService │ static* │ httpContext.id=context:132800408
          │                                               │              │                   │      │            │             │         │ httpContext.path=/
          │                                               │              │                   │      │            │             │         │ osgi.http.whiteboard.context.httpservice=context:132800408
          │                                               │              │                   │      │            │             │         │ osgi.http.whiteboard.context.path=/
400       │ ui                                            │ /            │ /                 │ MAX  │ 0          │ WAB         │ static* │ osgi.http.whiteboard.context.path=/
372       │ org.ops4j.pax.web.pax-web-extender-whiteboard │ /            │ default           │ 0    │ 0          │ Whiteboard  │ static* │ osgi.http.whiteboard.context.name=default
          │                                               │              │                   │      │            │             │         │ osgi.http.whiteboard.context.path=/

When i try to acces the wab deployment on the browser i just get

<h2 style="color: rgb(0, 0, 0); font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">HTTP ERROR 404 Not Found</h2>

URI: | /
-- | --
404
Not Found
-
grgrzybek commented 2 years ago

May I see the WAB?

ihaveaproblemwithcxf commented 1 year ago

Hi @grgrzybek

we are still facing some problems, with the karaf version 4.4.2, pax-web 8.0.11 and cxf 3.5.5. So we made a small example which you can find here:

https://github.com/ihaveaproblemwithcxf/karaf-jsf

If we build our project without cxf ("./build-and-run.sh without-cxf") we are able to access the jsf application (http://localhost:8181) and the whiteboard servlet(http://localhost:8181/extra). But es soon as the cxf features are included ("./build-and-run.sh") we aren't able to access them anymore.

For the build we are still using openjdk 11.

Do you have any ideas how to solve this issue?

thanks and Regards

grgrzybek commented 1 year ago

There were two timing issues related to / context resolved since Pax Web 8.0.11:

Karaf 4.4.3 is under voting just now and should be released this week - it contains Pax Web 8.0.15. So please check this version and if it doesn't help, I'll check https://github.com/ihaveaproblemwithcxf/karaf-jsf ok?

ihaveaproblemwithcxf commented 1 year ago

Hello @grgrzybek We still got the same problem after the update on karaf 4.4.3 in our example project. It seems to be a classloading issue. Could you please check it?

thanks and Regards

grgrzybek commented 1 year ago

Hello @grgrzybek We still got the same problem after the update on karaf 4.4.3 in our example project. It seems to be a classloading issue. Could you please check it?

thanks and Regards

I'd have to get at least some details ;)

You can check #1800 to see what helped me to solve that issue. Let's start with this - please increase logging level for org.ops4j.pax.web to DEBUG or TRACE - we'll get much more details. And please attach the logs after changing logging configuration.

ihaveaproblemwithcxf commented 1 year ago

I attachted our log with org.ops4j.pax.web to DEBUG here all.log. On start the classloader is not able to find our custom filters. But only for cxf and not for the jsf application.

grgrzybek commented 1 year ago

I see exceptions like:

java.lang.ClassNotFoundException: experimental.extra.ExtraFilter
    at org.ops4j.pax.web.service.spi.servlet.OsgiServletContextClassLoader.loadClass(OsgiServletContextClassLoader.java:128)
    at org.eclipse.jetty.util.Loader.loadClass(Loader.java:64)
    at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:89)
    at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
...

where do you keep experimental.extra.ExtraFilter class? Is it part of the WAB?

Ideally I'd like to see your:

and the definition of your demo-feature feature.

ihaveaproblemwithcxf commented 1 year ago

No it's not part of the WAB. Our example project has three bundles https://github.com/ihaveaproblemwithcxf/karaf-jsf/tree/main/demo-application and this filter is coming from the extra-bundle. I packed the whole experimantal folder from the system path:

experimental.zip

grgrzybek commented 1 year ago

Thanks for the project.

I've installed your feature and on fresh Karaf 4.4.3 I had to do some initial steps:

  1. Install required features:
    
    feature:install pax-web-http-jetty
    feature:install pax-web-whiteboard
    feature:install pax-web-war
    feature:install pax-web-karaf
    feature:install pax-web-jsp
    feature:install pax-web-specs
    feature:install pax-web-jetty-websockets
    feature:install scr
    feature:install spifly
    feature:install aries-blueprint

feature:repo-add mvn:org.apache.cxf.karaf/apache-cxf/3.5.5/xml/features feature:install cxf-jaxrs


2. Install some additional bundles to satisfy old MyFaces (uses CDI API 1.x):

install mvn:org.ops4j.pax.web/pax-web-compatibility-cdi12/8.0.15 install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/1_3 install -s mvn:jakarta.interceptor/jakarta.interceptor-api/1.2.5 install -s mvn:jakarta.enterprise/jakarta.enterprise.cdi-api/2.0.2


3. Install your feature:

feature:repo-add mvn:experimental/demo-feature/1.0.0-SNAPSHOT/xml/features feature:install -v demo-feature


Here's a full list of bundles:

karaf@root()> la -l START LEVEL 100 , List Threshold: 0 ID │ State │ Lvl │ Version │ Location ────┼──────────┼─────┼───────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 0 │ Active │ 0 │ 7.0.5 │ System Bundle 1 │ Resolved │ 1 │ 4.4.3 │ mvn:org.apache.karaf.features/org.apache.karaf.features.extension/4.4.3 2 │ Active │ 5 │ 2.6.12 │ mvn:org.ops4j.pax.url/pax-url-aether/2.6.12 3 │ Active │ 5 │ 1.2.4 │ mvn:org.apache.felix/org.apache.felix.metatype/1.2.4 4 │ Active │ 5 │ 4.4.3 │ mvn:org.apache.karaf.services/org.apache.karaf.services.eventadmin/4.4.3 5 │ Active │ 8 │ 2.2.0 │ mvn:org.ops4j.pax.logging/pax-logging-api/2.2.0 6 │ Active │ 8 │ 2.4.0 │ mvn:org.fusesource.jansi/jansi/2.4.0 7 │ Active │ 8 │ 2.2.0 │ mvn:org.ops4j.pax.logging/pax-logging-log4j2/2.2.0 8 │ Active │ 9 │ 1.2.0.202109301733 │ mvn:org.osgi/org.osgi.util.function/1.2.0 9 │ Active │ 9 │ 1.2.0.202109301733 │ mvn:org.osgi/org.osgi.util.promise/1.2.0 10 │ Active │ 9 │ 1.0.2 │ mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2 11 │ Active │ 9 │ 1.0.14 │ mvn:org.apache.felix/org.apache.felix.converter/1.0.14 12 │ Active │ 10 │ 1.9.26 │ mvn:org.apache.felix/org.apache.felix.configadmin/1.9.26 13 │ Active │ 11 │ 4.4.3 │ mvn:org.apache.karaf.config/org.apache.karaf.config.core/4.4.3 14 │ Active │ 11 │ 1.0.16 │ mvn:org.apache.felix/org.apache.felix.configurator/1.0.16 15 │ Active │ 11 │ 1.2.6 │ mvn:org.apache.felix/org.apache.felix.configadmin.plugin.interpolation/1.2.6 16 │ Active │ 11 │ 1.2.14 │ mvn:org.apache.sling/org.apache.sling.commons.johnzon/1.2.14 17 │ Active │ 11 │ 1.0.6 │ mvn:org.apache.felix/org.apache.felix.cm.json/1.0.6 18 │ Active │ 12 │ 3.7.4 │ mvn:org.apache.felix/org.apache.felix.fileinstall/3.7.4 19 │ Active │ 15 │ 4.4.3 │ mvn:org.apache.karaf.features/org.apache.karaf.features.core/4.4.3 20 │ Active │ 30 │ 1.70 │ mvn:org.bouncycastle/bcpkix-jdk15on/1.70 21 │ Active │ 30 │ 1.70 │ mvn:org.bouncycastle/bcprov-jdk15on/1.70 22 │ Active │ 30 │ 1.70 │ mvn:org.bouncycastle/bcutil-jdk15on/1.70 23 │ Active │ 30 │ 1.1.5 │ mvn:org.apache.aries.jmx/org.apache.aries.jmx.api/1.1.5 24 │ Active │ 30 │ 1.1.8 │ mvn:org.apache.aries.jmx/org.apache.aries.jmx.core/1.1.8 25 │ Active │ 30 │ 1.2.0 │ mvn:org.apache.aries.jmx/org.apache.aries.jmx.whiteboard/1.2.0 26 │ Active │ 20 │ 1.1.3 │ mvn:org.apache.aries/org.apache.aries.util/1.1.3 27 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.bundle/org.apache.karaf.bundle.core/4.4.3 28 │ Active │ 26 │ 4.4.3 │ mvn:org.apache.karaf.deployer/org.apache.karaf.deployer.features/4.4.3 29 │ Active │ 24 │ 4.4.3 │ mvn:org.apache.karaf.deployer/org.apache.karaf.deployer.kar/4.4.3 30 │ Active │ 24 │ 4.4.3 │ mvn:org.apache.karaf.deployer/org.apache.karaf.deployer.wrap/4.4.3 31 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.diagnostic/org.apache.karaf.diagnostic.core/4.4.3 32 │ Active │ 80 │ 4.4.3 │ mvn:org.apache.karaf/org.apache.karaf.event/4.4.3 33 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.features/org.apache.karaf.features.command/4.4.3 34 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.instance/org.apache.karaf.instance.core/4.4.3 35 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.jaas/org.apache.karaf.jaas.command/4.4.3 36 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.jaas/org.apache.karaf.jaas.config/4.4.3 37 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.jaas/org.apache.karaf.jaas.modules/4.4.3 38 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.kar/org.apache.karaf.kar.core/4.4.3 39 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.log/org.apache.karaf.log.core/4.4.3 40 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.management/org.apache.karaf.management.server/4.4.3 41 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.package/org.apache.karaf.package.core/4.4.3 42 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.service/org.apache.karaf.service.core/4.4.3 43 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.shell/org.apache.karaf.shell.commands/4.4.3 44 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.shell/org.apache.karaf.shell.core/4.4.3 45 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.shell/org.apache.karaf.shell.ssh/4.4.3 46 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.system/org.apache.karaf.system.core/4.4.3 47 │ Active │ 30 │ 2.9.2 │ mvn:org.apache.sshd/sshd-osgi/2.9.2 48 │ Active │ 30 │ 2.9.2 │ mvn:org.apache.sshd/sshd-scp/2.9.2 49 │ Active │ 30 │ 2.9.2 │ mvn:org.apache.sshd/sshd-sftp/2.9.2 50 │ Active │ 30 │ 3.21.0 │ mvn:org.jline/jline/3.21.0 51 │ Active │ 10 │ 2.6.12 │ mvn:org.ops4j.pax.url/pax-url-wrap/2.6.12/jar/uber 52 │ Active │ 30 │ 4.0.0 │ mvn:jakarta.servlet/jakarta.servlet-api/4.0.4 53 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty/jetty-client/9.4.50.v20221201 54 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty/jetty-continuation/9.4.50.v20221201 55 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty/jetty-http/9.4.50.v20221201 56 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty/jetty-io/9.4.50.v20221201 57 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty/jetty-jaas/9.4.50.v20221201 58 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty/jetty-jmx/9.4.50.v20221201 59 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty/jetty-security/9.4.50.v20221201 60 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty/jetty-server/9.4.50.v20221201 61 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty/jetty-servlet/9.4.50.v20221201 62 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty/jetty-servlets/9.4.50.v20221201 63 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty/jetty-util/9.4.50.v20221201 64 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty/jetty-util-ajax/9.4.50.v20221201 65 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty/jetty-xml/9.4.50.v20221201 66 │ Active │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-api/8.0.15 67 │ Resolved │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-compatibility-servlet31/8.0.15 68 │ Active │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-jetty/8.0.15 69 │ Active │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-runtime/8.0.15 70 │ Active │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-spi/8.0.15 71 │ Active │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-tomcat-common/8.0.15 72 │ Active │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-extender-whiteboard/8.0.15 73 │ Active │ 30 │ 1.3.5 │ mvn:jakarta.annotation/jakarta.annotation-api/1.3.5 74 │ Active │ 30 │ 2.6.12 │ mvn:org.ops4j.pax.url/pax-url-war/2.6.12/jar/uber 75 │ Active │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-extender-war/8.0.15 76 │ Active │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-deployer/8.0.15 77 │ Active │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-karaf/8.0.15 78 │ Active │ 80 │ 3.0.3 │ mvn:jakarta.el/jakarta.el-api/3.0.3 79 │ Active │ 30 │ 3.26.0.v20210609-0549 │ mvn:org.eclipse.jdt/ecj/3.26.0 80 │ Resolved │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-compatibility-el2/8.0.15 81 │ Active │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-jsp/8.0.15 82 │ Resolved │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-compatibility-annotation13/8.0.15 83 │ Active │ 80 │ 2.0.2 │ mvn:jakarta.enterprise/jakarta.enterprise.cdi-api/2.0.2 84 │ Active │ 80 │ 1.0.0.3 │ mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/1_3 85 │ Active │ 80 │ 1.2.5 │ mvn:jakarta.interceptor/jakarta.interceptor-api/1.2.5 86 │ Resolved │ 80 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-compatibility-cdi12/8.0.15 87 │ Active │ 30 │ 1.1.2 │ mvn:jakarta.websocket/jakarta.websocket-api/1.1.2 88 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty.websocket/websocket-api/9.4.50.v20221201 89 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty.websocket/websocket-client/9.4.50.v20221201 90 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty.websocket/websocket-common/9.4.50.v20221201 91 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty.websocket/javax-websocket-client-impl/9.4.50.v20221201 92 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty.websocket/javax-websocket-server-impl/9.4.50.v20221201 93 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty.websocket/websocket-server/9.4.50.v20221201 94 │ Active │ 30 │ 9.4.50.v20221201 │ mvn:org.eclipse.jetty.websocket/websocket-servlet/9.4.50.v20221201 95 │ Active │ 30 │ 8.0.15 │ mvn:org.ops4j.pax.web/pax-web-websocket/8.0.15 96 │ Active │ 30 │ 2.2.4 │ mvn:org.apache.felix/org.apache.felix.scr/2.2.4 97 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.scr/org.apache.karaf.scr.management/4.4.3 98 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.scr/org.apache.karaf.scr.state/4.4.3 99 │ Active │ 30 │ 1.5.0.202109301733 │ mvn:org.osgi/org.osgi.service.component/1.5.0 100 │ Active │ 80 │ 1.3.5 │ mvn:org.apache.aries.spifly/org.apache.aries.spifly.dynamic.bundle/1.3.5 101 │ Active │ 20 │ 9.4.0 │ mvn:org.ow2.asm/asm/9.4 102 │ Active │ 20 │ 9.4.0 │ mvn:org.ow2.asm/asm-commons/9.4 103 │ Active │ 20 │ 9.4.0 │ mvn:org.ow2.asm/asm-tree/9.4 104 │ Active │ 20 │ 9.4.0 │ mvn:org.ow2.asm/asm-analysis/9.4 105 │ Active │ 20 │ 9.4.0 │ mvn:org.ow2.asm/asm-util/9.4 106 │ Active │ 20 │ 1.0.1 │ mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.api/1.0.1 107 │ Active │ 20 │ 1.3.2 │ mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.cm/1.3.2 108 │ Active │ 20 │ 1.10.3 │ mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.core/1.10.3 109 │ Resolved │ 20 │ 1.0.0 │ mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.core.compatibility/1.0.0 110 │ Active │ 30 │ 1.2.0 │ mvn:org.apache.aries.jmx/org.apache.aries.jmx.blueprint.api/1.2.0 111 │ Active │ 30 │ 1.2.0 │ mvn:org.apache.aries.jmx/org.apache.aries.jmx.blueprint.core/1.2.0 112 │ Active │ 20 │ 1.1.13 │ mvn:org.apache.aries.proxy/org.apache.aries.proxy/1.1.13 113 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.bundle/org.apache.karaf.bundle.blueprintstate/4.4.3 114 │ Active │ 24 │ 4.4.3 │ mvn:org.apache.karaf.deployer/org.apache.karaf.deployer.blueprint/4.4.3 115 │ Active │ 80 │ 1.0.0.SNAPSHOT │ mvn:experimental/extra-bundle/1.0.0-SNAPSHOT 116 │ Active │ 80 │ 2.0.0 │ mvn:jakarta.annotation/jakarta.annotation-api/2.0.0 117 │ Active │ 80 │ 3.2.2 │ mvn:commons-collections/commons-collections/3.2.2 118 │ Active │ 80 │ 1.9.4 │ mvn:commons-beanutils/commons-beanutils/1.9.4 119 │ Active │ 80 │ 1.4.0 │ mvn:commons-fileupload/commons-fileupload/1.4 120 │ Active │ 80 │ 1.8.1 │ mvn:commons-digester/commons-digester/1.8.1 121 │ Active │ 80 │ 2.2.0 │ mvn:commons-io/commons-io/2.2 122 │ Active │ 80 │ 2.3.10 │ mvn:org.apache.myfaces.core/myfaces-api/2.3.10 123 │ Active │ 80 │ 2.3.10 │ mvn:org.apache.myfaces.core/myfaces-impl/2.3.10 124 │ Active │ 80 │ 2.9.1 │ mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxrs-api-2.1/2.9.1 125 │ Active │ 80 │ 10.0.0 │ mvn:org.primefaces/primefaces/10.0.0 126 │ Active │ 80 │ 1.0.0.SNAPSHOT │ mvn:experimental/wab-bundle/1.0.0-SNAPSHOT 127 │ Active │ 80 │ 1.0.0.SNAPSHOT │ mvn:experimental/webservice-bundle/1.0.0-SNAPSHOT 128 │ Active │ 80 │ 0 │ wrap:mvn:commons-logging/commons-logging/1.1.1 129 │ Active │ 35 │ 2.14.1 │ mvn:com.fasterxml.jackson.core/jackson-annotations/2.14.1 130 │ Active │ 35 │ 2.14.1 │ mvn:com.fasterxml.jackson.core/jackson-core/2.14.1 131 │ Active │ 35 │ 2.14.1 │ mvn:com.fasterxml.jackson.core/jackson-databind/2.14.1 132 │ Active │ 35 │ 2.14.1 │ mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.14.1 133 │ Active │ 35 │ 2.14.1 │ mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/2.14.1 134 │ Active │ 35 │ 2.14.1 │ mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.14.1 135 │ Active │ 20 │ 6.4.0 │ mvn:com.fasterxml.woodstox/woodstox-core/6.4.0 136 │ Active │ 10 │ 1.2.2 │ mvn:com.sun.activation/jakarta.activation/1.2.2 137 │ Active │ 20 │ 3.0.7 │ mvn:com.sun.istack/istack-commons-runtime/3.0.7 138 │ Active │ 40 │ 3.5.5 │ mvn:org.apache.cxf/cxf-core/3.5.5 139 │ Active │ 40 │ 3.5.5 │ mvn:org.apache.cxf/cxf-rt-frontend-jaxrs/3.5.5 140 │ Active │ 40 │ 3.5.5 │ mvn:org.apache.cxf/cxf-rt-management/3.5.5 141 │ Active │ 40 │ 3.5.5 │ mvn:org.apache.cxf/cxf-rt-rs-client/3.5.5 142 │ Active │ 40 │ 3.5.5 │ mvn:org.apache.cxf/cxf-rt-rs-extension-providers/3.5.5 143 │ Active │ 40 │ 3.5.5 │ mvn:org.apache.cxf/cxf-rt-rs-extension-search/3.5.5 144 │ Active │ 40 │ 3.5.5 │ mvn:org.apache.cxf/cxf-rt-rs-json-basic/3.5.5 145 │ Active │ 40 │ 3.5.5 │ mvn:org.apache.cxf/cxf-rt-rs-service-description/3.5.5 146 │ Active │ 40 │ 3.5.5 │ mvn:org.apache.cxf/cxf-rt-security/3.5.5 147 │ Active │ 40 │ 3.5.5 │ mvn:org.apache.cxf/cxf-rt-transports-http/3.5.5 148 │ Active │ 40 │ 3.5.5 │ mvn:org.apache.cxf.karaf/cxf-karaf-commands/3.5.5 149 │ Active │ 9 │ 1.1 │ mvn:org.apache.geronimo.specs/geronimo-osgi-registry/1.1 150 │ Active │ 30 │ 4.4.3 │ mvn:org.apache.karaf.http/org.apache.karaf.http.core/4.4.3 151 │ Active │ 30 │ 1.2.18.1 │ mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.fastinfoset/1.2.18_1 152 │ Active │ 20 │ 2.3.2.1 │ mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-runtime/2.3.2_1 153 │ Active │ 20 │ 2.3.2.1 │ mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc/2.3.2_1 154 │ Active │ 25 │ 1.2.0.5 │ mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/1.2_5 155 │ Active │ 10 │ 2.3.0.2 │ mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxws-api-2.3/2.3_2 156 │ Active │ 10 │ 1.4.0.1 │ mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.saaj-api-1.4/1.4_1 157 │ Active │ 30 │ 2.3.0 │ mvn:org.apache.ws.xmlschema/xmlschema-core/2.3.0 158 │ Active │ 30 │ 1.5.3 │ mvn:org.codehaus.jettison/jettison/1.5.3 159 │ Active │ 35 │ 1.33.0 │ mvn:org.yaml/snakeyaml/1.33 160 │ Active │ 20 │ 4.2.1 │ mvn:org.codehaus.woodstox/stax2-api/4.2.1


Then I could see everything:

karaf@root()> web:wab-list Context Path │ Bundle ID │ Symbolic Name │ State │ Base URL ─────────────┼───────────┼───────────────┼──────────┼─────────────────────── / │ 126 │ wab-bundle │ Deployed │ http://127.0.0.1:8181/

karaf@root()> web:context-list Bundle ID │ Symbolic Name │ Context Path │ Context Name │ Rank │ Service ID │ Type │ Scope │ Registration Properties ──────────┼───────────────────────────────────────────────┼──────────────┼──────────────┼──────┼────────────┼─────────────┼─────────┼───────────────────────────────────────────────── 126 │ wab-bundle │ / │ / │ MAX │ 0 │ WAB │ static │ osgi.http.whiteboard.context.path=/ 147 │ org.apache.cxf.cxf-rt-transports-http │ / │ default │ MAX │ 0 │ HttpService │ static │ httpContext.id=default │ │ │ │ │ │ │ │ httpContext.path=/ │ │ │ │ │ │ │ │ osgi.http.whiteboard.context.httpservice=default │ │ │ │ │ │ │ │ osgi.http.whiteboard.context.path=/ 72 │ org.ops4j.pax.web.pax-web-extender-whiteboard │ / │ default │ 0 │ 0 │ Whiteboard │ static* │ osgi.http.whiteboard.context.name=default │ │ │ │ │ │ │ │ osgi.http.whiteboard.context.path=/

*) This context is using ServletContextHelper/HttpContext without resolving an org.osgi.framework.ServiceReference.

karaf@root()> web:servlet-list Bundle ID │ Name │ Class │ Context Path(s) │ URLs │ Type │ Context Filter ──────────┼────────────────────────────┼───────────────────────────────────────────────────────────────────┼─────────────────┼───────────────┼─────────────┼──────────────────────────────────────────── 115 │ javax.servlet.Servlet │ experimental.extra.DemoServlet │ / │ /extra/ │ Whiteboard │ (osgi.http.whiteboard.context.name=default) 126 │ FacesServlet │ javax.faces.webapp.FacesServlet │ / │ .xhtml │ WAB │ - 126 │ default │ org.ops4j.pax.web.service.jetty.internal.web.JettyResourceServlet │ / │ / │ WAB │ - 126 │ jsp │ org.ops4j.pax.web.jsp.JspServlet │ / │ .jspx, .jsp │ WAB │ - 147 │ cxf-osgi-transport-servlet │ org.apache.cxf.transport.servlet.CXFNonSpringServlet │ / │ /cxf/* │ HttpService │ -

karaf@root()> web:wab-info /

WAB Demo Bundle (126)

Context Path: / Deployment State: Deployed WAB ClassPath:

And in the logs, when accessing http://127.0.0.1:8181/ page I had:

...
2023-01-16T14:15:00,053 | INFO  | qtp498712968-706 | WabFilter                        | 126 - wab-bundle - 1.0.0.SNAPSHOT | WAB-Filter. Filtering request org.ops4j.pax.web.service.spi.servlet.OsgiHttpServletRequestWrapper@35cb7d6f
2023-01-16T14:15:00,054 | INFO  | qtp498712968-706 | ExtraFilter                      | 115 - extra-bundle - 1.0.0.SNAPSHOT | EXTRA-Filter. Filtering request org.ops4j.pax.web.service.spi.servlet.OsgiHttpServletRequestWrapper@35cb7d6f
2023-01-16T14:15:00,889 | INFO  | qtp498712968-516 | WabFilter                        | 126 - wab-bundle - 1.0.0.SNAPSHOT | WAB-Filter. Filtering request org.ops4j.pax.web.service.spi.servlet.OsgiHttpServletRequestWrapper@24ef277a
2023-01-16T14:15:00,889 | INFO  | qtp498712968-516 | ExtraFilter                      | 115 - extra-bundle - 1.0.0.SNAPSHOT | EXTRA-Filter. Filtering request org.ops4j.pax.web.service.spi.servlet.OsgiHttpServletRequestWrapper@24ef277a
...

Only after installing (after the above) pax-web-jetty-http2 feature I saw this in the logs:

2023-01-16T14:19:24,043 | WARN  | paxweb-config-3-thread-1 (deploy /) | BaseHolder                       | 63 - org.eclipse.jetty.util - 9.4.50.v20221201 | 
java.lang.ClassNotFoundException: experimental.extra.ExtraFilter
    at org.ops4j.pax.web.service.spi.servlet.OsgiServletContextClassLoader.loadClass(OsgiServletContextClassLoader.java:128) ~[!/:?]
    at org.eclipse.jetty.util.Loader.loadClass(Loader.java:64) ~[!/:9.4.50.v20221201]
    at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:89) ~[!/:9.4.50.v20221201]
    at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) ~[!/:9.4.50.v20221201]
    at org.ops4j.pax.web.service.jetty.internal.PaxWebFilterHolder.doStart(PaxWebFilterHolder.java:130) ~[!/:?]
...

I'm checking what may be the problem...

grgrzybek commented 1 year ago

I think I know what's the problem... there are two different classloaders used for / context - one related to CXF and one to your wab-bundle and these two CLs have different set of reachable bundles. However only one is used - and it depends on the order of starting CXF and your bundle.

I'm working on a fix.

grgrzybek commented 1 year ago

There are few issues I found:

The difference between your application and mvn:org.ops4j.pax.web.samples/war-jsf23-embedded/8.0.15/war is that while in both cases org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver contain the same amount of delegated resolvers, there's one difference:

For Primefaces, javax.faces.context.ExternalContext#getRequestMap() returns:

result = {org.apache.myfaces.context.servlet.RequestMap@13576}  size = 8
 {@13560} "oam.Flash.EXECUTEMAP.TOKEN" -> {@13592} "m61epcrh1"
 {@13562} "javax.servlet.forward.context_path" -> {@13593} ""
 {@13594} "org.eclipse.jetty.multipartConfig" -> {javax.servlet.MultipartConfigElement@13595} 
 {@13564} "oam.Flash.EXECUTEMAP" -> {org.apache.myfaces.shared.util.SubKeyMap@13596}  size = 0
 {@13566} "javax.servlet.forward.servlet_path" -> {@13597} "/"
 {@13568} "org.eclipse.jetty.server.welcome" -> {@13598} "/index.xhtml"
 {@13570} "oam.Flash.RENDERMAP.TOKEN" -> {@13599} "m61epcrh2"
 {@13572} "javax.servlet.forward.request_uri" -> {@13600} "/"

For MyFaces, javax.faces.context.ExternalContext#getRequestMap() returns:

result = {org.apache.myfaces.context.servlet.RequestMap@13540}  size = 8
 {@13560} "oam.Flash.EXECUTEMAP.TOKEN" -> {@13561} "-aebq57f39"
 {@13562} "javax.servlet.forward.context_path" -> {@13563} "/war-jsf23-embedded"
 {@13564} "oam.Flash.EXECUTEMAP" -> {org.apache.myfaces.shared.util.SubKeyMap@13565}  size = 0
 {@13566} "javax.servlet.forward.servlet_path" -> {@13567} "/"
 {@13568} "org.eclipse.jetty.server.welcome" -> {@13569} "/start.xhtml"
 {@13570} "oam.Flash.RENDERMAP.TOKEN" -> {@13571} "-aebq57f38"
 {@13572} "javax.servlet.forward.request_uri" -> {@13573} "/war-jsf23-embedded/"
 {@13574} "hello" -> {org.ops4j.pax.web.samples.warjsf23.Hello@13575} 

And hello bean is present.

grgrzybek commented 1 year ago

Your managed bean called wabBean (and entire expression #{wabBean.text}) is not resolved because of the way OSGi and JSF cooperate. Which means they not cooperate at all.

In case of Pax Web sample it works, because the managed bean (a class annotated with @javax.faces.bean.ManagedBean) is found because it's present in WAB's /WEB-INF/classes.

The methods used are:

The ServletContext implementation is fine (it comes from Pax Web), but it can only find what's in the WAB:

result = {java.util.LinkedHashSet@12030}  size = 3
 0 = {@12032} "/WEB-INF/faces-config.xml"
 1 = {@12033} "/WEB-INF/pretty-config.xml"
 2 = {@12034} "/WEB-INF/web.xml"

The only suggestion for you I have is to replace (somehow, because I don't know much about JSF) the service returned from org.apache.myfaces.spi.AnnotationProviderFactory#getAnnotationProviderFactory() which probably requires /META-INF/services/org.apache.myfaces.spi.AnnotationProvider service configuration.

grgrzybek commented 1 year ago

Please check https://github.com/ops4j/org.ops4j.pax.web/blob/web-8.0.15/samples/samples-jsf/war-jsf23-embedded/pom.xml

This is proper WAB, but your wab-bundle has <packaging>bundle</packaging> while the Pax Web sample has <packaging>war</packaging> and a bit more maven-bundle-plugin configuration:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
        <supportedProjectTypes>
            <supportedProjectType>jar</supportedProjectType>
            <supportedProjectType>war</supportedProjectType>
            <supportedProjectType>bundle</supportedProjectType>
        </supportedProjectTypes>
...
            <_wab>${project.build.directory}/${project.build.finalName}</_wab>
            <Web-ContextPath>/xxx</Web-ContextPath>
...
            <Embed-Directory>WEB-INF/lib</Embed-Directory>
...

You'll find more explanation here: https://github.com/ops4j/org.ops4j.pax.web/blob/web-8.0.15/samples/samples-war/war-simplest-osgi/pom.xml

In short words - if you use <_wab> configuration, you'll get very important feature for free - proper configuration of Bundle-ClassPath header which will contains:

This way you'll get a WAB that's compatible with plain WAR. And your JSF bundle will have correct managed bean configuration (detection).

grgrzybek commented 1 year ago

With b6cf8baa12abcd0c443c6d8430c0964e6cefe3e9 I've ensured that WAB's context (and its classloader) always comes first, so whether or not Whiteboard/HttpService based elements are added to the context (here: /), WAB reachable bundles will be used for classloading.

Whiteboard and HtttpService elements are added not as class names, but as actual instances, so classloading is (mostly) done. Definitely no parsing of declarative descriptors is performed.