-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Only on Windows: Failed startup of context oeje8w.WebAppContext #12723
Comments
I have created a new jetty-ee8-webapp-12.0.16.jar to get more information. Under Windows there is an java.nio.file.InvalidPathException:
|
@joakime the
|
@joakime I have replaced the line mentioned by @janbartel:
with this line:
In my case it works on Linux and Windows now. |
@janbartel I think the surrounding
|
@joakime and @janbartel I correct my self. I more defensive solution would be:
|
Where did the odd URL of We have a @gpfeifer try using this instead ... Path warPath = Path.of(URIUtil.correctURI(war)); |
Hi @joakime Regarding:
I can answer this question in detail if needed. Basically I try to deploy a simple 'Hello World' war in an OSGi container using jetty-osgi. Some details can be found here: https://docs.osgi.org/specification/osgi.enterprise/7.0.0/service.war.html. Basically you need to add the relevant entries to the MANIFEST.MF
Of course I have tried using:
The variable Best regards |
Good point. Can you breakpoint the call Some code is creating the Aside: we have to fix Lines 805 to 810 in c3f88ba
Lines 1261 to 1270 in c3f88ba
|
@joakime Currently I'm not in the position to debug Jetty in my environment. Neither Linux nor Windows. I'm able to add some code (e.g. println) and run it on Windows and Linux. Any suggestions? |
@joakime and @janbartel Are you able to reproduce this problem under Windows? Deploying a simple Hello World OSGI War to jetty-osgi under Windows? |
Our unit testing of jetty-osgi (all environments) on Windows 10 does not show this issue you are experiencing. |
@joakime and @janbartel It seems that you are using felix in your unit testing. I'm using org.eclipse.osgi (equinoy). Could it be that this issue only occurs when using equinox? I have analyzed the log (with level debug) and the source code. In my environment the WebAppContext is created with a Resource. The instance variable war which is used in
is initialized with:
In my case Resource is a PathResource. Here is the toString method of PathResource:
In my case the result of 'toString() is 'file:/X:/test-production/....' which is not a valid String to use with Could it be that equinox returns something like 'file:/X:/test-production/....' whereas felix would return 'X:/test-production/....' ? |
I don't get why we are converting from Resource to String to Path and then back to Resource. I need to take a closer look at that chain of transformations, I bet we can leave it be as a Resource the entire way through. |
Perhaps the instance variable |
My problem is: Jetty 10 has a security vulnerability which will not be fixed. It is fixed in Jetty 12. That's why I need to use Jetty 12. My supposed fix for this issue will fix this issue, despite the fact that it is not the best solution. The question is: Can I except a fix within the next 2 month? |
Did you mean "expect a fix"? Our release cadence is monthly fixes, this one has low odds of making it for this month, but good odds for next month. |
Of course I mean "expect", sorry - a typo. Is there anything I can do to increase the odds? |
@joakime @gpfeifer the integration code with the osgi environment is different for the different containers, as they all use very different url mechanisms to represent a bundle. The relevant file is https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-core/jetty-osgi/src/main/java/org/eclipse/jetty/osgi/util/DefaultFileLocatorHelper.java. This code is mostly very old, and has only been tweaked a very small amount. The paths calculated by this code are used by https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-ee9/jetty-ee9-osgi/jetty-ee9-osgi-boot/src/main/java/org/eclipse/jetty/ee9/osgi/boot/EE9Activator.java#L520 to call @gpfeifer we use equinox for our testing, with the pax4j osgi testing framework. Are you running on equinox or on felix? We need to try and nail down any differences between your deployment environment and our test environment, because as @joakime says, our tests build on windows. |
@janbartel I think the removal of URIUtil.toURI() in commit 9b6944e broke this. |
@joakime @janbartel There are a lot of changes regarding URIUtil.toURI(). Can you explain which one(s), so that I can test it on my environment? |
@janbartel Unfortunately this does not fix the issue. My findings so far:
I need to double check all of this findings and will try to find out what is going on here. However: My supposed fix will solve the issue. If there is a Resource available, then ask the Resource for the Path. Another fix would be to change the toString Method of PathResource. Instead of using self.uri simply use self.path. Thoughts? |
@joakime @janbartel Sorry, the last point is wrong. When running your test cases the setWarResource method is called! Until now I have used Linux to analyze this issue. Today I have build and test this under Windows. Running
in
Under Linux all tests passed |
@joakime @janbartel Change this in WebAppContext:
to:
|
The osgi code that is setting the war string has not really changed. What has changed is the code in I've committed a speculative fix to the PR to change to deriving the @gpfeifer could you kindly test again please? |
Hi @janbartel I have take a look at your changes in the PR. Basically the only change needed to fix the problem is this one (in WebInfConfiguration): Remarks:
It is already there. See: To fix the bug you can choose between this 3 option:
Each of them will fix the issue. But I will test your fix! Best Regards |
@gpfeifer you are correct - we have already obtained the |
This PR fixed the issue. Remarks:
|
@gpfeifer slight change to remove pointless check of |
Great! Will test it on Monday😊 |
Hi @janbartel ,
Currently I'm busy. Will take a look at this later. Best regards |
Nothing should have a hard dependency on that classified artifact. |
Jetty version(s)
Jetty 12.0.16
Jetty Environment
ee8
Java version/vendor
(use: java -version)
Linux:
openjdk 21.0.5 2024-10-15
OpenJDK Runtime Environment (build 21.0.5+11-Ubuntu-1ubuntu122.04)
OpenJDK 64-Bit Server VM (build 21.0.5+11-Ubuntu-1ubuntu122.04, mixed mode, sharing)
Windows:
openjdk 21.0.5 2024-10-15 LTS
OpenJDK Runtime Environment Temurin-21.0.5+11 (build 21.0.5+11-LTS)
OpenJDK 64-Bit Server Temurin-21.0.5+11 (build 21.0.5+11-LTS, mixed mode, sharing)
OS type/version
Linux, 22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2
Windows 11
Description
In short:
My simple 'Hello World' WebApp works with Jetty 12.0.16 under Linux. But it does not works with Jetty 12.0.16 under Windows.
Details:
I'm using Jetty in an OSGi Container. I'm using this bundles:
All required bundles like org.osgi.*, org.apache.aries.spifly.dynamic.bundle, ... are installed.
This are the relevant entries in the MANIFEST.MF:
I'm using a normal WEB-INF/web-xml to configure the servlet. Jetty is configured using jetty.xml, jetty-deploy.xml and jetty-http.xml:
jetty.xml
jetty-deploy.xml
jetty-http.xml
This works with
It does not work with:
The error message is
Calling the servlet return a 503 (not 404!)
The text was updated successfully, but these errors were encountered: