]
Emilio Cuberos commented on WFLY-12806:
---------------------------------------
Finally, the fix was to include the persistence.xml file at
WEB-INF/classes/META-INF/persistence.xml
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
(persistene_unit_name_here) in (war_file_name_here).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 which is present in the
persistence.xml:
{code:java}
@Dependent
public class ProgramRepository extends AbstractRepository<Program> {
@PersistenceContext(unitName = "persistene_unit_name_here")
private EntityManager em;
@Override
EntityManager entityManager() {
return em;
}
}
{code}