[JBoss JIRA] (WFLY-13498) @ApplicationScoped Bean Not Eagerly Instantiated on Wildfly 16
by Matěj Novotný (Jira)
[ https://issues.redhat.com/browse/WFLY-13498?page=com.atlassian.jira.plugi... ]
Matěj Novotný commented on WFLY-13498:
--------------------------------------
[~fearghalom] so I tried to reproduce this within Weld testsuite; [here is the test|https://github.com/manovotn/core/blob/wfly13498/tests-arquillian/src...] (I can provide info on how to execute that on wfly if needed).
As you can see from the {{@Deployment}} section of the test, it is a simple WAR with a library and observers listening for {{(a)Initialized(ApplicationScoped.class)}} in both. That should be exactly your case. What I am seeing is that both, WAR and its lib, *are receiving event notifications* for {{Object}} and even for {{ServletContext}}.
I was apparently wrong there and in this scenario, even the lib will receive the {{ServletContext}} event (with a context path from the web app itself).
Either way, I am unable to reproduce your scenario, can you put together some reproducer/test where this would manifest?
> @ApplicationScoped Bean Not Eagerly Instantiated on Wildfly 16
> --------------------------------------------------------------
>
> Key: WFLY-13498
> URL: https://issues.redhat.com/browse/WFLY-13498
> Project: WildFly
> Issue Type: Bug
> Components: CDI / Weld
> Affects Versions: 16.0.0.Final
> Reporter: Fearghal O Maolcatha
> Assignee: Matěj Novotný
> Priority: Major
>
> I have an @ApplicationScoped bean that I want to be instantiated on application startup (see sample code below). I've registered for the servlet context initialization event but the init method is never invoked. The FactoryLocator is contained in a jar within my war's WEB-INF/lib directory. This same code was working on Wildfly 9 but no longer works after upgrading to Wildfly 16.
> {code:java}
> import javax.enterprise.context.ApplicationScoped;
> import javax.enterprise.context.Initialized;
> import javax.enterprise.event.Observes;
> import javax.servlet.ServletContext;
> @ApplicationScoped
> public class FactoryLocator {
> public FactoryLocator() {
> System.out.println("In the constructor.........................");
> }
> private void init(@Observes @Initialized(ApplicationScoped.class) ServletContext sc) {
> System.out.println("Invoking the event observer method..................");
> }
> }
> {code}
> One workaround I discovered was to extract the contents of the jars in my war's WEB-INF/lib/ directory to my war's WEB-INF/classes directory. When I did this my FactorLocator bean was instantiated successfully. I'd prefer not to have to do this.
> After debugging through the war's deployment, I noticed that the ServletContext is initialized before all the beans in the war's lib directory are processed (org.jboss.weld.bootstrap.BeanDeploymentModules:processBeanDeployments). The war's module is not aware of all observers until all the beans are processed. However, the ServletContextEvent is fired before all the observers are known.
> Should this happen that ServletContext is created before all observers are known about? I've debugged one of the Wildfly QuickStart applications and the ServletContext isn't created until all bean deployments are processed and the code below is executed successfully. Is the order in which this happens supposed to be guaranteed?
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (WFLY-13502) UT000010: Session is invalid
by Cristian VL (Jira)
[ https://issues.redhat.com/browse/WFLY-13502?page=com.atlassian.jira.plugi... ]
Cristian VL updated WFLY-13502:
-------------------------------
Steps to Reproduce:
It happens randomly from time to time.
I am using Weld with JSP/Servlets.
Sessions are created and invalidate on ServletRequestListener (requestInitialized/requestDestroyed)
was:
It happens randomly from time to time.
Sessions are created and invalidate on ServletRequestListener (requestInitialized/requestDestroyed)
> UT000010: Session is invalid
> -----------------------------
>
> Key: WFLY-13502
> URL: https://issues.redhat.com/browse/WFLY-13502
> Project: WildFly
> Issue Type: Bug
> Components: Web (Undertow)
> Affects Versions: 14.0.0.Final, 16.0.0.Final
> Reporter: Cristian VL
> Assignee: Flavia Rainone
> Priority: Critical
>
> 2020-05-21 06:00:22,239 ERROR [org.jboss.threads.errors] (default task-1145) Thread Thread[default task-1145,5,main] threw an uncaught exception: java.lang.RuntimeException: java.lang.IllegalStateException: UT000010: Session is invalid X0SZbaIu078s8ChCz8YIJON59sTmY7gV2bopjwlm
> at io.undertow.servlet.spec.ServletContextImpl.invokeRunnable(ServletContextImpl.java:1029)
> at io.undertow.servlet.spec.AsyncContextImpl.onAsyncComplete(AsyncContextImpl.java:614)
> at io.undertow.servlet.spec.AsyncContextImpl.access$100(AsyncContextImpl.java:73)
> at io.undertow.servlet.spec.AsyncContextImpl$3.run(AsyncContextImpl.java:316)
> at io.undertow.servlet.spec.AsyncContextImpl$6.run(AsyncContextImpl.java:485)
> at io.undertow.servlet.spec.AsyncContextImpl$TaskDispatchRunnable.run(AsyncContextImpl.java:604)
> at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
> at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
> at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
> at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.IllegalStateException: UT000010: Session is invalid X0SZbaIu078s8ChCz8YIJON59sTmY7gV2bopjwlm
> at io.undertow.server.session.InMemorySessionManager$SessionImpl.getAttribute(InMemorySessionManager.java:512)
> at io.undertow.servlet.spec.HttpSessionImpl.getAttribute(HttpSessionImpl.java:122)
> at org.jboss.weld.module.web.context.http.HttpConversationContextImpl.getSessionAttribute(HttpConversationContextImpl.java:37)
> at org.jboss.weld.module.web.context.http.HttpConversationContextImpl.getSessionAttribute(HttpConversationContextImpl.java:18)
> at org.jboss.weld.contexts.AbstractConversationContext.copyConversationIdGeneratorAndConversationsToSession(AbstractConversationContext.java:179)
> at org.jboss.weld.contexts.AbstractConversationContext.dissociate(AbstractConversationContext.java:157)
> at org.jboss.weld.module.web.servlet.ConversationContextActivator.activateConversationContext(ConversationContextActivator.java:116)
> at org.jboss.weld.module.web.servlet.HttpContextLifecycle.requestInitialized(HttpContextLifecycle.java:254)
> at org.jboss.weld.module.web.servlet.WeldInitialListener.requestInitialized(WeldInitialListener.java:152)
> at io.undertow.servlet.core.ApplicationListeners.requestInitialized(ApplicationListeners.java:246)
> at io.undertow.servlet.spec.AsyncContextImpl.setupRequestContext(AsyncContextImpl.java:706)
> at io.undertow.servlet.spec.AsyncContextImpl.access$700(AsyncContextImpl.java:73)
> at io.undertow.servlet.spec.AsyncContextImpl$7.run(AsyncContextImpl.java:619)
> at io.undertow.servlet.spec.ServletContextImpl$2.call(ServletContextImpl.java:181)
> at io.undertow.servlet.spec.ServletContextImpl$2.call(ServletContextImpl.java:178)
> at io.undertow.servlet.spec.ServletContextImpl.invokeRunnable(ServletContextImpl.java:1027)
> ... 10 more
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (WFLY-13502) UT000010: Session is invalid
by Cristian VL (Jira)
Cristian VL created WFLY-13502:
----------------------------------
Summary: UT000010: Session is invalid
Key: WFLY-13502
URL: https://issues.redhat.com/browse/WFLY-13502
Project: WildFly
Issue Type: Bug
Components: Web (Undertow)
Affects Versions: 16.0.0.Final, 14.0.0.Final
Reporter: Cristian VL
Assignee: Flavia Rainone
2020-05-21 06:00:22,239 ERROR [org.jboss.threads.errors] (default task-1145) Thread Thread[default task-1145,5,main] threw an uncaught exception: java.lang.RuntimeException: java.lang.IllegalStateException: UT000010: Session is invalid X0SZbaIu078s8ChCz8YIJON59sTmY7gV2bopjwlm
at io.undertow.servlet.spec.ServletContextImpl.invokeRunnable(ServletContextImpl.java:1029)
at io.undertow.servlet.spec.AsyncContextImpl.onAsyncComplete(AsyncContextImpl.java:614)
at io.undertow.servlet.spec.AsyncContextImpl.access$100(AsyncContextImpl.java:73)
at io.undertow.servlet.spec.AsyncContextImpl$3.run(AsyncContextImpl.java:316)
at io.undertow.servlet.spec.AsyncContextImpl$6.run(AsyncContextImpl.java:485)
at io.undertow.servlet.spec.AsyncContextImpl$TaskDispatchRunnable.run(AsyncContextImpl.java:604)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: UT000010: Session is invalid X0SZbaIu078s8ChCz8YIJON59sTmY7gV2bopjwlm
at io.undertow.server.session.InMemorySessionManager$SessionImpl.getAttribute(InMemorySessionManager.java:512)
at io.undertow.servlet.spec.HttpSessionImpl.getAttribute(HttpSessionImpl.java:122)
at org.jboss.weld.module.web.context.http.HttpConversationContextImpl.getSessionAttribute(HttpConversationContextImpl.java:37)
at org.jboss.weld.module.web.context.http.HttpConversationContextImpl.getSessionAttribute(HttpConversationContextImpl.java:18)
at org.jboss.weld.contexts.AbstractConversationContext.copyConversationIdGeneratorAndConversationsToSession(AbstractConversationContext.java:179)
at org.jboss.weld.contexts.AbstractConversationContext.dissociate(AbstractConversationContext.java:157)
at org.jboss.weld.module.web.servlet.ConversationContextActivator.activateConversationContext(ConversationContextActivator.java:116)
at org.jboss.weld.module.web.servlet.HttpContextLifecycle.requestInitialized(HttpContextLifecycle.java:254)
at org.jboss.weld.module.web.servlet.WeldInitialListener.requestInitialized(WeldInitialListener.java:152)
at io.undertow.servlet.core.ApplicationListeners.requestInitialized(ApplicationListeners.java:246)
at io.undertow.servlet.spec.AsyncContextImpl.setupRequestContext(AsyncContextImpl.java:706)
at io.undertow.servlet.spec.AsyncContextImpl.access$700(AsyncContextImpl.java:73)
at io.undertow.servlet.spec.AsyncContextImpl$7.run(AsyncContextImpl.java:619)
at io.undertow.servlet.spec.ServletContextImpl$2.call(ServletContextImpl.java:181)
at io.undertow.servlet.spec.ServletContextImpl$2.call(ServletContextImpl.java:178)
at io.undertow.servlet.spec.ServletContextImpl.invokeRunnable(ServletContextImpl.java:1027)
... 10 more
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (WFLY-13295) REST-AT inbound bridge is not activated for EJB without TransactionalManagement annotation
by Ondrej Chaloupka (Jira)
[ https://issues.redhat.com/browse/WFLY-13295?page=com.atlassian.jira.plugi... ]
Ondrej Chaloupka commented on WFLY-13295:
-----------------------------------------
[~brian.stansberry] yes, agree. I created PR with the WFLY part and tests here: https://github.com/wildfly/wildfly/pull/13315
> REST-AT inbound bridge is not activated for EJB without TransactionalManagement annotation
> ------------------------------------------------------------------------------------------
>
> Key: WFLY-13295
> URL: https://issues.redhat.com/browse/WFLY-13295
> Project: WildFly
> Issue Type: Bug
> Components: Transactions
> Affects Versions: 19.0.0.Final
> Reporter: Ondrej Chaloupka
> Assignee: Ondrej Chaloupka
> Priority: Major
> Fix For: 20.0.0.Final
>
>
> The REST-AT inbound bridge is activated per deployment. It's activated for a deployment which contains a REST endpoint identified with `@Path` annotation where in the same class has to be included either annotation `@Transactional` or `@TransactionAttribute`.
> The point is to activate the inbound bridge for deployments which contain a transactional managed method (CDI or EJB) which can receive the txn context, ie. possibly a context of REST-AT transaction as well.
> The issue is that EJB beans are transactional by default. The EJB bean class does not need to specify any `@TransactionalAttribute` to be already container managed (from txn perspective) with attribute `REQUIRED`. Which means taking incoming txn context and will work with it.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month