1 2 Previous Next 18 Replies Latest reply on Sep 29, 2008 11:57 AM by alesj Go to original post
      • 15. Re: JBAS-5895; Processing too many classes
        alesj

        Yes, the 'fix' is obvious. :-)

        "adrian@jboss.org" wrote:

        So why don't we just turn it off?

        But since it is not portable behaviour, it would be better for them to fix the packaging anyway.

        I can already see our testsuite going bazooka if we turned this off. ;-)


        • 16. Re: JBAS-5895; Processing too many classes
          wolfc
          • 17. Re: JBAS-5895; Processing too many classes
            alesj

             

            "wolfc" wrote:
            I'm having the same problem here: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4178209#4178209.

            Same in what way?
            I don't see them excluding lib directory.

            It seems their problem is that they actually have lib directory,
            which includes some ejb3 annotated classes,
            which then get picked up by OptAMDD.

            Looks like ear's lib (or whatever user defines as 'lib')
            should be always strictly excluded in annotation scanning visitor?

            • 18. Re: JBAS-5895; Processing too many classes
              alesj

               

              "alesj" wrote:

              Looks like ear's lib (or whatever user defines as 'lib')
              should be always strictly excluded in annotation scanning visitor?

              I've hacked something of the following,
              which I think should/could do the trick:
              public class EarLibExcludeDeployer extends AbstractSimpleVFSRealDeployer<JBossAppMetaData>
              {
               public EarLibExcludeDeployer()
               {
               super(JBossAppMetaData.class);
               setStage(DeploymentStages.POST_CLASSLOADER);
               setOutputs(ResourceFilter.class + ".recurse");
               }
              
               public void deploy(VFSDeploymentUnit unit, JBossAppMetaData jBossAppMetaData) throws DeploymentException
               {
               if (unit.isTopLevel() == false)
               return;
              
               try
               {
               VirtualFile root = unit.getRoot();
               String libDir = jBossAppMetaData.getLibraryDirectory();
               if (libDir == null || libDir.length() == 0) // take 'lib' even on empty
               libDir = "lib";
               VirtualFile lib = root.getChild(libDir);
               if (lib != null)
               {
               ResourceFilter recurseFilter = new UrlExcludeResourceFilter(lib.toURL());
               unit.addAttachment(ResourceFilter.class + ".recurse", recurseFilter, ResourceFilter.class);
               }
               }
               catch (Exception e)
               {
               throw DeploymentException.rethrowAsDeploymentException("Cannot exclude ear's lib.", e);
               }
               }
              
               /**
               * Do exclude based on url.
               */
               private class UrlExcludeResourceFilter implements ResourceFilter
               {
               private URL url;
              
               private UrlExcludeResourceFilter(URL url)
               {
               if (url == null)
               throw new IllegalArgumentException("Null url");
               this.url = url;
               }
              
               public boolean accepts(ResourceContext rc)
               {
               return url.equals(rc.getUrl()) == false;
               }
               }
              }
              

              Where this recurse ResourceFilter would
              then later on be picked up by FilteredAnnotationEnvironmentDeployer.


              1 2 Previous Next