0 Replies Latest reply on Aug 29, 2008 12:51 AM by Brian Stansberry

    Depends metadata ignored if no xml file present

    Brian Stansberry Master

      Been working on adding dependencies on the specified HAPartition for clustered EJB2/3 beans (https://jira.jboss.org/jira/browse/JBAS-4952 ) and am seeing an issue with EJB3.

      The way I'm doing this is with a deployer that add an item to the JBossEnterpriseBeanMetaData.getDepends() set for clustered beans. This works fine for EJB2 beans and for EJB3 jars with an xml descriptor. But it doesn't work if there is no xml descriptor.

      I tracked the issue down to this in Ejb3Deployment:

       protected void deployElement(Ejb3HandlerFactory factory, ClassFile cf, InitialContext ctx) throws Exception
       {
       Ejb3Handler handler = factory.createHandler(cf);
       handler.setCtxProperties(unit.getJndiProperties());
      
       if (handler.isEjb() || handler.isJBossBeanType())
       {
       List<Container> containers = handler.getContainers(cf, this);
      


      The handler.getContainers() call is what results in various metadata being converted into annotations on the container, including the conversion of JBossEnterpriseBeanMetaData.getDepends() into @Depends. The annotations are what ultimately drive the creation of MC dependencies.

      The problem is if there's no xml the "if (handler.isEjb() || handler.isJBossBeanType())" test returns false, and the whole thing is short-circuited.

      Besides impacting my particular task, I wonder if this is a general problem -- other types of metadata that deployers might add won't make it onto the annotations that drive actual behavior.