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

    Deployment Handler Problems in seam 2.1.0.BETA1

    courtneycouch

      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?



        • 1. Re: Deployment Handler Problems in seam 2.1.0.BETA1
          courtneycouch

          the statement so its called twice for every resource. was a bit imprecise.


          Its only called twice for resources in WEB-INF.  WEB-INF seems to be scanned first and deployment handlers are called, then the war root is scanned and WEB-INF is recursed (even though it was already scanned).


          It seems that WEB-INF should be ignored when scanning the war root?


          • 2. Re: Deployment Handler Problems in seam 2.1.0.BETA1
            courtneycouch

            I changed:


            org.jboss.seam.deployment.URLScanner
            
            136:         if ( child.isDirectory())



            to:


            org.jboss.seam.deployment.URLScanner
            
            136:        if ( child.isDirectory() && !newPath.equals("WEB-INF/classes"))



            and there are no more deployment errors, and the WEB-INF/classes is not processed twice.


            I'm still not sure if this is a bug, or I'm hacking away at seam to fix a stupid configuration error on my part.


            -C