[jboss-jira] [JBoss JIRA] (WFLY-1322) CDI BeanManager (WeldBeanManagerServiceProcessor) needs to be created during Phase.FIRST_MODULE_USE for applications that have JPA classes that are rewritten/enhanced during deployment

Scott Marlow (JIRA) jira-events at lists.jboss.org
Mon May 13 09:45:06 EDT 2013


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

Scott Marlow commented on WFLY-1322:
------------------------------------

Stuart,

What is WeldBeanManagerServiceProcessor trying to do when adding the BeanManager service below?

{code}
final ServiceName beanManagerServiceName = BeanManagerService.serviceName(deploymentUnit);
BeanManagerService beanManagerService = new BeanManagerService(rootBda.getId());
serviceTarget.addService(beanManagerServiceName, beanManagerService).addDependency(weldServiceName,WeldBootstrapService.class, beanManagerService.getWeldContainer()).install();
{code}

I'm confused as it looks like rootBda.getId() might be the top level deployment name but beanManagerServiceName might be a subdeployment name.  I think this means that the underlying bean manager is always based on the top level deployment name, even though the "service name" is sub-deployment based.  Does this mean that we can have many different sub-deployment beanManagerServiceName instances, each referencing the top level deployments shared bean manager?

I'm thinking of changing the PersistenceUnitServiceImpl to always *optionally* depend on a BeanManagerService (in case there is one).  Or, if JPA could detect if the persistence unit is contained in a deployment (or sub-deployment) that is a bean archive, we could add a *required* dependency on the BeanManagerService (from the PU service).  If I'm not sure if the deployment is a bean archive, it might be better to make the PersistenceUnitServiceImpl dependency on BeanManagerService optional.

Any suggestions for which way to have PersistenceUnitServiceImpl depend on BeanManagerService?

Thanks,
Scott
                
> CDI BeanManager (WeldBeanManagerServiceProcessor) needs to be created during Phase.FIRST_MODULE_USE for applications that have JPA classes that are rewritten/enhanced during deployment
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WFLY-1322
>                 URL: https://issues.jboss.org/browse/WFLY-1322
>             Project: WildFly
>          Issue Type: Feature Request
>          Components: CDI / Weld
>    Affects Versions: 8.0.0.Alpha2
>            Reporter: Scott Marlow
>
> The JPA deployment subsystem, needs to pass a (deployment) CDI bean manager instance into the persistence provider, when creating the (container) entity manager factory.  
> If JPA detects that classfile enhancing might be needed for the persistence units classes, the entity manager factory is created during the Phase.FIRST_MODULE_USE phase (so that JPA transformers can be registered before any deployer accesses the deployment classloader).  
> If JPA classfile rewriting is not needed, the entity manager factory is created during the Phase.INSTALL phase.  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list