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

property file passed to start.jar is not read #2719

Closed
ghost opened this issue Jul 16, 2018 · 9 comments
Closed

property file passed to start.jar is not read #2719

ghost opened this issue Jul 16, 2018 · 9 comments
Assignees

Comments

@ghost
Copy link

ghost commented Jul 16, 2018

When passing a property file to start.jar like

java -jar start.jar externalized.properties --list-config

the existence of the file is check (a not existing file causes an error) but the properties are not read (file containts a property named foo):

Properties:
-----------
 java.version = 1.8.0_131
 java.version.major = 1
 java.version.micro = 0
 java.version.minor = 8
 java.version.platform = 8
 jetty.base = E:\jetty-9.4
 jetty.base.uri = file:///E:/jetty-9.4
 jetty.home = E:\jetty-9.4
 jetty.home.uri = file:///E:/jetty-9.4

The odd thing is that passing a key-value pair directly (java -jar start.jar foo=bar --list-config) or placing a ini-file in start.d folder works:

Properties:
-----------
 foo = bar
 java.version = 1.8.0_131
 ...
@joakime
Copy link
Contributor

joakime commented Jul 16, 2018

that particular syntax is not supported.

But you can do this (as you have already noted) ...

$ mkdir start.d
$ mv externalized.properties start.d/externalized.ini

now that properties file will be read as properties by start.jar

@ghost
Copy link
Author

ghost commented Jul 16, 2018

Oh, okay. You're right. Thanks for the quick answer.
I re-read the output of start.jar --help and property files are indeed not mentioned there.

I guess what brought me on the wrong track was some debugging and the observations that StartArgs#propertyFileRefs and StartArgs#propertyFiles are containing the passed property file. But as already mentioned it is not read...

Then this is perhaps a potential improvement that can build on the already available foundation in StartArgs? Because as far as I can tell the only thing missing is that the property file is read and the properties are added to StartArgs#properties, right?

@joakime
Copy link
Contributor

joakime commented Aug 15, 2018

closing as already supported.

@joakime joakime closed this as completed Aug 15, 2018
@ghost
Copy link
Author

ghost commented Aug 20, 2018

Sorry, but property files are not yet supported.
Only some foundation is already there.
Currently only ini files work.

@gregw
Copy link
Contributor

gregw commented Aug 21, 2018

I think there is some kind of problem here.... consider the following:

gregw@pellet: /tmp/test
[2019] java -jar $JETTY_HOME/start.jar 
2018-08-21 11:29:25.439:INFO::main: Logging initialized @311ms to org.eclipse.jetty.util.log.StdErrLog
2018-08-21 11:29:25.593:INFO:oejs.Server:main: jetty-9.4.12-SNAPSHOT; built: 2018-08-15T23:30:14.041Z; git: 56afcb96115c6ef3cd9cba896596d380c95a7d46; jvm 10.0.1+10
2018-08-21 11:29:25.613:INFO:oejs.AbstractConnector:main: Started ServerConnector@78ffe6dc{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2018-08-21 11:29:25.614:INFO:oejs.Server:main: Started @486ms
^C2018-08-21 11:29:28.007:INFO:oejs.AbstractConnector:Thread-10: Stopped ServerConnector@78ffe6dc{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}

gregw@pellet: /tmp/test
[2020] java -jar $JETTY_HOME/start.jar jetty.http.port=8888
2018-08-21 11:30:16.133:INFO::main: Logging initialized @779ms to org.eclipse.jetty.util.log.StdErrLog
2018-08-21 11:30:16.779:INFO:oejs.Server:main: jetty-9.4.12-SNAPSHOT; built: 2018-08-15T23:30:14.041Z; git: 56afcb96115c6ef3cd9cba896596d380c95a7d46; jvm 10.0.1+10
2018-08-21 11:30:16.844:INFO:oejs.AbstractConnector:main: Started ServerConnector@192011f4{HTTP/1.1,[http/1.1]}{0.0.0.0:8888}
2018-08-21 11:30:16.847:INFO:oejs.Server:main: Started @1492ms
^C2018-08-21 11:30:18.791:INFO:oejs.AbstractConnector:Thread-10: Stopped ServerConnector@192011f4{HTTP/1.1,[http/1.1]}{0.0.0.0:8888}

gregw@pellet: /tmp/test
[2021] java -jar $JETTY_HOME/start.jar jetty.http.port=8888 --list-config

Java Environment:
[ ... snip ... ] 
Properties:
-----------
 java.version = 10.0.1
 java.version.major = 10
 java.version.micro = 1
 java.version.minor = 0
 java.version.platform = 10
 jetty.base = /tmp/test
 jetty.base.uri = file:///tmp/test
 jetty.home = /usr/local/home/gregw/src/jetty-9.4.x/jetty-home/target/jetty-home
 jetty.home.uri = file:///usr/local/home/gregw/src/jetty-9.4.x/jetty-home/target/jetty-home
 jetty.http.port = 8888

[... snip ...]

gregw@pellet: /tmp/test
[2022] echo jetty.http.port=8888 > config.properties

gregw@pellet: /tmp/test
[2023] java -jar $JETTY_HOME/start.jar config.properties --list-config

Java Environment:
[... snip ...]
Properties:
-----------
 java.version = 10.0.1
 java.version.major = 10
 java.version.micro = 1
 java.version.minor = 0
 java.version.platform = 10
 jetty.base = /tmp/test
 jetty.base.uri = file:///tmp/test
 jetty.home = /usr/local/home/gregw/src/jetty-9.4.x/jetty-home/target/jetty-home
 jetty.home.uri = file:///usr/local/home/gregw/src/jetty-9.4.x/jetty-home/target/jetty-home

[... snip ...]

gregw@pellet: /tmp/test
[2024] java -jar $JETTY_HOME/start.jar config.properties
2018-08-21 11:31:02.449:INFO::main: Logging initialized @337ms to org.eclipse.jetty.util.log.StdErrLog
2018-08-21 11:31:02.593:INFO:oejs.Server:main: jetty-9.4.12-SNAPSHOT; built: 2018-08-15T23:30:14.041Z; git: 56afcb96115c6ef3cd9cba896596d380c95a7d46; jvm 10.0.1+10
2018-08-21 11:31:02.613:INFO:oejs.AbstractConnector:main: Started ServerConnector@78ffe6dc{HTTP/1.1,[http/1.1]}{0.0.0.0:8888}
2018-08-21 11:31:02.614:INFO:oejs.Server:main: Started @502ms
^C2018-08-21 11:31:05.581:INFO:oejs.AbstractConnector:Thread-10: Stopped ServerConnector@78ffe6dc{HTTP/1.1,[http/1.1]}{0.0.0.0:8888}

So the property file appears to be working, but it is impossible to see that in --list-configs

@gregw gregw reopened this Aug 21, 2018
gregw added a commit that referenced this issue Aug 21, 2018
Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw
Copy link
Contributor

gregw commented Aug 21, 2018

45d5bd2 fixes the list config issue.

@gregw gregw closed this as completed Aug 21, 2018
@ghost
Copy link
Author

ghost commented Aug 22, 2018

Thanks for dealing with that issue.
Just to be 100% sure: Does that mean it was "only" a --list-config display issue and property file loading always works as expected?

@gregw
Copy link
Contributor

gregw commented Aug 22, 2018

@jscheible-tpgroup in my testing, the property file was working fine to actually affect the settings, but was not be reported if I did a --list-config. So I have fixed list config and I hope that is your issue as well.

@ghost
Copy link
Author

ghost commented Aug 30, 2018

I mistakenly assumed that the properties weren't there cause they did not appear in the --list-config output... Thanks for your help! We gave it try with the jetty-9.4.x branch and can confirm that it works now as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants