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

Env Variable not recognized using MicroProfile Restclient and Quarkus dev mode #3637

Closed
lbernardomaia opened this issue Aug 22, 2019 · 7 comments
Labels
area/config kind/bug Something isn't working
Milestone

Comments

@lbernardomaia
Copy link

lbernardomaia commented Aug 22, 2019

Describe the bug
When a project it's using the configuration properties to load the Rest Client following the guide (
https://quarkus.io/guides/rest-client-guide) and the value is an Env variable as below, it works fine but if the app is running in the dev-mode and some change is performed, then after the Hot Replace, the Env variable it's not identifiable anymore.

Config Properties:
org.acme.restclient.CountriesService/mp-rest/url=${REST_COUNTRIES_URL}

Browser Error Message:
Internal Server Error Error handling 50e37c81-d992-42a6-ad37-1f150484a9b9-1, org.jboss.resteasy.spi.UnhandledException: java.lang.IllegalArgumentException: The value of URL was invalid ${REST_COUNTRIES_URL}

Log Error:
2019-08-22 09:23:42,962 ERROR [io.und.req.io] (executor-thread-1) Exception handling request 50e37c81-d992-42a6-ad37-1f150484a9b9-1 to /country/name/italy: org.jboss.resteasy.spi.UnhandledException: java.lang.IllegalArgumentException: The value of URL was invalid ${REST_COUNTRIES_URL} at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:381) at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:209) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:503) at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:252) at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:153) at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:363) at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:156) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:238) at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:249) at io.quarkus.resteasy.runtime.ResteasyFilter$ResteasyResponseWrapper.sendError(ResteasyFilter.java:64) at io.undertow.servlet.handlers.DefaultServlet.doGet(DefaultServlet.java:175) at javax.servlet.http.HttpServlet.service(HttpServlet.java:686) at javax.servlet.http.HttpServlet.service(HttpServlet.java:791) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129) at io.quarkus.resteasy.runtime.ResteasyFilter.doFilter(ResteasyFilter.java:28) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:269) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:78) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:133) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:130) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$9$1$1.call(UndertowDeploymentRecorder.java:513) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249) at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:174) at io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:65) at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$1.handleRequest(UndertowDeploymentRecorder.java:92) at io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:49) at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup.handleHotDeploymentRequest(UndertowHotReplacementSetup.java:85) at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup$1$1.handleRequest(UndertowHotReplacementSetup.java:61) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830) at io.quarkus.runtime.CleanableExecutor$CleaningRunnable.run(CleanableExecutor.java:224) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426) at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29) at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29) at java.base/java.lang.Thread.run(Thread.java:834) at org.jboss.threads.JBossThread.run(JBossThread.java:479)

Expected behaviour
A Rest Client Url using an Env Variable should still identify the value after the Hot replace.

Actual behaviour
A Rest Client Url using an Env Variable is lost after the Hot replace.

Quarkus Version
0.21.1

@lbernardomaia lbernardomaia added the kind/bug Something isn't working label Aug 22, 2019
@gsmet
Copy link
Member

gsmet commented Aug 22, 2019

@dmlloyd does it ring a bell? Could it be related to the other env variable issue?

@dmlloyd
Copy link
Member

dmlloyd commented Aug 22, 2019

Yeah this looks like a duplicate of #3516.

@lbernardomaia
Copy link
Author

Hi guys,

just to let you know, perhaps it's related.

I got a similar problem but now using the quarkus-mailer.

In my properties file when I have quarkus.mailer.port=${MAIL_PORT} the following exception is thrown:

email | 13:27:52,628 ERROR [io.qua.dev.DevModeMain] Failed to start quarkus: java.lang.NumberFormatException: For input string: "${MAIL_PORT}" email | at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) email | at java.lang.Integer.parseInt(Integer.java:569) email | at java.lang.Integer.parseInt(Integer.java:615) email | at io.smallrye.config.Converters.lambda$static$18960f11$1(Converters.java:75) email | at io.smallrye.config.SmallRyeConfig.convert(SmallRyeConfig.java:133) email | at io.smallrye.config.SmallRyeConfig.getOptionalValue(SmallRyeConfig.java:98) email | at io.quarkus.runtime.configuration.ConfigUtils.getOptionalValue(ConfigUtils.java:92) email | at io.quarkus.deployment.configuration.ObjectConfigType.acceptConfigurationValueIntoGroup(ObjectConfigType.java:94) email | at io.quarkus.deployment.configuration.GroupConfigType.acceptConfigurationValueIntoLeaf(GroupConfigType.java:238) email | at io.quarkus.deployment.configuration.ObjectConfigType.acceptConfigurationValue(ObjectConfigType.java:76) email | at io.quarkus.deployment.configuration.ConfigDefinition.loadConfiguration(ConfigDefinition.java:492) email | at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:219) email | at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:137) email | at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:75) email | at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:107) email | at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:180) email | at io.quarkus.dev.DevModeMain.start(DevModeMain.java:94) email | at io.quarkus.dev.DevModeMain.main(DevModeMain.java:66)

@lbernardomaia
Copy link
Author

An update about this issue.

The problem I mentioned with MicroProfile Restclient, it's not happening on 0.22.0 version, though the other error quarkus.mailer.port=${MAIL_PORT} is still there.

thanks.

@wglanzer
Copy link

@lbernardomaia Same problem here with 0.23.1

@stale
Copy link

stale bot commented Nov 13, 2019

This issue/pullrequest has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 13, 2019
@gsmet
Copy link
Member

gsmet commented Nov 13, 2019

David has this one on his radar, it's not stale.

@stale stale bot removed the stale label Nov 13, 2019
@gsmet gsmet added this to the 1.1.0 milestone Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants