[jira] [Commented] (DELTASPIKE-1301) java.lang.IllegalStateException,message=Could not find EntityManager with default qualifier.
[ https://issues.apache.org/jira/browse/DELTASPIKE-1301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16257226#comment-16257226 ] John D. Ament commented on DELTASPIKE-1301: --- You mentioned this in a prior comment: {code} 13:13:22,225 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /path/: org.jboss.resteasy.spi.UnhandledException: javax.persistence.TransactionRequiredException: WFLYJPA0060: Transaction is required to perform this operation (either use a transaction or extended persistence context) {code} Is it in fact that exception? Because that's a different issue. > java.lang.IllegalStateException,message=Could not find EntityManager with > default qualifier. > > > Key: DELTASPIKE-1301 > URL: https://issues.apache.org/jira/browse/DELTASPIKE-1301 > Project: DeltaSpike > Issue Type: Bug > Components: Data-Module >Affects Versions: 1.8.0 > Environment: Wildfly 10.1.0, Ubuntu 16.04 >Reporter: Nicolas Duminil > > Hello, > I have the following data-module repository: > {code} > @Repository > public interface CustomerManagementRepository extends > EntityRepository > { > ... > } > {code} > This repository is called from a stateless session bean, as follows: > {code} > @Inject > private CustomerManagementRepository repo; > > public List findByFirsName(String firstName) > { > return repo.findByFirsName(firstName); > } > {code} > The following CDI producer is provided as well: > {code} > public class EntityManagerProducer > { > @PersistenceContext > private EntityManager em; > @Produces > public EntityManager createEntityManager() > { > return em; > } > } > {code} > When calling the staeless bean from a JAX-RS service, as follows: > {code} > @EJB > private CustomerManagementFacade facade; > @POST > @Consumes(MediaType.APPLICATION_JSON) > public Response createCustomer(Customer customer) > { > Customer newCustomer = facade.saveAndFlushAndRefresh(customer); > return Response.created(URI.create("/customers/" + > newCustomer.getId())).build(); > } > {code} > the following exception is raised: > {code} > 15:48:14,914 ERROR [org.jboss.as.ejb3.invocation] (default task-1) > WFLYEJB0034: EJB Invocation failed on component CustomerManagementFacade for > method public fr.simplex_software.customer_management.data.Customer > fr.simplex_software.customer_management.facade.CustomerManagementFacade.saveAndFlushAndRefresh(fr.simplex_software.customer_management.data.Customer): > javax.ejb.EJBException: > org.apache.deltaspike.data.api.QueryInvocationException: Exception calling > Repository: [Repository=class > fr.simplex_software.customer_management.repository.CustomerManagementRepository$$DSPartialBeanProxy,method=saveAndFlushAndRefresh],exception=class > java.lang.IllegalStateException,message=Could not find EntityManager with > default qualifier. > {code} > What seems to happen is that the CDI producer doesn't get called. Do I do > anything wrong here ? Please don't send me links to the documentation 'cause > I've read it before posting. > Many thanks in advance, > Nicolas > P.S. I have the following in apache-deltaspike.properties: > {code} > globalAlternatives.org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy=org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Comment Edited] (DELTASPIKE-1301) java.lang.IllegalStateException,message=Could not find EntityManager with default qualifier.
[ https://issues.apache.org/jira/browse/DELTASPIKE-1301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16256952#comment-16256952 ] Nicolas Duminil edited comment on DELTASPIKE-1301 at 11/17/17 1:22 PM: --- Do you mean this ? public class EntityManagerProducer { @PersistenceContext(unitName="customers") private EntityManager em; @Produces @Dependent public EntityManager createEntityManager() { return em; } } Cause if this is what you mean, than it doesn't change anything, the same exception is raised: was (Author: nicolasduminil): Do you mean this ? @ApplicationScoped public class EntityManagerProducer { @PersistenceContext(unitName="customers") private EntityManager em; @Produces @Dependent public EntityManager createEntityManager() { return em; } } Cause if this is what you mean, than it doesn't change anything, the same exception is raised: 13:13:22,225 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /customer-management/services/customers: org.jboss.resteasy.spi.UnhandledException: javax.persistence.TransactionRequiredException: WFLYJPA0060: Transaction is required to perform this operation (either use a transaction or extended persistence context) > java.lang.IllegalStateException,message=Could not find EntityManager with > default qualifier. > > > Key: DELTASPIKE-1301 > URL: https://issues.apache.org/jira/browse/DELTASPIKE-1301 > Project: DeltaSpike > Issue Type: Bug > Components: Data-Module >Affects Versions: 1.8.0 > Environment: Wildfly 10.1.0, Ubuntu 16.04 >Reporter: Nicolas Duminil > > Hello, > I have the following data-module repository: > {code} > @Repository > public interface CustomerManagementRepository extends > EntityRepository > { > ... > } > {code} > This repository is called from a stateless session bean, as follows: > {code} > @Inject > private CustomerManagementRepository repo; > > public List findByFirsName(String firstName) > { > return repo.findByFirsName(firstName); > } > {code} > The following CDI producer is provided as well: > {code} > public class EntityManagerProducer > { > @PersistenceContext > private EntityManager em; > @Produces > public EntityManager createEntityManager() > { > return em; > } > } > {code} > When calling the staeless bean from a JAX-RS service, as follows: > {code} > @EJB > private CustomerManagementFacade facade; > @POST > @Consumes(MediaType.APPLICATION_JSON) > public Response createCustomer(Customer customer) > { > Customer newCustomer = facade.saveAndFlushAndRefresh(customer); > return Response.created(URI.create("/customers/" + > newCustomer.getId())).build(); > } > {code} > the following exception is raised: > {code} > 15:48:14,914 ERROR [org.jboss.as.ejb3.invocation] (default task-1) > WFLYEJB0034: EJB Invocation failed on component CustomerManagementFacade for > method public fr.simplex_software.customer_management.data.Customer > fr.simplex_software.customer_management.facade.CustomerManagementFacade.saveAndFlushAndRefresh(fr.simplex_software.customer_management.data.Customer): > javax.ejb.EJBException: > org.apache.deltaspike.data.api.QueryInvocationException: Exception calling > Repository: [Repository=class > fr.simplex_software.customer_management.repository.CustomerManagementRepository$$DSPartialBeanProxy,method=saveAndFlushAndRefresh],exception=class > java.lang.IllegalStateException,message=Could not find EntityManager with > default qualifier. > {code} > What seems to happen is that the CDI producer doesn't get called. Do I do > anything wrong here ? Please don't send me links to the documentation 'cause > I've read it before posting. > Many thanks in advance, > Nicolas > P.S. I have the following in apache-deltaspike.properties: > {code} > globalAlternatives.org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy=org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (DELTASPIKE-1301) java.lang.IllegalStateException,message=Could not find EntityManager with default qualifier.
[ https://issues.apache.org/jira/browse/DELTASPIKE-1301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16256952#comment-16256952 ] Nicolas Duminil commented on DELTASPIKE-1301: - Do you mean this ? @ApplicationScoped public class EntityManagerProducer { @PersistenceContext(unitName="customers") private EntityManager em; @Produces @Dependent public EntityManager createEntityManager() { return em; } } Cause if this is what you mean, than it doesn't change anything, the same exception is raised: 13:13:22,225 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /customer-management/services/customers: org.jboss.resteasy.spi.UnhandledException: javax.persistence.TransactionRequiredException: WFLYJPA0060: Transaction is required to perform this operation (either use a transaction or extended persistence context) > java.lang.IllegalStateException,message=Could not find EntityManager with > default qualifier. > > > Key: DELTASPIKE-1301 > URL: https://issues.apache.org/jira/browse/DELTASPIKE-1301 > Project: DeltaSpike > Issue Type: Bug > Components: Data-Module >Affects Versions: 1.8.0 > Environment: Wildfly 10.1.0, Ubuntu 16.04 >Reporter: Nicolas Duminil > > Hello, > I have the following data-module repository: > {code} > @Repository > public interface CustomerManagementRepository extends > EntityRepository > { > ... > } > {code} > This repository is called from a stateless session bean, as follows: > {code} > @Inject > private CustomerManagementRepository repo; > > public List findByFirsName(String firstName) > { > return repo.findByFirsName(firstName); > } > {code} > The following CDI producer is provided as well: > {code} > public class EntityManagerProducer > { > @PersistenceContext > private EntityManager em; > @Produces > public EntityManager createEntityManager() > { > return em; > } > } > {code} > When calling the staeless bean from a JAX-RS service, as follows: > {code} > @EJB > private CustomerManagementFacade facade; > @POST > @Consumes(MediaType.APPLICATION_JSON) > public Response createCustomer(Customer customer) > { > Customer newCustomer = facade.saveAndFlushAndRefresh(customer); > return Response.created(URI.create("/customers/" + > newCustomer.getId())).build(); > } > {code} > the following exception is raised: > {code} > 15:48:14,914 ERROR [org.jboss.as.ejb3.invocation] (default task-1) > WFLYEJB0034: EJB Invocation failed on component CustomerManagementFacade for > method public fr.simplex_software.customer_management.data.Customer > fr.simplex_software.customer_management.facade.CustomerManagementFacade.saveAndFlushAndRefresh(fr.simplex_software.customer_management.data.Customer): > javax.ejb.EJBException: > org.apache.deltaspike.data.api.QueryInvocationException: Exception calling > Repository: [Repository=class > fr.simplex_software.customer_management.repository.CustomerManagementRepository$$DSPartialBeanProxy,method=saveAndFlushAndRefresh],exception=class > java.lang.IllegalStateException,message=Could not find EntityManager with > default qualifier. > {code} > What seems to happen is that the CDI producer doesn't get called. Do I do > anything wrong here ? Please don't send me links to the documentation 'cause > I've read it before posting. > Many thanks in advance, > Nicolas > P.S. I have the following in apache-deltaspike.properties: > {code} > globalAlternatives.org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy=org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)