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

Build failure on hot reload [Development environment] #3409

Closed
rafaelkloss opened this issue Aug 2, 2019 · 4 comments · Fixed by #3701
Closed

Build failure on hot reload [Development environment] #3409

rafaelkloss opened this issue Aug 2, 2019 · 4 comments · Fixed by #3701
Assignees
Milestone

Comments

@rafaelkloss
Copy link

Bug Description
In the application.properties, I'm using the wildcard to config database user, password, url... for 2 environments (dev, prod)
examples:

  • %dev.quarkus.datasource.password=xxxxxxxx

  • %prod.quarkus.datasource.password=xxxxxxxx

In the development environment using mvnw compile quarkus:dev: the first build is ok, work's fine .
But, when i change any class and try to send a request, the hot reload throws an Exception:

2019-08-02 11:37:49,564 ERROR [io.qua.dev.DevModeMain] (executor-thread-12) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.deployment.steps.ConfigurationSetup#initializeConfiguration threw an exception: java.util.NoSuchElementException: Property quarkus.datasource.password not found at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:141) at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:171) at io.quarkus.dev.DevModeMain.restartApp(DevModeMain.java:198) at io.quarkus.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:109) at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup.handleHotDeploymentRequest(UndertowHotReplacementSetup.java:67) at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup$1$1.handleRequest(UndertowHotReplacementSetup.java:56) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830) at io.quarkus.runtime.CleanableExecutor$CleaningRunnable.run(CleanableExecutor.java:224) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 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.lang.Thread.run(Thread.java:745) at org.jboss.threads.JBossThread.run(JBossThread.java:479) Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.deployment.steps.ConfigurationSetup#initializeConfiguration threw an exception: java.util.NoSuchElementException: Property quarkus.datasource.password not found at io.quarkus.builder.Execution.run(Execution.java:108) at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:121) at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:115) at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:107) ... 18 more Caused by: java.util.NoSuchElementException: Property quarkus.datasource.password not found at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:89) at io.quarkus.deployment.steps.ConfigurationSetup.initializeConfiguration(ConfigurationSetup.java:225) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:768) at io.quarkus.builder.BuildContext.run(BuildContext.java:415) at io.quarkus.builder.BuildContext$$Lambda$116/2101929518.run(Unknown Source) 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) ... 2 more

To Reproduce
Steps to reproduce the behavior:

  1. Make database configuration for dev and prod in application.properties
  2. Start api in dev mode mvnw compile quarkus:dev:
  3. Change any class in project to make a hot reload
  4. Make a request and take a look on log

Configuration

# %dev.quarkus.datasource.password=xxxxxxxx

# %prod.quarkus.datasource.password=xxxxxxxx

**Environment **

  • Quarkus version or git rev: 0.20.0

My question is:
This is a bug or any new configuration needed ?

@rafaelkloss rafaelkloss added the kind/bug Something isn't working label Aug 2, 2019
@rafaelkloss
Copy link
Author

Installed features: [agroal, cdi, hibernate-orm, hibernate-validator, jdbc-postgresql, narayana-jta, resteasy, resteasy-jsonb, security, smallrye-jwt, smallrye-openapi, swagger-ui, vertx]

@emmanuelbernard
Copy link
Member

There is something fishy @stuartwdouglas Maybe the reload does not take %dev into account? I have not confirmed the suspicion.

@jclingan
Copy link

I just ran into this problem as well when starting to test spring MVC annotation support w/PanacheRepository. Reproducer:

  1. Clone the project.
  2. Run mvn compile quarkus:dev
  3. Run http POST http://localhost:8080/license licenseId=1 organizationId=org productName=myproduct licenseType=T licenseMax=5 licenseAllocated=1 comment="comment" # works fine
  4. Add System.out.println("force a reload"); to LicenseController.
  5. Run http POST http://localhost:8080/license licenseId=2 organizationId=org productName=myproduct licenseType=T licenseMax=5 licenseAllocated=1 comment="comment" # Result: Property quarkus.datasource.url not found

@gsmet gsmet modified the milestones: 0.21.0, 0.22.0 Aug 14, 2019
@fbascheper
Copy link

I can confirm @emmanuelbernard 's suspicion.

Hot code replacement works fine when I use the following application.properties

quarkus.datasource.url=jdbc:h2:mem:default
quarkus.datasource.driver=org.h2.Driver
quarkus.datasource.username=username-default
quarkus.datasource.min-size=3
quarkus.datasource.max-size=13
quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.hibernate-orm.sql-load-script=db/hsqldb/data-and-schema.sql

Log file upon code replace:

2019-08-22 10:52:57,704 INFO  [io.qua.dep.QuarkusAugmentor] (executor-thread-1) Beginning quarkus augmentation
2019-08-22 10:52:58,232 INFO  [io.qua.dep.QuarkusAugmentor] (executor-thread-1) Quarkus augmentation completed in 528ms
2019-08-22 10:52:58,657 INFO  [io.quarkus] (executor-thread-1) Quarkus 0.21.1 started in 0.962s. Listening on: http://[::]:8080
2019-08-22 10:52:58,658 INFO  [io.quarkus] (executor-thread-1) Installed features: [agroal, cdi, hibernate-orm, jdbc-h2, jdbc-mariadb, narayana-jta, resteasy, resteasy-jsonb]
2019-08-22 10:52:58,658 INFO  [io.qua.dev] (executor-thread-1) Hot replace total time: 2.425s

But when I use configuration profile properties, like so:

%dev.quarkus.datasource.url=jdbc:h2:mem:default
%dev.quarkus.datasource.driver=org.h2.Driver
%dev.quarkus.datasource.username=username-default
%dev.quarkus.datasource.min-size=3
%dev.quarkus.datasource.max-size=13
%dev.quarkus.hibernate-orm.database.generation=drop-and-create
%dev.quarkus.hibernate-orm.sql-load-script=db/hsqldb/data-and-schema.sql

And try hot code replacement, I hit this bug:

019-08-22 10:58:19,934 INFO  [io.quarkus] (main) Quarkus 0.21.1 started in 6.517s. Listening on: http://[::]:8080
2019-08-22 10:58:19,935 INFO  [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, jdbc-h2, jdbc-mariadb, narayana-jta, resteasy, resteasy-jsonb]
2019-08-22 10:58:42,127 INFO  [io.qua.dev] (executor-thread-1) Changed source files detected, recompiling [C:\ws\git\workshop\quarkus-petclinic\src\main\java\com\github\acme\quarkus\petclinic\model\Specialty.java]
2019-08-22 10:58:43,769 INFO  [io.quarkus] (executor-thread-1) Quarkus stopped in 0.032s
2019-08-22 10:58:43,780 INFO  [io.qua.dep.QuarkusAugmentor] (executor-thread-1) Beginning quarkus augmentation
2019-08-22 10:58:43,950 ERROR [io.qua.dev.DevModeMain] (executor-thread-1) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.steps.ConfigurationSetup#initializeConfiguration threw an exception: java.util.NoSuchElementException: Property quarkus.datasource.min-size not found
        at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:141)
        at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:180)
        at io.quarkus.dev.DevModeMain.restartApp(DevModeMain.java:195)
        at io.quarkus.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:116)
        at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup.handleHotDeploymentRequest(UndertowHotReplacementSetup.java:72)
        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.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        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:1395)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
        at java.lang.Thread.run(Thread.java:748)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.steps.ConfigurationSetup#initializeConfiguration threw an exception: java.util.NoSuchElementException: Property quarkus.datasource.min-size not found
        at io.quarkus.builder.Execution.run(Execution.java:108)
        at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:121)
        at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:115)
        at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:107)
        ... 18 more
Caused by: java.util.NoSuchElementException: Property quarkus.datasource.min-size not found
        at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:89)
        at io.quarkus.deployment.steps.ConfigurationSetup.initializeConfiguration(ConfigurationSetup.java:225)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:768)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
        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:1395)
        ... 2 more

2019-08-22 10:58:43,953 INFO  [io.qua.dev] (executor-thread-1) Hot replace total time: 1.831s

stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Aug 26, 2019
The old config provider resolver was not being restored
on shutdown, which would cause problems on restarts.
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Aug 27, 2019
The old config provider resolver was not being restored
on shutdown, which would cause problems on restarts.
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Aug 27, 2019
The old config provider resolver was not being restored
on shutdown, which would cause problems on restarts.
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Aug 27, 2019
The old config provider resolver was not being restored
on shutdown, which would cause problems on restarts.
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Aug 27, 2019
The old config provider resolver was not being restored
on shutdown, which would cause problems on restarts.
ebs-bd-tst pushed a commit to fbascheper/quarkus-petclinic that referenced this issue Aug 28, 2019
gsmet pushed a commit that referenced this issue Sep 3, 2019
The old config provider resolver was not being restored
on shutdown, which would cause problems on restarts.
gsmet pushed a commit that referenced this issue Sep 4, 2019
The old config provider resolver was not being restored
on shutdown, which would cause problems on restarts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants