users@glassfish.java.net

Re: CDI broken between EJB and JPA modules

From: Sahoo <Sahoo_at_Sun.COM>
Date: Fri, 09 Apr 2010 14:53:28 +0530

glassfish_at_javadesktop.org wrote:
>> Don't call JPA.jar a module. There are only four
>> module types in Java
>> EE: ejb, web, appclient and rar. JPA.jar is a library
>> jar, so if you
>> place it in lib directory of ear file, things should
>> work as well.
>>
>
> My bad. Yes, the JPA jar is a utility jar, not a JEE module.
>
> However, when I separate the JPA.jar and EJB.jar, I can't find any way to package them in the EAR such that CDI will not break.
>
> I've attached two more sample EARs. Here are the results I'm seeing for each:
>
> [b]App with JPA in EAR Root.ear[/b]
>
> - Deployment fails, as follows:
>
> Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Injection point has unsatisfied dependencies. Injection point: field sample.service.UserService.userDao; Qualifiers: [@javax.enterprise.inject.Default()]
> at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:276)
> at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:122)
> at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:141)
> at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:331)
> at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:317)
> at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:399)
> at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:178)
> ... 65 more
>
>
This is expected. Don't package library jar outside lib dir.
> [b]App with JPA in EAR Lib.ear[/b]
>
> - Deployment succeeds, but in Admin Console > Applications, the Engines column shows only "[ejb, webservices, weld]" (note lack of "jpa")
>
> - Running fails, as follows:
>
> Caused by: java.lang.NullPointerException
> at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
> at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:1171)
> at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:132)
> at org.glassfish.weld.services.JCDIServiceImpl.injectEJBInstance(JCDIServiceImpl.java:135)
> at com.sun.ejb.containers.BaseContainer.injectEjbInstance(BaseContainer.java:1604)
> at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:487)
> ... 72 more
>
>
This does look like a bug. Can you report it under ejb subcategory?
Let's start with ejb dev looking into it. I am sure it will end up in
cdi subcategory as I believe the bug is in cdi integration layer.

Thanks,
Sahoo