quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.87k stars 2.71k forks source link

Hot reloading in dev mode not working in 3.0.0.Alpha4 #31513

Closed nyko29 closed 1 year ago

nyko29 commented 1 year ago

Describe the bug

I have a maven multi module project with several quarkus modules. They communicate between each other with microservices. Quarkus module is using org.apache.myfaces.core.extensions.quarkus and quarkus-omnifaces.

When I launched the quarkus module in dev mode I got the following NPE after the first hot reloading:

[INFO] --- quarkus-maven-plugin:3.0.0.Alpha4:dev (default-cli) @ quarkus-webapp ---
[INFO] Invoking io.smallrye:jandex-maven-plugin:3.0.5:jandex @ quarkus-webapp
[INFO] Saving Jandex index: /home/toto/workspaces/workspace_quarkus_poc/quarkus_poc/quarkus-webapp/target/classes/META-INF/jandex.idx
[INFO] Invoking org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources @ quarkus-webapp
[INFO] Copying 2 resources
[INFO] Invoking org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile @ quarkus-webapp
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 32 source files to /home/okyn/workspaces/workspace_quarkus_poc/quarkus_poc/quarkus-webapp/target/test-classes

Listening for transport dt_socket at address: 5006
2023-03-01 10:54:10,114 INFO  [org.jberet] (build-57) JBERET000030: Resolved job file:/home/okyn/workspaces/workspace_quarkus_poc/quarkus_poc/quarkus-webapp/target/classes/META-INF/batch-jobs/priorityUpdate.xml
2023-03-01 10:54:10,144 INFO  [org.jberet] (build-57) JBERET000030: Resolved job file:/home/okyn/workspaces/workspace_quarkus_poc/quarkus_poc/quarkus-webapp/target/classes/META-INF/batch-jobs/loadTask.xml
2023-03-01 10:54:11,025 WARN  [io.qua.arc.pro.BeanArchives] (build-48) Failed to index javax.enterprise.util.AnnotationLiteral: Class does not exist in ClassLoader QuarkusClassLoader:Deployment Class Loader: DEV@6f36c2f0
2023-03-01 10:54:11,027 INFO  [io.qua.arc.pro.IndexClassLookupUtils] (build-48) Class for name: javax.enterprise.util.AnnotationLiteral was not found in Jandex index. Please ensure the class is part of the index.
2023-03-01 10:54:11,028 WARN  [io.qua.arc.pro.BeanArchives] (build-48) Failed to index org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider: Class does not exist in ClassLoader QuarkusClassLoader:Deployment Class Loader: DEV@6f36c2f0
2023-03-01 10:54:11,029 INFO  [io.qua.arc.pro.IndexClassLookupUtils] (build-48) Class for name: org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider was not found in Jandex index. Please ensure the class is part of the index.

2023-03-01 10:54:12,289 WARN  [io.qua.dep.ste.ClassTransformingBuildStep] (build-43) Could not remove configured resources from the following artifacts as they were not found in the model: [org.keycloak:keycloak-admin-client::jar]
__  ____  __  _____   ___  __ ____  ______ 
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/   

2023-03-01 10:54:14,277 INFO  [org.apa.myf.web.MyFacesContainerInitializer] (Quarkus Main Thread) Using org.apache.myfaces.webapp.MyFacesContainerInitializer
2023-03-01 10:54:14,279 INFO  [org.omn.ApplicationInitializer] (Quarkus Main Thread) Using OmniFaces version 4.1-SNAPSHOT
2023-03-01 10:54:14,599 INFO  [org.apa.myf.uti.ExternalSpecifications] (Quarkus Main Thread) MyFaces Core Bean Validation support disabled
2023-03-01 10:54:14,613 INFO  [org.apa.myf.uti.ExternalSpecifications] (Quarkus Main Thread) MyFaces Core CDI support enabled
2023-03-01 10:54:14,629 INFO  [org.pri.web.PostConstructApplicationEventListener] (Quarkus Main Thread) Running on PrimeFaces 12.0.0
2023-03-01 10:54:14,650 INFO  [io.und.websockets] (Quarkus Main Thread) UT026005: Adding programmatic server endpoint class org.apache.myfaces.push.EndpointImpl for path /jakarta.faces.push/{channel}
2023-03-01 10:54:14,653 INFO  [org.apa.myf.vie.fac.ViewPoolProcessor] (Quarkus Main Thread) jakarta.faces.FACELETS_REFRESH_PERIOD web config parameter is set to "1". To enable view pooling this param must be set to "-1". View Pooling disabled.
2023-03-01 10:54:14,742 INFO  [org.apa.myf.web.FacesInitializerImpl] (Quarkus Main Thread) MyFaces Core has started, it took [425] ms.

2023-03-01 10:54:15,826 INFO  [io.quarkus] (Quarkus Main Thread) quarkus-webapp 4.4-SNAPSHOT on JVM (powered by Quarkus 3.0.0.Alpha4) started in 6.324s. Listening on: http://localhost:8080
2023-03-01 10:54:15,828 INFO  [io.quarkus] (Quarkus Main Thread) Profile devlocal activated. Live Coding activated.
2023-03-01 10:54:15,828 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [agroal, cdi, config-jdbc, hibernate-orm, jberet, jdbc-postgresql, myfaces, narayana-jta, omnifaces, rest-client-reactive, rest-client-reactive-jackson, resteasy-reactive, resteasy-reactive-jackson, scheduler, servlet, smallrye-context-propagation, smallrye-openapi, swagger-ui, vertx, websockets, websockets-client]
2023-03-01 10:54:29,720 INFO  [io.qua.dep.dev.RuntimeUpdatesProcessor] (vert.x-worker-thread-0) Restarting quarkus due to changes in HomePageBean.class, SensorSiteInformation.class.

2023-03-01 10:54:29,800 INFO  [io.quarkus] (Quarkus Main Thread) quarkus-webapp stopped in 0.078s

2023-03-01 10:54:29,906 INFO  [org.jberet] (build-4) JBERET000030: Resolved job file:/home/okyn/workspaces/workspace_quarkus_poc/quarkus_poc/quarkus-webapp/target/classes/META-INF/batch-jobs/priorityUpdate.xml
2023-03-01 10:54:29,915 INFO  [org.jberet] (build-4) JBERET000030: Resolved job file:/home/okyn/workspaces/workspace_quarkus_poc/quarkus_poc/quarkus-webapp/target/classes/META-INF/batch-jobs/loadTask.xml

2023-03-01 10:54:30,760 WARN  [io.qua.dep.ste.ClassTransformingBuildStep] (build-28) Could not remove configured resources from the following artifacts as they were not found in the model: [org.keycloak:keycloak-admin-client::jar]
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at org.apache.myfaces.core.extensions.quarkus.runtime.spi.QuarkusFactoryFinderProvider.getFactory(QuarkusFactoryFinderProvider.java:72)
    at jdk.internal.reflect.GeneratedMethodAccessor341.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at jakarta.faces.FactoryFinder.getFactory(FactoryFinder.java:220)
    at org.apache.myfaces.context.FacesContextFactoryImpl.<init>(FacesContextFactoryImpl.java:119)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at org.apache.myfaces.core.extensions.quarkus.runtime.spi.QuarkusFactoryFinderProvider.getFactory(QuarkusFactoryFinderProvider.java:72)
    at jdk.internal.reflect.GeneratedMethodAccessor341.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at jakarta.faces.FactoryFinder.getFactory(FactoryFinder.java:220)
    at jakarta.faces.webapp.FacesServlet.init(FacesServlet.java:140)
    at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:118)
    at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:295)
    at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:140)
    at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:585)
    at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:556)
    at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
    at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
    at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$9$1.call(UndertowDeploymentRecorder.java:580)
    at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:598)
    at io.quarkus.undertow.runtime.UndertowDeploymentRecorder.bootServletContainer(UndertowDeploymentRecorder.java:522)
    at io.quarkus.deployment.steps.UndertowBuildStep$build767851419.deploy_2(Unknown Source)
    at io.quarkus.deployment.steps.UndertowBuildStep$build767851419.deploy(Unknown Source)
    at io.quarkus.runner.ApplicationImpl.<clinit>(Unknown Source)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:70)
    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)
Caused by: java.lang.NullPointerException
    at org.apache.myfaces.config.RuntimeConfig.getCurrentInstance(RuntimeConfig.java:121)
    at org.apache.myfaces.application.ApplicationImpl.<init>(ApplicationImpl.java:239)
    at org.apache.myfaces.application.ApplicationFactoryImpl.createAndLogNewApplication(ApplicationFactoryImpl.java:55)
    at org.apache.myfaces.application.ApplicationFactoryImpl.<init>(ApplicationFactoryImpl.java:50)
    ... 47 more
__  ____  __  _____   ___  __ ____  ______ 
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/   

2023-03-01 10:54:31,366 INFO  [org.apa.myf.web.MyFacesContainerInitializer] (Quarkus Main Thread) Using org.apache.myfaces.webapp.MyFacesContainerInitializer
2023-03-01 10:54:31,366 INFO  [org.omn.ApplicationInitializer] (Quarkus Main Thread) Using OmniFaces version 4.1-SNAPSHOT
2023-03-01 10:54:31,818 INFO  [io.quarkus] (Quarkus Main Thread) quarkus-webapp 4.4-SNAPSHOT on JVM (powered by Quarkus 3.0.0.Alpha4) started in 2.014s. Listening on: http://localhost:8080
2023-03-01 10:54:31,818 INFO  [io.quarkus] (Quarkus Main Thread) Profile devlocal activated. Live Coding activated.
2023-03-01 10:54:31,819 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [agroal, cdi, config-jdbc, hibernate-orm, jberet, jdbc-postgresql, myfaces, narayana-jta, omnifaces, rest-client-reactive, rest-client-reactive-jackson, resteasy-reactive, resteasy-reactive-jackson, scheduler, servlet, smallrye-context-propagation, smallrye-openapi, swagger-ui, vertx, websockets, websockets-client]
2023-03-01 10:54:31,819 INFO  [io.qua.dep.dev.RuntimeUpdatesProcessor] (vert.x-worker-thread-0) Live reload total time: 2.749s 
2023-03-01 10:54:31,861 INFO  [org.apa.myf.uti.ExternalSpecifications] (executor-thread-0) MyFaces Core Servlet 6.0 support enabled
2023-03-01 10:54:31,863 WARNING [org.apa.myf.ren.RenderKitFactoryImpl] (executor-thread-0) Unknown RenderKit 'HTML_BASIC'.
2023-03-01 10:54:31,878 ERROR [io.und.req.io] (executor-thread-0) Exception handling request 8cba57a8-fb4a-40cf-8d12-24046f8034cf-1 to /home.xhtml: jakarta.servlet.ServletException
    at jakarta.faces.webapp.FacesServlet.service(FacesServlet.java:255)
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:63)
    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:67)
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:133)
    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:65)
    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.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
    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:247)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:56)
    at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:111)
    at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:108)
    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.call(UndertowDeploymentRecorder.java:602)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:152)
    at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$1.handleRequest(UndertowDeploymentRecorder.java:120)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:284)
    at io.undertow.server.DefaultExchangeHandler.handle(DefaultExchangeHandler.java:18)
    at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$5$1.run(UndertowDeploymentRecorder.java:417)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
    at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
    at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NullPointerException
    at org.apache.myfaces.lifecycle.RestoreViewSupport.isPostback(RestoreViewSupport.java:81)
    at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:133)
    at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:172)
    at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:125)
    at jakarta.faces.webapp.FacesServlet.service(FacesServlet.java:223)
    ... 38 more

Expected behavior

Be able to have a hot reloading working

Actual behavior

When I launch the application in dev mode it works. But, if I modify my code, the hot reloading failed with a NPE (see the stacktrace).

It seems to be something similar to https://github.com/quarkusio/quarkus/issues/8069

How to Reproduce?

No response

Output of uname -a or ver

ubuntu 22

Output of java -version

11.0.16

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.0.0.Alpha4

Build tool (ie. output of mvnw --version or gradlew --version)

maven 3.8.5

Additional information

No response

gsmet commented 1 year ago

Given the NPE is in MyFaces and apparently they don't support Quarkus 3 yet, I'm going to close this one.

nyko29 commented 1 year ago

MyFaces is now supported Quarkus 3 (version 4.0.0-RC5)

gsmet commented 1 year ago

Well, there are extremely weird things such as the warn message about: javax.enterprise.util.AnnotationLiteral and I don't know where it could come from.

I created https://github.com/quarkusio/quarkus/pull/31515 to fix one of the warning but I don't think it's the root of the issue.

Given the NPE is in MyFaces, please report the problem there and if they end up finding out it's a Quarkus issue, we will have more details to fix it.

nyko29 commented 1 year ago

Ok thanks for the warning. Myfaces doesn't have a public issue tracker to report the problem. But You're right this is not according to the stacktrace the right place for now. I know that https://github.com/melloware is working on migrating myfaces/primefaces/omnifaces to Quarkus 3 so I will wait for stable version of Quarkus 3 and the quarkiverse extensions.

Regards

gsmet commented 1 year ago

/cc @melloware for your awareness

melloware commented 1 year ago

Yep i plan on looking into Quarkus3 once I get Quarkus2 fully functional which I am pretty close on having Quarkus2 working in Native Image.

melloware commented 1 year ago

I opened a MyFaces ticket: https://issues.apache.org/jira/browse/MYFACES-4582

nyko29 commented 1 year ago

Ok thanks. So you have the same problem?

melloware commented 1 year ago

Yes I can reproduce it.

melloware commented 1 year ago

This will be fixed in MyFaces 4.0.1. I got to the bottom of the issue.

nyko29 commented 1 year ago

Great news, thanks !

melloware commented 1 year ago

OK MyFaces 4.0.1 is now in Maven Central and this issue is resolved for anyone following this thread.

agoncal commented 1 year ago

Thanks @melloware. Just gave it a try with the quarkus-primefaces extension. quarkus-primefaces uses MyFaces 4.0. So after excluding 4.0 and adding the MyFaces 4.0.1 dependency, it works.

agoncal commented 1 year ago

@melloware my bad. It works without any exclusion with quarkus-primefaces 3.13.0. When you generate a project with https://code.quarkus.io, the version is set to 3.12.4 instead of 3.13.0. You might want to update https://code.quarkus.io

melloware commented 1 year ago

Hmmm it should get updated automatically. Oh it might depend on Quarkus version. If you selected 3.0.0 as that is compiled for 3.1.0.

agoncal commented 1 year ago

Yes, 3.13.0 is now bundled with the latest Quarkus 3.1 in https://code.quarkus.io