[jboss-jira] [JBoss JIRA] (WFLY-12806) Upgrade to Wildfly 17, can't find persistence unit
Emilio Cuberos (Jira)
issues at jboss.org
Tue Nov 19 10:04:00 EST 2019
[ https://issues.jboss.org/browse/WFLY-12806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emilio Cuberos updated WFLY-12806:
----------------------------------
Description:
Hi,
Could you give us some advice? We upgraded from Java 8 / Wildfly 10, to Java 11 and Wildfly 17.
Now the persistence units (attached persistence.xml) are no longer found:
{code:java}
Caused by: java.lang.IllegalArgumentException: WFLYWELD0037: Error injecting persistence unit into CDI managed bean. Can't find a persistence unit named 'healthtrender-core' in deployment healthtrender-cloud-1.0.0.war for injection point private javax.persistence.EntityManager com.hemocue.cloud.repository.UserProfileRepository.em"}}
{code}
Here is an example of class where we inject a persistence-unit called "healthtrender-core" which is present in the persistence.xml:
{code:java}
package com.hemocue.cloud.repository;
import com.hemocue.cloud.entity.user.Program;
import javax.enterprise.context.Dependent;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Dependent
public class ProgramRepository extends AbstractRepository<Program> {
@PersistenceContext(unitName = "healthtrender-core")
private EntityManager em;
@Override
EntityManager entityManager() {
return em;
}
}
{code}
was:
Hi,
Could you give us some advice? We upgraded from Java 8 / Wildfly 10, to Java 11 and Wildfly 17.
Now the persistence units (attached persistence.xml) are no longer found:
{code:java}
Caused by: java.lang.IllegalArgumentException: WFLYWELD0037: Error injecting persistence unit into CDI managed bean. Can't find a persistence unit named 'healthtrender-core' in deployment healthtrender-cloud-1.0.0.war for injection point private javax.persistence.EntityManager com.hemocue.cloud.repository.UserProfileRepository.em"}}
{code}
Here is an example of class where we inject a persistence-unit called "healthtrender-core" which is present in the persistence.xml:
{code:java}
package com.hemocue.cloud.repository;
import com.hemocue.cloud.entity.user.Program;
import javax.enterprise.context.Dependent;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author Ivar Grimstad (ivar.grimstad at gmail.com)
*/
@Dependent
public class ProgramRepository extends AbstractRepository<Program> {
@PersistenceContext(unitName = "healthtrender-core")
private EntityManager em;
@Override
EntityManager entityManager() {
return em;
}
}
{code}
> Upgrade to Wildfly 17, can't find persistence unit
> --------------------------------------------------
>
> Key: WFLY-12806
> URL: https://issues.jboss.org/browse/WFLY-12806
> Project: WildFly
> Issue Type: Bug
> Reporter: Emilio Cuberos
> Assignee: Brian Stansberry
> Priority: Major
> Attachments: persistence.xml
>
>
> Hi,
> Could you give us some advice? We upgraded from Java 8 / Wildfly 10, to Java 11 and Wildfly 17.
> Now the persistence units (attached persistence.xml) are no longer found:
> {code:java}
> Caused by: java.lang.IllegalArgumentException: WFLYWELD0037: Error injecting persistence unit into CDI managed bean. Can't find a persistence unit named 'healthtrender-core' in deployment healthtrender-cloud-1.0.0.war for injection point private javax.persistence.EntityManager com.hemocue.cloud.repository.UserProfileRepository.em"}}
> {code}
> Here is an example of class where we inject a persistence-unit called "healthtrender-core" which is present in the persistence.xml:
> {code:java}
> package com.hemocue.cloud.repository;
> import com.hemocue.cloud.entity.user.Program;
> import javax.enterprise.context.Dependent;
> import javax.persistence.EntityManager;
> import javax.persistence.PersistenceContext;
> @Dependent
> public class ProgramRepository extends AbstractRepository<Program> {
> @PersistenceContext(unitName = "healthtrender-core")
> private EntityManager em;
> @Override
> EntityManager entityManager() {
> return em;
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list