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

Exception with LifecycleFactory.getLifecycle running app via docker #294

Closed
dstutz opened this issue Jul 6, 2023 · 10 comments
Closed

Exception with LifecycleFactory.getLifecycle running app via docker #294

dstutz opened this issue Jul 6, 2023 · 10 comments
Labels
duplicate This issue or pull request already exists

Comments

@dstutz
Copy link

dstutz commented Jul 6, 2023

I was experiencing this same problem running in docker with own application so I came here and checked out the repo (e4f48b2) according to the docs and ran in JVM mode and it worked fine, then did the docker JVM instructions and it deploys ok but as soon as I attempt to access the app (http://localhost:8081/), I get the following error:

2023-07-06 01:47:23,710 ERROR [io.und.req.io] (executor-thread-1) Exception handling request 5817b92f-6a02-458e-9002-063c3c6b3867-1 to /: java.lang.NullPointerException: Cannot invoke "jakarta.faces.lifecycle.LifecycleFactory.getLifecycle(String)" because "lifecycleFactory" is null
        at jakarta.faces.webapp.FacesServlet.init(FacesServlet.java:146)
        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.forceInit(ManagedServlet.java:207)
        at io.undertow.servlet.handlers.ServletChain.forceInit(ServletChain.java:130)
        at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:63)
        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:624)
        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:124)
        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$2.run(UndertowDeploymentRecorder.java:439)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        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:2513)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
        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:833)

I'm running on Windows 10 with Docker Desktop 4.21.0.

@melloware
Copy link
Owner

Interesting this is the code in MyFaces that gets the NPE?

        // Javadoc says: Lifecycle instance is shared across multiple simultaneous requests, it must be implemented in a
        // thread-safe manner.
        // So we can acquire it here once:
        LifecycleFactory lifecycleFactory = (LifecycleFactory)FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
        _lifecycle = lifecycleFactory.getLifecycle(getLifecycleId());
        if (log.isLoggable(Level.FINEST))
        {
            log.finest("init end");
        }

@melloware melloware added the bug Something isn't working label Jul 6, 2023
@melloware
Copy link
Owner

I am actually getting this error in Docker JVM mode: #282

@dstutz
Copy link
Author

dstutz commented Jul 6, 2023

Whew...it's not just me/my machine. It's docker JVM mode for me as well.

@melloware
Copy link
Owner

@dstutz does it happen on a simple Quarkus App with Faces? This project has the added complexity of copying the Java files to display in the UI that normal faces apps wouldn't have.

@dstutz
Copy link
Author

dstutz commented Jul 6, 2023

Now that you mention it, I'm getting a similar error on one file:

2023-07-06 17:43:21,291 SEVERE [org.apa.myf.web.FacesInitializerImpl] (main) An error occured while initializing MyFaces: Unable to get listed resource images\carapace.png from directory  for path  from underlying manager io.undertow.server.handlers.resource.ClassPathResourceManager@6f96dd64: java.lang.RuntimeException: Unable to get listed resource images\carapace.png from directory  for path  from underlying manager io.undertow.server.handlers.resource.ClassPathResourceManager@6f96dd64

Aaand...that's somehow the problem. If I delete that file src/main/resources/META-INF/images/carapace.png, rebuild and deploy, it works. I have a handful of .xhtml and a web.xml in META-INF besides that one image.

I guess it makes sense...both your and my error are from "FacesInitializerImpl" which is throwing an error and I guess not completely initializing so then when you try to access the UI, it pops.

I have another personal app that is working fine deployed but that doesn't have any images or extra files added, that's why I was so annoyed because this project isn't that different.

@melloware
Copy link
Owner

Yeah I need to get it fixed in core Quarkus

@melloware
Copy link
Owner

Also if you build on Linux or WSL2 it works. It seems to only be a problem building on Windows. Can you confirm?

@melloware melloware added duplicate This issue or pull request already exists and removed bug Something isn't working labels Jul 7, 2023
@melloware
Copy link
Owner

Duplicate of #282

@melloware melloware marked this as a duplicate of #282 Jul 7, 2023
@melloware
Copy link
Owner

I submitted a Quarkus Fix: quarkusio/quarkus#34611

@melloware
Copy link
Owner

Confirmed fixed in Quarkus 3.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants