Migrate to Jakarta EE 10 / Jetty 12 / Jersey 3.x / Karaf 4.5#5479
Migrate to Jakarta EE 10 / Jetty 12 / Jersey 3.x / Karaf 4.5#5479holgerfriedrich wants to merge 10 commits into
Conversation
|
This is a first try to move to the (not yet released) Karaf 4.5.0 based on Jetty 12 and Jakarta 🎉 I don't know if all the package migrations I had to complete in this PR are the best choice, but I got all the tests and itests green 🥳 I did not manage yet to get a running system and I am not sure what is missing to get there. If you want to reproduce, you need two build two dependencies:
|
|
Far from working, but the runtime now starts, see this nice excerpt from bundle list: |
|
Is there any schedule wrt Karaf 4.5 release? |
|
@florian-h05 I would expect it within a month from now. All major libraries have been upgrades, jetty an pax upgrades are completed. Removal of SecurityManager is in work. Last piece is then the remaining incompatibilities with Java 25. Just my personal opinion, though. |
|
@holgerfriedrich many thanks for your work on this both here and in the Apache Karaf repo. I am expecting the Jetty v9.5.x to v12.0.x upgrade will impact the Hue binding Clip2Bridge.java since it uses quite low level Jetty HTTP/2 code. Therefore I am quite keen to test it asap with the earliest builds of this PR. |
|
As this is a major upgrade with potential impacts on (many) bindings, is it something we should keep for OH 6? |
Please not. The upgrade is already way overdue so we should try to do it asap. The impacted bindings will be those that don't build due to the name space change from javax to jakarta. So testing can focus on those. Perhaps consider a parallel snapshot so testers have more time. |
So probably ~ 85 bindings as follows:. |
|
Also those relying on JAX-RS Whiteboard. And maybe all bindings relying on Jetty (a majority of our bindings). This change, even if of course expected, could lead to lot of work and lot of bugs to be fixed. |
Do you mean those that
AFAICT the Jetty name space does not change so the existing pom dependencies should pull in the new versions.
This is true, but a large proportion of them depend on either a) the OH core common client or b) custom clients created by the OH core client builder. i.e. the OH Core isolates the bindings from much nitty gritty.
Me neither. That is actually why I argue to do it sooner rather than later, in order to get a head start. PS I just wrote a little program to automate the namespace changes. It currently touches 300+ binding class files. We could easily extend this program to make any other systematic changes as may be necessary.. |
|
We will see when 4.5 is ready to go; target date is July. It will support Java 21 and 25. Due to the jetty upgrade, the first release with 4.5 should IMHO be named OH 6.0. Let's give it some time. I will rebase once we have upgraded core to 4.4.11. |
d7146b0 to
c65eda8
Compare
|
Good news, everyone! 😎 I have got a running core distribution on Jetty 12. Whiteboards are working now, so REST and static content is served. I went through the setup wizard (without installing any add-ons, still have none ported) and end up on the main page. It is quite a hack: I needed a patch for pax web for the whiteboard registration, patch jupnp, etc.... Download from Next steps:
|
efbc62d to
92b7cc1
Compare
I think we need to discuss the targeted release, what it includes, what not and how it cen be seen from different perspectives (technical, user developer etc). Is there some issue you can point to for the discussion or should i open a new one. |
@lsiepel I will open a new one soon - my focus is to get a working prototype of the full distro first. |
|
I will comment on the progress here... faster than actually expected, here is the first prototype of a full distribution based on Jetty 12 / Jakarta / Karaf 4.5 SNAPSHOT!!! I could complete the setup wizard and install all default bindings! 🥳
https://github.com/holgerfriedrich/openhab-builds/actions/runs/26593081741
|
921c55f to
9f4e862
Compare
|
Latest (non-expired) build: |
d1e4881 to
1d28e74
Compare
|
@andrewfg I do reply to your comment from the discussion thread in this PR.
I just tested the latest build, rebased today, number 36: It works perfectly fine; I just went through the setup wizard and installed bindings. Firefox on Windows, but Chrome and Edge seem to work as well. When switching to a new instance, I sometimes have to clear the cache or enable the dev console to prevent caching. Maybe you could give it another try? Thanks! |
Just for the avoidance of doubt I am downloading the ZIP at the bottom of this page and expanding it to a folder on my Windows PC. I run the Maybe a certificate issue? PS I tried and failed on both Chrome and Edge on the same PC and also on my mobile phone. And cleaning the cache does not help. EDIT: here is the log file (with crash dump) on startup.. Details |
|
@andrewfg Thanks for testing. Yes, expand the zip. Download the kar file and move it into the addons folder (in case you want more than just core). It seems that you discovered two new bugs ;-)
|
Wow! Astonishingly it does indeed work! Fantastic job @holgerfriedrich !
There is however a lot of chatter in the logs openhab.zip relating to Jupnp, Jetty, Jersey etc. .. In particular I have the feeling that the HK2 log is somehow related to the Hue binding, even if the stack trace does not indicate it directly.. |
|
@andrewfg Thanks again for testing and providing the logs. I could already silence a few warnings and I have created a PR for jupnp. |
|
@holgerfriedrich I am more than happy to look deeper into "my" addons code in my IDE to see if there are any warnings etc. .. which means I must set the local reference of OH Core on my development PC to be your fork+branch of OH Core 6 rather than my fork+branch of OH Core 5 (main). I am not a great expert on Git commands and I don't want to munge my development environment, so I wonder if you have any tips on how I could do this? |
Servlet / HTTP: - Migrate all servlet imports to jakarta.servlet.* - Upgrade Jetty 9.4.x → 12.0.23 (ee10 modules) - Upgrade Pax Web 8.0.x → 11.0.1 - Replace org.apache.felix.http.servlet-api with jakarta.servlet-api 6.1.0 JAX-RS: - Replace Apache Aries JAX-RS Whiteboard + CXF with Eclipse OSGi Tech REST backed by Jersey 3.1.3 - Switch osgi.service.jaxrs to osgi.service.jakartars (OSGi R8) - Update all itest bndrun -runbundles accordingly JAXB: - Migrate maven-jaxb2-plugin → org.jvnet.jaxb:jaxb-maven-plugin 3.0.2 - Upgrade jakarta.xml.bind-api 2.3.3 → 3.0.0 (jakarta namespace) - Replace org.glassfish.jaxb:jaxb-osgi with com.sun.xml.bind:jaxb-osgi 3.0.2 - Update .xjb binding files and XSD to JAXB 3 namespace - Add openhab.tp-jaxb as dependency to openhab-core-base feature Karaf: - Upgrade karaf.compile.version and karaf.tooling.version to 4.5.0 Dependencies: - Pin org.glassfish.hk2:osgi-resource-locator to 1.0.3 in bom/runtime to match feature.xml; Jersey 3.x requires this version range - jupnp upgrade to jakarta, not yet available Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
|
@andrewfg I don't have a batch file to prepare everything required for the distro build. I have a local installation - and it is quite independent from the typical activities for 5.2. This is why I did the version bump (to 5.3 or 6.0 actually does not matter). The point is, all compiled and installed 6.0 packages stay in local .m2 repository and are not obsoleted by a CI snapshot build. It needs some work, but if you want to set up a local build, I would recommend to get the gh cli tool. Then you can basically copy the steps from this GH workflow and clone all repos you don't have cloned yet. If you have one repo on disk, just use the gh pr checkout [number] - I have PRs on every OH repo. Then it is just like another branch, keep it up-to-date using git pull. Though, I am typically using the builds created by the GH workflow. btw: sorry for the late answer, I took some time today to upgrade to Karaf and OH to recent pax web from 11.1.1 (including Jetty 12.0 to 12.1). |
|
@holgerfriedrich thanks for the suggestions above; do not worry about it too much, but it did not work for me as your k450 branch seems to be based on OH 4.5 rather than 5.x; and therefore mvn could not build it for me. But anyway don't worry about it; it was just an idea.. |
|
@andrewfg my k450 branches target Karaf 4.5.0-SNAPSHOT. Just clone Karaf and run |
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
|
@holgerfriedrich I managed to install the necessary modules and succeeded to build OH-Core v6.x. And then I could open your fork version of org.openhab.binding.hue (in which you have updated the dependencies). And actually I could not find any compiler warnings or whatever. It all looks perfect. I think this is because at that time the "proper" HTTP2 in Jetty 9.5.x was not good for purpose so I was forced to construct the binding using raw HTTP2 components and made my own customised HTTP2 client with its own session management, frame parsing, concurrency and locking , flow control, throttling, timeouts etc. In the meantime Jetty 12 has much improved its own HTTP2 client, so probably if I would rewrite the binding now, it would be a much easier task for me. The good news however is that all original raw HTTP2 raw components are still present in Jetty 12 albeit no longer expected to be used externally. So as a general rule my old code still works. Although I expect that once we get to real operative systems there may be a few edge cases and slight behaviour differences. |



Servlet / HTTP:
JAX-RS:
JAXB:
Karaf:
Dependencies: