3 Replies Latest reply on Aug 28, 2009 5:44 AM by Heiko Braun

    ClassLoaderFactory and AbstractVFSDeployment

    Heiko Braun Master

      I am trying to do an in-memory deployment of a web service endpoint. The WS impl. class is created through javassist, and hence I need to pass a classloader into the deployment. One way of doing so seems to be the ClassLoaderFactory attachment, although not recommended.

      When I create a VFS based deployment (based on AbstactVFSDeployment) and attach a ClassLoaderFactory, I can see the factory being exectued however it runs into an execption later on:

      Caused by: java.lang.IllegalStateException: ClassLoader has not been constructed for vfsfile:/Users/hbraun/riftsaw-dd3568c
       at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.visit(VFSDeploymentClassLoader
       at org.jboss.deployers.vfs.plugins.annotations.FilteredAnnotationEnvironmentDeployer.visitModule(FilteredAnnotatio
       ... 31 more

      I've verified the the DeploymentUnit has a classloader association after the factory is being invoked.

      If I do use an AbstractDeployment and provide StructureMetaData manually it works.

      What is that I am missing here?

        • 1. Re: ClassLoadingFactory and AbstractVFSDeployment
          Ales Justin Master

          The code that sets CL to Module is not invoked in AbstractLevelClassLoaderSystemDeployer,
          as you're bypassing it by providing your own CLF in AbstractClassLoaderDeployer.

          You should bypass AEDeployer by providing proper filter in DU.
          Similar to what we do here:

           <bean name="DeploymentProvidedDUFilter" class="org.jboss.deployment.DeploymentProvidedDeploymentUnitFilter" />
           <bean name="GenScanDeployer" class="org.jboss.deployers.vfs.plugins.annotations.FilteredAnnotationEnvironmentDeployer">
           <property name="filter">
           <bean class="org.jboss.deployment.ListDeploymentUnitFilter">
           <property name="filters">
           <inject bean="DeploymentProvidedDUFilter" />
           <inject bean="JBossMetaDataDUFilter"/>
           <inject bean="ScanningMetaDataDUFilter"/>
           <inject bean="JBossCustomDeployDUFilter"/>

          - http://anonsvn.jboss.org/repos/jbossas/branches/Branch_5_x/server/src/main/org/jboss/deployment/DeploymentProvidedDeploymentUnitFilter.java

          • 2. Re: ClassLoaderFactory and AbstractVFSDeployment
            Heiko Braun Master

            Thanks for the quick response. Which deployer should I bypass by providing a filter? Looking at the xml example it seems to be a filter per deployer. But the DeploymentProvidedDeploymentUnitFilter is attached to the DU. I don't get it. How should the filter be assigned to skip certain deployers? Can you give me another example?

            • 3. Re: ClassLoaderFactory and AbstractVFSDeployment
              Heiko Braun Master

              OK, I get it. Since 5.1.0 it already configured to look for DeploymentUnitFilter attachments on the FilteredAnnotationEnvironmentDeployer. Makes sense. I'll give it try.