[jboss-jira] [JBoss JIRA] (WFLY-12806) Upgrade to Wildfly 17, can't find persistence unit

Emilio Cuberos (Jira) issues at jboss.org
Thu Nov 21 04:42:00 EST 2019


    [ https://issues.jboss.org/browse/WFLY-12806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13815490#comment-13815490 ] 

Emilio Cuberos edited comment on WFLY-12806 at 11/21/19 4:41 AM:
-----------------------------------------------------------------

Here is the <datasource> from our standalone.xml


{code:java}
            <datasources>
                <datasource jndi-name="java:jboss/datasources/app_name_here" pool-name="app_name_here">
                    <connection-url>jdbc:postgresql://localhost:5432/hemocue</connection-url>
                    <driver-class>org.postgresql.Driver</driver-class>
                    <driver>postgresql-42.2.8.jar</driver>
                    <security>
                        <user-name>hemocue</user-name>
                        <password>hemocue</password>
                    </security>
                    <validation>
                        <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
                        <background-validation>true</background-validation>
                        <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
                    </validation>
                </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                </drivers>
            </datasources>
{code}



was (Author: emiliocuberos):
Here is the <datasource> from our standalone.xml


{code:java}
            <datasources>
                <datasource jndi-name="java:jboss/datasources/healthtrender" pool-name="healthtrender">
                    <connection-url>jdbc:postgresql://localhost:5432/hemocue</connection-url>
                    <driver-class>org.postgresql.Driver</driver-class>
                    <driver>postgresql-42.2.8.jar</driver>
                    <security>
                        <user-name>hemocue</user-name>
                        <password>hemocue</password>
                    </security>
                    <validation>
                        <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
                        <background-validation>true</background-validation>
                        <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
                    </validation>
                </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                </drivers>
            </datasources>
{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 (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}



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the jboss-jira mailing list