Flavia Rainone [http://community.jboss.org/people/flavia.rainone%40jboss.com] 
replied to the discussion

"Implementing a non-flat deployment for Weld Integration"

To view the discussion, visit: http://community.jboss.org/message/557388#557388

--------------------------------------------------------------
With a temporary workaround to the beanManager issue (simply replaced 
"entry.getKey().getId().equals("flat"))" by 
"entry.getKey().getClass().getName().contains("org.jboss.weld.integration.")") 
I ran into an issue involving the service registry. I'm not sure if this is 
related to the beanManager issue or not, but the problem is that Weld complains 
if a new BDA created by Deployment.loadBDA method has a clean service registry:


DEPLOYMENTS IN ERROR:
  Deployment 
"vfs:///home/fla/Development/projects/jbossas-trunk/testsuite/output/lib/weld-translator.ear_WeldBootstrapBean"
 is in error due to the following reason(s):
org.jboss.weld.exceptions.ForbiddenStateException: WELD-000117 Required service 
org.jboss.weld.injection.spi.EjbInjectionServices has not been specified, 
**ERROR**

    at 
org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1370)
 [:2.2.0.Alpha6]
    at 
org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1316)
 [:2.2.0.Alpha6]



So, I created a workaround to populate the loaded BDA service registry, just to 
see if the error would go away. DeploymentImpl initializes the loaded BDA 
service registry with a copy of the service registries of the BDAs contained in 
the DeploymentImpl (only services added during bootstrap).

This makes WeldNumberguessExampleUnitTestCase to pass, but 
WeldTranslatorExampleUnitTestCase still fails, stating that 
TranslatorControllerBean is ambigously defined:

DEPLOYMENTS IN ERROR:
  Deployment 
"vfs:///home/fla/Development/projects/jbossas-trunkLATEST/testsuite/output/lib/weld-translator.ear_WeldBootstrapBean"
 is in error due to the
following reason(s): org.jboss.weld.exceptions.DeploymentException: WELD-001414 
Bean name is ambiguous. Name translator resolves to beans
[org.jboss.weld.bean-baseclassloa...@62b92dc2{vfs:///home/fla/Development/projects/jbossas-trunkLATEST/build/target/jboss-6.0.0-SNAPSHOT/server/all/deployers/resteasy.deployer}-SessionBean-TranslatorControllerBean,
 
org.jboss.weld.bean-baseclassloa...@7e7186b{vfs:///home/fla/Development/projects/jbossas-trunkLATEST/testsuite/output/lib/weld-translator.ear}-SessionBean-TranslatorControllerBean],
**ERROR**
 
    at 
org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1370)
 [:2.2.0.Alpha6]
    at 
org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1316)
 [:2.2.0.Alpha6]
    at 
org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:968)
 [:2.2.0.Alpha6]
    at 
org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:82)
 [:6.0.0-SNAPSHOT]
    at 
org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.checkComplete(ProfileControllerContext.java:125)
 [:0.1.0.Alpha1]
    at 
org.jboss.profileservice.plugins.deploy.actions.DeploymentStartAction.doPrepare(DeploymentStartAction.java:104)
 [:0.1.0.Alpha1]
    at 
org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.prepare(AbstractTwoPhaseModificationAction.java:100)
 [:0.1.0.Alpha1]
    at 
org.jboss.profileservice.management.ModificationSession.prepare(ModificationSession.java:87)
 [:0.1.0.Alpha1]
    at 
org.jboss.profileservice.management.AbstractActionController.internalPerfom(AbstractActionController.java:234)
 [:0.1.0.Alpha1]


So, the problem is that Weld finds two EjbDescriptors of the same bean. One in 
the BDA that represents weld-translator.ear, included in the corresponding 
DeploymentImpl, and another one in the bda that has been loaded by the 
Deployment, representing resteasy.deployer.

If I still initialize the loaded BDA service registry with a copy of the other 
BDAs service registry, but this time adding a new, clean, JBossEJBServices to 
the loaded BDA serviceRegistry, and putting no EjbInjectionServices in it, I 
get a message complaining that the injection point has unsatisfied dependencies:


DEPLOYMENTS IN ERROR:
  Deployment 
"vfs:///home/fla/Development/projects/jbossas-trunkLATEST/testsuite/output/lib/weld-translator.ear_WeldBootstrapBean"
 is in error due to the following reason(s): 
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Injection point has 
unsatisfied dependencies.  Injection point:  field 
org.jboss.test.deployers.weld.translator.ejb.TranslatorControllerBean.translator; 
 Qualifiers:  [[email protected]()], **ERROR**

    at 
org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1370)
 [:2.2.0.Alpha6]
    at 
org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1316)
 [:2.2.0.Alpha6]



If anybody wants to retrace my steps, there is a  
https://jira.jboss.org/browse/JBAS-8250 patch attached to Jira that can be 
applied to JBoss AS trunk. You can check loadBDA implementation  
http://anonsvn.jboss.org/repos/jbossas/trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/DeploymentImpl.java
 here.

So, what is expected from the ServiceRegistry of a newly created BDA? Should it 
be initialized with some services? Which ones?

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/557388#557388]

Start a new discussion in JBoss Microcontainer Development POJO Server at 
Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2116]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to