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

HandlesTypes is still being ignored #1617

Closed enver-haase closed 3 years ago

enver-haase commented 3 years ago

Test case: https://github.com/vaadin/flow/issues/11178

Basically, Vaadin 10+ relies on the container handling "@HandlesTypes" correctly, and while it is documented in Pax-Web 5.x that this will not work, I could not find a mention of this any more in the 7.x series.

grgrzybek commented 3 years ago

Hi, only Pax Web 8 (still work in progress) handles this annotation correctly... I can't tell when it will be released.

enver-haase commented 3 years ago

Thanks a lot! I reckon it is that the If an implementation of ServletContainerInitializer specifies this annotation, the Servlet container must pass the Set of application classes that extend, implement, or have been annotated with the class types listed by this annotation to the ServletContainerInitializer.onStartup(java.util.Set>, javax.servlet.ServletContext) method of the ServletContainerInitializer (if no matching classes are found, null must be passed instead) is incorrectly handled so far, instead the set of class types classes listed by the annotation is passed.

grgrzybek commented 3 years ago

Correct - and that's what Pax Web 8 solved by introducing better scanning.

I've even found related Tomcat problem: https://bz.apache.org/bugzilla/show_bug.cgi?id=65244

enver-haase commented 3 years ago

Regarding the link to the related Tomcat problem: I don't think it hurts passing interfaces (can have code after all) when they are found, I would simply go with copying the semantics of Jetty9/Tomcat8 code which actually does work to bring up Vaadin10/14/20 applications. But my opinion does not matter that much, maybe ask Rajiv Mordani.

Is there any way I could plug some preview Pax Web 8 or just that fixed @HandlesTypes scan into my Karaf 4.3.2 ? I am actually blocked until I find a work-around.

grgrzybek commented 3 years ago

Unfortunately Pax Web 8 is still work-in-progress. I'm now working on ordering listeners coming from multiple sources and it's not possible you take the part that's related to @HandlesTypes ;( This is only part of pax-web-extender-war (implementation of chapter 128 of OSGi CMPN specification) and doesn't have anything in common with Whiteboard/HttpService...

grgrzybek commented 3 years ago

And yes - in order to scan available jars (and reachable bundles) I reuse tomcat's BCEL-based scanning

enver-haase commented 3 years ago

BCEL... unbelievable it's still in use. I was in Markus' office when he was thinking about donating it to Apache back in 2001!

grgrzybek commented 3 years ago

:) it's just packaged within Tomcat. When Jasper is being reused, why not BCEL?

enver-haase commented 3 years ago

True that. I just thought it may have become 'old', replaced by asm or such. I certainly didn't touch my part in BCEL for 20 or so years (the verifier), yet there has been lots of development in that area (preverification, new class file versions). Never mind -- in case you have a good idea of how I could get a Vaadin 20 application to fly in Pax-Web, please let me know. I am currently taking notes of what classes are found in Tomcat in a standard Vaadin 20 Hello World App, in order to hard-code a ServletContainerInitializer from which I will be calling the real SCIs with correct sets of classes.

grgrzybek commented 3 years ago

@enver-haase if you point me to a maven project/module of Vaadin with war packaging, I could work on Pax Web integration tests for it :) Now I'm working on AriesCDI + MyFaces 2.3.x test + WAB case and it's almost done (but definitely the hardest one I had to deal with)

enver-haase commented 3 years ago

https://github.com/enver-haase/Playground/tree/master/vaadin20-base

This one perhaps? compile with mvn clean -Pproduction package and find the *.war in target/ .

Note that the web.xml is only here to convince Pax Web to actually kick off, not needed for Jetty9 or Tomcat8.

grgrzybek commented 3 years ago

Thanks! I can't promise though I'll do it today. But I'm definitely not closing this tab in Firefox, so I remember ;)

grgrzybek commented 3 years ago

As mentioned in https://stackoverflow.com/questions/67867281/how-to-run-a-vaadin-8-or-20-application-on-karaf-4-3-2-with-pax-web, Pax Web 8 handles the annotation correctly. There are other things to solve, but this Vaadin example is great to be included in Pax Web 8 test suite. For now, I'm closing this issue as fixed in Pax Web 8.0.0...