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

External property file not being read #12019

Closed
Joellao opened this issue Jul 9, 2024 · 10 comments · Fixed by #12026
Closed

External property file not being read #12019

Joellao opened this issue Jul 9, 2024 · 10 comments · Fixed by #12026
Labels
Bug For general bugs on Jetty side

Comments

@Joellao
Copy link

Joellao commented Jul 9, 2024

Jetty Version 12.0.7

Jetty Environment: EE9

Java 17

Hello everyone, I updated from Jetty 10 to Jetty 12. With some tweaks around I was able to have everything working.
I was using an external properties file in order to change the ssl port without changing anything related to jetty ".ini" files.

Then the whole application was being started through
java -jar start.jar resources/jetty-settings.properties

Jetty-settings.properties is in the resources folder with the jetty-logging.properties

That seems to not be working anymore. I know that I can pass system parameter to the command with jetty.ssl.port being set and that will work and I also know that setting those through the .ini files is working just fine.

Is there something that I'm missing regarding this? Maybe something changed and I didn't find it online?

When I do --list-config
I get ${jetty.base}/resources/jetty-settings.properties:jetty.ssl.port = 8312 so somehow it's being recognized, but not being used.

I also found this #2719 so this approach "should" work fine

Thanks in advance

@joakime
Copy link
Contributor

joakime commented Jul 9, 2024

I was using an external properties file in order to change the ssl port without changing anything related to jetty ".ini" files.

A properties file is not necessary here.
Just give the property to the command line.

Eg:

java -jar start.jar jetty.ssl.port=8132

@Joellao
Copy link
Author

Joellao commented Jul 9, 2024

I was using an external properties file in order to change the ssl port without changing anything related to jetty ".ini" files.

A properties file is not necessary here. Just give the property to the command line.

Eg:

java -jar start.jar jetty.ssl.port=8132

Yeah I know that I can dot that, as I said in the original post, but the use case is a little different.

I would need to change a "core" part by introducing this simple fix. In the worst case that's what is going to happen, but before that, I'd like to know if it's still possible or something changed. Or maybe it's something caused by the migration.

Cheers

@janbartel
Copy link
Contributor

@Joellao although this isn't a documented feature (at least we don't seem to output anything about it in the --help output), it looks to me that it should still be working. Try turning on --debug when you run, and see if you can spot the parsing of your properties file in the output.

@Joellao
Copy link
Author

Joellao commented Jul 10, 2024

@janbartel Yes, that's true that it isn't a documented thing, and I would also kinda understand if that was removed. When I turn the --debug one it is doing a parsing:
DEBUG : parse("resources/jetty-settings.properties", "<command-line>")

The only difference is that in Jetty 10 it's adding it as a last entry in the command line, instead in the Jetty 12 it's adding it before the classpath entries (multiple one, instead of a big chunk of paths).
jetty-ee9-webapp.xml and jetty-ee-deploy.xml are the last entries for Jetty 12

@Joellao
Copy link
Author

Joellao commented Jul 10, 2024

I tried with 12.0.11 and it seems to be working on that version. Didn't do anything fancy, just starting with server and http modules enabled. Passed the property file as an argument and indeed it starts the server in the specified port. Strange thing

@joakime
Copy link
Contributor

joakime commented Jul 10, 2024

I tried with 12.0.11 and it seems to be working on that version. Didn't do anything fancy, just starting with server and http modules enabled. Passed the property file as an argument and indeed it starts the server in the specified port. Strange thing

There's been no changes to jetty-start behavior related to properties files in any Jetty 12.0.x version.

I reviewed all of the changes with ...

[jetty-12.0.x]$ git diff jetty-12.0.0...jetty-12.0.11 -- jetty-core/jetty-start/

The fact that it works for you with 12.0.11 and not with 12.0.7 is just strange.

@Joellao
Copy link
Author

Joellao commented Jul 10, 2024

@joakime Indeed it's not working. One of the demos was using port 8888 in http.ini file instead of 8080 so I celebrated too early.
Now I did a proper test on that and it's not working as expected. But in 10.0.22 it is working

@janbartel
Copy link
Contributor

@Joellao there is a problem in jetty-12, I can now see that the properties file is not being passed into XmlConfiguration. Let me look into this, I'll get back to you.

@janbartel
Copy link
Contributor

Issue will be fixed for 2.0.12 via #12026

@Joellao
Copy link
Author

Joellao commented Jul 12, 2024

@janbartel Thank you very much for the insights and the prompt fix. Really glad that I'll need to only perform an upgrade to the newest version instead of changing a core part of the application.
Best regards

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
No open projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

4 participants