2 Replies Latest reply on Sep 9, 2008 7:07 PM by Courtney Couch

    Deployment Handler Problems in seam 2.1.0.BETA1

    Courtney Couch Newbie

      I'm not sure if I'm doing something wrong, but the deployment handler for seam seems to be calling the handle(String s, ClassLoader classLoader) function for resources using WEB-INF/classes as part of the path and a second time without that.


      For example something like:



      public class TestDeploymentHandler implements DeploymentHandler {
      
        public static final String NAME = "TestDeploymentHandler";
      
        private static final LogProvider log = Logging.getLogProvider(TestDeploymentHandler.class);
      
        public String getName() {
            return NAME;
        }
        public void handle(String s, ClassLoader classLoader) {
            log.info(s);
        }
      
         public static TestDeploymentHandler instance() {
              DeploymentStrategy deployment = (DeploymentStrategy) Component.getInstance("deploymentStrategy");
              return (TestDeploymentHandler) deployment.getDeploymentHandlers().get(NAME);
         }
      
      }
      



      and if I have a file in the war file this:


      my.war/WEB-INF/classes/org/test/SomeClass.class


      then I will see a printout like:


      INFO  [TestDeploymentHandler] org/test/SomeClass.class
      INFO  [TestDeploymentHandler] WEB-INF/classes/org/test/SomeClass.class



      so its called twice for every resource.


      This is a problem for package-info.class files as the NamespaceDeploymentHandler crashes when trying to load package-info resources with WEB-INF/classes as part of the package (obviously).  I can hack this fixed by changing in the seam source


      NamespaceDeploymentHandler.java:
      
      41:           if ( name.endsWith("/package-info.class") ) 



      to:


      NamespaceDeploymentHandler.java:
      
      41:           if ( name.endsWith("/package-info.class") && !name.startsWith("WEB-INF")) 




      Is there something awry with how I'm deploying, or is this a problem with 2.1 beta?