-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing constraints in org.eclipse.jetty.* in latest I builds #779
Comments
So issue comes from eclipse.pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/target/StateViewPage.java Line 272 in 6b0f0ed
My guess - As the package in question "java.lang.runtime" is since Java 14 for which there is no target file this old implementation fails to discover it as JVM package. @HannesWell You planned to work on switching to the new resolver, right? |
But it's not just the |
I can confirm that the package only exists since Java-14 but for Java-9 or later BREEs the system packages are queried from the VM (and since the module system exists the JVM knows when a package was added). But the Manifest of
So PDE seems actually right here, but the metadata of Jetty seem to be wrong. |
This seems to be the bad line: If they remove that line and the following... ... the maven-bundle-plugin should add the EE requirement automatically based on the java version target (which should be Java-17): |
I haven't thought about such possibility at all. I'll report it to Jetty. |
Great 👍🏽 |
I still wonder though if pde queries the JVM and it runs on Java 17 why isn't it finding the package (as p2/equinox seems to be happy)? |
Because PDE asks for the JVM for packages of the release the bundle declares as its BREE/EE-requirement. Equinox just uses the running VM and I assume P2 does the same, but I'm not sure about that. And in this case the metadata are clearly wrong. |
The validation failure described in eclipse-equinox/p2#344 (comment) is probably a follow-up error because only resolved bundles are added automatically as requirements to a launch. |
While the Jetty case is strange, I don't think it can be claimed at bogus, and PDE should still support it: |
I'm not sure how it can be anything but bogus to declare that one can run in Java 11 when one cannot. This will simply fail to wire the package and hence fail to start the bundle when running with Java 11. That to my thinking is about as bogus as it gets... Whether PDE should tolerate such bogus things because the package constraint can in fact be satisfied by the actual JVM that is really used or will be really be used is different question than whether the combination of a BREE and a package requirement that does not exist for that BREE is bogus or not... |
That statement IMO illustrate that the interpretation of BREE is bogus: the bundle doesn't say it requires Java 11 to run. |
First of all BREE is deprecated (!) because it actually has no real semantics anymore on Modular (Java 9+) JVMs, so jetty should simply remove it and replace this by osgi.ee Namespace and import of java. packages (what jetty already does). Nerveless using Java-11 where the classes are compiled with Java-17 is wrong and will, if trying to run on Java-11 OSGi framework result in class-version errors and is obviously not very useful, but is only a hint for the framework to not even try to start a bundle that requires a higher version of java (== byte code level!). The available packages can vary, even on Java 17 VM I can build one that does not contain all packages I had ad runtime. That's why I previously already stated that PDE should only ever use ONE JVM for its target state and that's the target jvm (what is the default jvm of the workspace in practice), for a bundle in the workspace it should use the one declared in the project to prevent such errornous usages of packages not available at that JVM at all.
even if, it can resolve but not run if the class version requires Java 17. |
That it might get java.lang.runtime from another source might even be true if OSGi allowed one to export java.* packages, but it does not allow that. Moreover nothing else actually does provide that package in the actual target platform being used so the fact that something might do that in an alternative universe where bundles could provide java.* packages is not relevant. So in the end, nothing other than a Java 14+ JVM actually supplies or could supply this thing... I don't think your "it's not bogus" argument holds water, so it's not an effective argument as to why PDE should support this. A more effective argument is that say that the user has made it clear to PDE that they are/will be actually launching with Java 17 so that package will actually resolve so please don't complain about it... Anyway, you can see how the discussion about the bogusness of the constraint is not moving towards a resolution of PDE should support it... |
In the end it all boils don to how much PDE should validate external dependencies that are not build by PDE in the current workspace! e.g. lets make it simpler and assume jetty would not be used as a bundle but a plain jar, it claims to run on Java 11 as it is compiled with The same is here, PDE can detect an issue here (that obviously should be fixed), but should it report it if I never asked for running the bundle with java 11 nor even compile my project with java 11 (so the project itself can never run on java 11 as well)? |
Yes, these are much better statements. One might even argue that a java.* package can only come from a JRE so let's never complain about missing java.* package requirements. Or one might argue "thank goodness PDE complained so that this real problem is getting fixed". |
I agree that PDE shouldn't validate the full bundle integrity like it does during development at that stage, but simply validate in launch config that the bundle can resolve with the current JRE and other bits of the environment. |
Yes, as an experiment I edited the |
Jetty 12.0.2 should contain a fix for that and it should be released soon so we can overcome this issue. I think it's easier to live with this issue (for short period) instead of revert and reapply in all the involved git repos. |
It is not that simple since there is no explicit validation on this topic for internal or external Bundles. What's happening here is that the bundle simply does not resolve in the And even if it would be possible, should we really silence the only tool that indicated that error? Ideally BND would already detect such muss configuration, but unfortunately it didn't. I'd rather fix the issue and keep the more strict (implicit) validation. Until know I have not seen a relevant case where it was wrong. I also want to emphasize that, in the pre-launch validation the system-packages only of the JVM (at its own Java-version) used to run the launch are provided to all bundles regardless of their EE-requirement. So there you already have the desired behavior. |
each bundle has a (install) location where you can se where it is located and could then be matched to a workspace project if needed. |
I think Jetty 12.02 has now been released. What needs to happen now to ship Jetty 12.02 in the platform build? (Please note, I am only asking out of curiosity, not urgency :-) ) Edit: please ignore, I found this eclipse-platform/eclipse.platform.releng.aggregator#1430 Thanks! |
I've tested against latest I build (20231010-2112) and this issue seems to be resolved. Shall I close this issue? |
Thanks to everybody who worked on this issue! 👍 |
Follow on from eclipse-equinox/p2#344
Launching a child Eclipse session also shows missing constraints errors and help system doesn't launch in child Eclipse.
The text was updated successfully, but these errors were encountered: