4 Replies Latest reply on Jul 1, 2009 10:54 AM by jaikiran pai

    Filtering non-EJB3 deployments in the EJB3 deployer

    Alexey Loubyansky Master

      Currently it's done like this

      public void deploy(VFSDeploymentUnit unit, JBossMetaData metaData) throws DeploymentException
       {
       try
       {
       // Pickup any deployment which doesn't have metaData or metaData with ejbVersion unknown or 3
       if(metaData != null && (metaData.isEJB2x() || metaData.isEJB1x()))
       {
       log.debug("Ignoring legacy EJB deployment " + unit);
       return;
       }
      ...


      The problem with this is that if an ejb-jar.xml does not include any namespace (i.e. based on DTD) isEJB2x(), isEJB1x(), isEJB3x() will all return false.
      Actually, the absence of ejbVersion should mean EJB2/EJB1 deployment because only these are allowed to use DTD.
      ejb-jar_2_1.xsd and ejb-jar_3_0.xsd both define *required* and *fixed* attribute version with values 2.1 and 3.0 respectively.
      So, any EJB3 deployment will have a non-null ejbVersion and isEJB3x() will return true.
      So, I am going to change the "if" above to
      if(metaData != null && !metaData.isEJB3x())
       {
       log.debug("Ignoring legacy EJB deployment " + unit);
       return;
       }