Skip to content
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

Jetty12.0.8 cannot run my war successfully, but jetty-9.4.48.v20220622 can. #11633

Open
Helly987 opened this issue Apr 9, 2024 · 15 comments
Open
Labels
Bug For general bugs on Jetty side

Comments

@Helly987
Copy link

Helly987 commented Apr 9, 2024

With below error:
image

add modules:
java -jar $JETTY_HOME/start.jar --add-modules=http,ee10-deploy,ee10-webapp
start command: java -jar $JETTY_HOME/start.jar

demo.xml:

/demo /demo.war /work/demo false
@Helly987 Helly987 added the Bug For general bugs on Jetty side label Apr 9, 2024
@Helly987
Copy link
Author

Helly987 commented Apr 9, 2024

For the version Jetty9.x and Jetty12.x, can I use the same war? Can th emaven configuration be the same for the two different jetty version?

I found that Jetty 12.x was not compatible with jetty 9.x, it has a huge change.

@janbartel
Copy link
Contributor

Jetty 12 EE10 corresponds to the Servlet 6 specification, and all classes that were javax.servlet changed to jakarta.servlet so you will need to modify your web app accordingly. Or alternatively use the EE8 environment instead.

@joakime
Copy link
Contributor

joakime commented Apr 9, 2024

Change to use ee8 instead ...

java -jar $JETTY_HOME/start.jar --add-modules=http,ee8-deploy,ee8-webapp

and try deploying your webapp again

@Helly987
Copy link
Author

Change to use ee8 instead ...
java -jar $JETTY_HOME/start.jar --add-modules=http,ee8-deploy,ee8-webapp
and try deploying your webapp again

Yes, for http mode, it works fine. Thanks a lot.
But I still want to run in https mode:
java -jar $JETTY_HOME/start.jar --add-modules=ssl,https,ee8-deploy,ee8-webapp

You know that I need to write the keystore and password to the ssl.ini, the content is as below:
image

Unfortunately, when I run java -jar $JETTY_HOME/start.jar, it seems work fine just with "The system cannot find the drive specified." on the command line.
but I cannot access https://localhost:8443/ui
image
Could you help me check this?

@Helly987
Copy link
Author

Helly987 commented Apr 11, 2024

@joakime Please help check the https mode, I cannot run web application with it.
I use the jetty12.0.6, I think it is almost the same as the jetty12.0.8.

@joakime
Copy link
Contributor

joakime commented Apr 11, 2024

SNI has rules you must follow ...

  • It cannot be an IP literal (not IPv4 or IPv6)
  • It cannot be a localhost, localdomain, or local reference (eg localhost, foo.local, etc)
  • It must be a hostname that has at least 1 . (dot)
  • The hostname cannot end with a . (dot)

The rules back in Java 8 were very lax, with each version of Java since the rules have been made to be more in line with the specs for SNI.

@joakime
Copy link
Contributor

joakime commented Apr 11, 2024

You must also use an HTTP Client that supports sending the SNI details in the TLS negotiation properly.
Many older HTTP Clients do not perform this step properly.

@Helly987
Copy link
Author

I try the link use https://HOSTNAME/8443, it still has the same issue.
image

How can I use the https client?
I read the guilde, it supports the Secure HTTP/1.1

@joakime
Copy link
Contributor

joakime commented Apr 16, 2024

Your host does not follow the SNI rules.
It fails point 3 on my comment - #11633 (comment)

Your host name must by fully qualified, not abbreviated, not just a relative name (like your example).
It must be fully complete, all the way through to the top level domain segment.
These are the rules for SNI in both the spec for SNI, and also how new Java JVMs have it implemented.
Jetty has no control over these rules, as they are baked into Java itself.

@Helly987
Copy link
Author

Helly987 commented Apr 23, 2024

@joakime Is there any solution to disable the SNI validation? My computer is used as the server, no virtualhost.
But I tried to configure the ssl.ini with
jetty.ssl.sniRequired=false
jetty.ssl.sniHostCheck=true
or
jetty.ssl.sniRequired=true
jetty.ssl.sniHostCheck=true , the result is the same.

@sbordet
Copy link
Contributor

sbordet commented Apr 23, 2024

@Helly987 please read the documentation:
https://eclipse.dev/jetty/documentation/jetty-12/operations-guide/index.html#og-protocols-ssl-sni

You can fully disable the SNI check with:

jetty.ssl.sniRequired=false
jetty.ssl.sniHostCheck=false

@Helly987
Copy link
Author

Helly987 commented May 6, 2024

If I change them to be false, the result is not as expected.
image

I refer to the jetty Operation guide, no clear guide about how to configure in https mode. still try to access https://localhost:8443/

@sbordet
Copy link
Contributor

sbordet commented May 6, 2024

The image above shows that your TLS configuration is correct.

You just did not type any context path in your browser, or you have not deployed any web application.

What do you want to configure?

@Helly987
Copy link
Author

Helly987 commented May 7, 2024

No, I have configured the context path, but it is not working.
image

@sbordet
Copy link
Contributor

sbordet commented May 7, 2024

@Helly987 we cannot help you if the only information you give is "it is not working".

Please at least report the DEBUG logs when you start Jetty.

Also read the documentation section here:
https://eclipse.dev/jetty/documentation/jetty-12/operations-guide/index.html#og-deploy-jetty

Why do you call <Set name="war"> twice?
Are you sure that you have a property called jetty.webapps properly defined?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
None yet
Development

No branches or pull requests

4 participants