1 Reply Latest reply on Nov 24, 2008 4:57 PM by Adrian Brock

    Unrecognised deployments

    Adrian Brock Master

      We need to come up with a fix for the problem
      that I mentioned on a different thread (I think in the user forums since I can't find it?)

      Basically what is happening is if I add a
      file to the deploy directory it is getting deployed and it is marked as being
      processed because the default classloading rules deployer is adding a
      ClassLoadingMetaData as an attachment
      which goes through this processing in AbstractDeploymentContext

       public Object addAttachment(String name, Object attachment)
       DeploymentContext deploymentContext = getDeploymentContext();
       deploymentContext.deployed(); // HERE THIS MARKS IT AS DEPLOYED
       return deploymentContext.getTransientAttachments().addAttachment(name, attachment);

      In principle the simplest fix would be to just remove that line (and some others
      related to transient attachment retrieval), except this change:
      modified the logic to include an invalid check for whether the deployment
      reached the DEPLOYED state.
      It will reach that state unless a deployer throws an error.

      But even then, I don't think it is as simple as it was before.
      e.g. you can now have a deployment that is correctly deployed without any
      TransientManagedObjects, e.g. if it is only scanned for annotations.

      There's also a few places now that invoke methods on the DeploymentUnit
      that would actually make it deployed anyway. e.g. AOP always asking for the classloader.

      If you add to that the hack (which I can't find anymore?) that used to let
      .jar files get through the isDeployed() check
      this whole area has become a lot more complicated. :-)

        • 1. Re: Unrecognised deployments
          Adrian Brock Master

          One potential solution would be to rework this based on the
          TrackingMutableAttachments that I added for management purposes
          (so you could see which deployers were creating attachments).

          It would need extending to include who referenced the predetermined attachments
          and you've still got the issues of trying to workout the ClassLoadingMetaData
          is only a default rule and letting plain jar files through that just create classloaders.

          But its probably a lot less error prone than the isDeployed() handling
          with the deployed() invocations that is currently broken now.