[jboss-jira] [JBoss JIRA] (WFLY-9516) JPA deployer adding cross sub deployment dependencies when multiple persistence units deployed

Scott Marlow (JIRA) issues at jboss.org
Wed Nov 15 15:42:00 EST 2017


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

Scott Marlow edited comment on WFLY-9516 at 11/15/17 3:41 PM:
--------------------------------------------------------------

[~bmaxwell] to ensure that the persistence unit is available to the started EJBs, during application deployment, we add an internal service dependency from the EJB component(s) to the persistence unit(s), so the EJB will not start until the persistence unit has started.  

With persistence units defined in multiple ejb (sub) modules and initialize-in-order=true, we are going to get into trouble as we are only starting one ejb jar module at a time but adding dependencies from the ejb jar module on all of the persistence units defined in other modules.

{quote}
"jboss.deployment.subunit.\"reproducer-ear-0.1.ear\".\"reproducer-ejb.jar\".component.StatelessBean1.START is missing [jboss.persistenceunit.\"reproducer-ear-0.1.ear/reproducer-ejb2.jar#pu2\"]"
{quote}

Regarding what is at the top level of the EAR, ejb modules  are sub-deployments.  A jar with persistence.xml in ear/lib is at the top level of EAR deployment.

An application workaround, could be to move the persistence unit definitions to (non-ejb) jars in ear/lib.

A (possible) fix could be:
* Introduce a persistence unit hint to change our deployment code (JPA/Weld) to not add component dependencies on persistence units contained by other subdeployments.
* Or change our deployment code (JPA/WELD) to not add component dependencies on persistence units contained by other subdeployments if the initialize-in-order=true.



was (Author: smarlow):
[~bmaxwell] to ensure that the persistence unit is available to the started EJBs, during application deployment, we add an internal service dependency from the EJB component(s) to the persistence unit(s), so the EJB will not start until the persistence unit has started.  

With persistence units defined in multiple ejb (sub) modules and initialize-in-order=true, we are going to get into trouble as we are only starting one ejb jar module at a time but adding dependencies from the ejb jar module on all of the persistence units defined in other modules.

{quote}
"jboss.deployment.subunit.\"reproducer-ear-0.1.ear\".\"reproducer-ejb.jar\".component.StatelessBean1.START is missing [jboss.persistenceunit.\"reproducer-ear-0.1.ear/reproducer-ejb2.jar#pu2\"]"
{quote}

Regarding what is at the top level of the EAR, ejb modules  are sub-deployments.  A jar with persistence.xml in ear/lib is at the top level.

An application workaround, could be to move the persistence unit definitions to (non-ejb) jars in ear/lib.

A (possible) fix could be:
* Introduce a persistence unit hint to change our deployment code (JPA/Weld) to not add component dependencies on persistence units contained by other subdeployments.
* Or change our deployment code (JPA/WELD) to not add component dependencies on persistence units contained by other subdeployments if the initialize-in-order=true.


> JPA deployer adding cross sub deployment dependencies when multiple persistence units deployed
> ----------------------------------------------------------------------------------------------
>
>                 Key: WFLY-9516
>                 URL: https://issues.jboss.org/browse/WFLY-9516
>             Project: WildFly
>          Issue Type: Bug
>          Components: JPA / Hibernate
>    Affects Versions: 11.0.0.Final
>            Reporter: Brad Maxwell
>            Assignee: Scott Marlow
>
> If an ear contains two EJB sub deployments which each contain a Persistence Unit and a Stateless EJB which injects the PU that is in its jar using @PersistenceContext.  There is a dependency being added where in the Stateless EJB from one deployment depends on the PU from the other jar.  It appears this is happening after this bug fix WFLY-1531
> {code}
> app.ear
>  - ejb-with-pu1.jar
>  - ejb-with-pu2.jar
> {code}



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list