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

Quarkus won't allow empty string for username and password #2235

Closed
vaughank opened this issue Jul 26, 2023 · 7 comments · Fixed by quarkusio/quarkus#35115
Closed

Quarkus won't allow empty string for username and password #2235

vaughank opened this issue Jul 26, 2023 · 7 comments · Fixed by quarkusio/quarkus#35115

Comments

@vaughank
Copy link

vaughank commented Jul 26, 2023

I am trying to pass an empty string as the username and password in my configuration but it is being converted to null and I am getting CONNECTION_REFUSED. Is there a way to pass empty string in the quarkus application.properties for username and password?

mp.messaging.incoming.scores.username=
mp.messaging.incoming.scores.password=

2023-07-26 14:39:57,593 DEBUG [io.ver.mqt.imp.MqttClientImpl] (vert.x-eventloop-thread-0) Trying to connect with XXXX:8883
2023-07-26 14:39:57,620 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile [dev]): java.util.NoSuchElementException: SRCFG00040: The config property mp.messaging.incoming.scores.username is defined as the empty String ("") which the following Converter considered to be null: io.smallrye.config.Converters$BuiltInConverter
at io.smallrye.config.SmallRyeConfig.convertValue(SmallRyeConfig.java:300)
at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:242)
at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:168)
at io.quarkus.smallrye.reactivemessaging.runtime.devconsole.Connectors.getProperties(Connectors.java:96)
at io.quarkus.smallrye.reactivemessaging.runtime.devconsole.Connectors.collect(Connectors.java:77)
at io.quarkus.smallrye.reactivemessaging.runtime.devconsole.Connectors_Observer_collect_09787e46bbc1ae6beb97ee935c415e22cef455b0.notify(Unknown Source)
at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:328)
at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:310)
at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:78)
at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:131)
at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:100)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(Unknown Source)
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:108)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:104)
at java.base/java.lang.Thread.run(Thread.java:829)

2023-07-26 14:39:57,621 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure
2023-07-26 14:39:57,954 INFO [io.ver.mqt.imp.MqttClientImpl] (vert.x-eventloop-thread-0) Connection with XXXX:8883 established successfully
2023-07-26 14:39:57,954 INFO [io.ver.mqt.imp.MqttClientImpl] (vert.x-eventloop-thread-0) Connection with XXXX:8883 established successfully
2023-07-26 14:39:57,959 DEBUG [io.ver.mqt.imp.MqttClientImpl] (vert.x-eventloop-thread-0) Sending packet MqttConnectMessage[fixedHeader=MqttFixedHeader[messageType=CONNECT, isDup=false, qosLevel=AT_MOST_ONCE, isRetain=false, remainingLength=0], variableHeader=MqttConnectVariableHeader[name=MQTT, version=4, hasUserName=false, hasPassword=false, isWillRetain=false, isWillFlag=false, isCleanSession=true, keepAliveTimeSeconds=30], payload=MqttConnectPayload[clientIdentifier=df7057e3-58a0-45a0-8200-68db4d9aec69, willTopic=null, willMessage=null, userName=null, password=null]]
2023-07-26 14:39:57,959 DEBUG [io.ver.mqt.imp.MqttClientImpl] (vert.x-eventloop-thread-0) Sending packet MqttConnectMessage[fixedHeader=MqttFixedHeader[messageType=CONNECT, isDup=false, qosLevel=AT_MOST_ONCE, isRetain=false, remainingLength=0], variableHeader=MqttConnectVariableHeader[name=MQTT, version=4, hasUserName=false, hasPassword=false, isWillRetain=false, isWillFlag=false, isCleanSession=true, keepAliveTimeSeconds=30], payload=MqttConnectPayload[clientIdentifier=df7057e3-58a0-45a0-8200-68db4d9aec69, willTopic=null, willMessage=null, userName=null, password=null]]
2023-07-26 14:39:57,995 DEBUG [io.ver.mqt.imp.MqttClientImpl] (vert.x-eventloop-thread-0) Incoming packet MqttConnAckMessage[fixedHeader=MqttFixedHeader[messageType=CONNACK, isDup=false, qosLevel=AT_MOST_ONCE, isRetain=false, remainingLength=2], variableHeader=MqttConnAckVariableHeader[connectReturnCode=CONNECTION_REFUSED_NOT_AUTHORIZED, sessionPresent=false], payload=]
2023-07-26 14:39:57,995 DEBUG [io.ver.mqt.imp.MqttClientImpl] (vert.x-eventloop-thread-0) Incoming packet MqttConnAckMessage[fixedHeader=MqttFixedHeader[messageType=CONNACK, isDup=false, qosLevel=AT_MOST_ONCE, isRetain=false, remainingLength=2], variableHeader=MqttConnAckVariableHeader[connectReturnCode=CONNECTION_REFUSED_NOT_AUTHORIZED, sessionPresent=false], payload=]
2023-07-26 14:39:57,996 ERROR [io.ver.mqt.imp.MqttClientImpl] (vert.x-eventloop-thread-0) Connection refused by the server - code: CONNECTION_REFUSED_NOT_AUTHORIZED
2023-07-26 14:39:57,996 ERROR [io.ver.mqt.imp.MqttClientImpl] (vert.x-eventloop-thread-0) Connection refused by the server - code: CONNECTION_REFUSED_NOT_AUTHORIZED

@cescoffier
Copy link
Contributor

That's a question for @radcortez
I would recommend using the Quarkus GitHub issue tracker for Quarkus specific questions.

@radcortez
Copy link
Member

I am trying to pass an empty string as the username and password in my configuration but it is being converted to null and I am getting CONNECTION_REFUSED. Is there a way to pass empty string in the quarkus application.properties for username and password?

From the stacktrace, not with that API. A call to Config.getValue always requires a value set, or the empty represents clearing the value.

In this case, to support an empty username / password, the integration code in RM needs to use another API from Config: Config.getConfigValue or Optional.

@cescoffier
Copy link
Contributor

But that's in the dev console, not in reactive messaging.

@radcortez
Copy link
Member

But that's in the dev console, not in reactive messaging.

What do you mean?

@cescoffier
Copy link
Contributor

The code using getValue instead of getOptionalValue is in the Quarkus dev console, not in reactive messaging (which is what I meant initially, this is the wrong repo). I will fix it directly in Quarkus.

@radcortez
Copy link
Member

Ah got it! Sorry.

@cescoffier
Copy link
Contributor

Will be fixed by quarkusio/quarkus#35115. Closing this one (wrong repo as explained).

@cescoffier cescoffier closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2023
michelle-purcell pushed a commit to michelle-purcell/quarkus that referenced this issue Aug 1, 2023
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

Successfully merging a pull request may close this issue.

3 participants