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

ContextNotActiveException on StartupEvent listener #867

Closed
markeastman opened this issue Feb 12, 2019 · 0 comments
Closed

ContextNotActiveException on StartupEvent listener #867

markeastman opened this issue Feb 12, 2019 · 0 comments
Labels
kind/bug Something isn't working
Milestone

Comments

@markeastman
Copy link

I have an application with the JPA enabled and I want to pre-populate the database prior to the web pages becoming active. I added an event listener and within the StartupEvent listener onStart(@observes StartupEvent event) I invoked EntityManager functions. The EntityManager has been Injected. At runtime the startup method is invoked but I get the following exception:
Caused by: javax.enterprise.context.ContextNotActiveException
at org.jboss.protean.arc.RequestContext.get(RequestContext.java:50)
at org.jboss.shamrock.jpa.runtime.TransactionEntityManagers_ClientProxy.delegate(Unknown Source)
at org.jboss.shamrock.jpa.runtime.TransactionEntityManagers_ClientProxy.getEntityManager(Unknown Source)
at org.jboss.shamrock.jpa.runtime.JPAResourceReferenceProvider$1.delegate(JPAResourceReferenceProvider.java:54)
at org.jboss.shamrock.jpa.runtime.entitymanager.ForwardingEntityManager.persist(ForwardingEntityManager.java:43)

I need a way to know that the application is ready, is a startup event that is involved after all the other framework mechanics have completed

@Sanne Sanne closed this as completed in f645cbb Feb 13, 2019
Sanne added a commit that referenced this issue Feb 13, 2019
Fixes #867 Make sure then entity manager works when no request scope …
@cescoffier cescoffier added the kind/bug Something isn't working label Feb 14, 2019
@cescoffier cescoffier added this to the 0.9.0 milestone Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants