3 Replies Latest reply on Nov 9, 2007 9:07 AM by Adrian Brock

    Deployment.types not propagated

    Thomas Diesler Master

      http://jira.jboss.com/jira/browse/JBAS-4940

      [tdiesler@tddell trunk]$ ant -Dtest=org.jboss.test.ws.jaxws.jbws1762.packaged_jar_ejb3.Iteration1TestCase one-test
      
      Caused by: java.lang.IllegalStateException: Endpoint already registered: jboss.ws:context=jaxws-jbws1762-packaged,endpoint=EJB3Bean
       at org.jboss.wsf.framework.management.DefaultEndpointRegistry.register(DefaultEndpointRegistry.java:89)
       at org.jboss.wsf.framework.management.ManagedEndpointRegistry.register(ManagedEndpointRegistry.java:59)
       at org.jboss.wsf.framework.deployment.EndpointRegistryDeploymentAspect.create(EndpointRegistryDeploymentAspect.java:46)
       at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.deploy(DeploymentAspectManagerImpl.java:115)
       at org.jboss.wsf.container.jboss50.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:95)
       at org.jboss.wsf.container.jboss50.AbstractWebServiceDeployer.deploy(AbstractWebServiceDeployer.java:63)
      


      The WebAppDeploymentAspect adds a type string like this

       org.jboss.deployers.client.spi.Deployment deployment = createDeployment(warURL);
      
       // Mark the deployment as generated web app
       // so the JSE deployer hook can ignore it
       Set<String> types = deployment.getTypes();
       if (types == null)
       {
       types = new HashSet<String>();
       deployment.setTypes(types);
       }
       types.add(WebAppDesciptorModifier.PROPERTY_GENERATED_WEBAPP);
      


      During deployment of the above using this code

       public boolean isWebServiceDeployment(DeploymentUnit unit)
       {
       JBossWebMetaData webMetaData = unit.getAttachment(JBossWebMetaData.class);
       boolean isGenerated = unit.getTypes().contains(WebAppDesciptorModifier.PROPERTY_GENERATED_WEBAPP);
       return isGenerated == false && webMetaData != null;
       }
      


      isGenerated is always false.


        • 1. Re: Deployment.types not propagated
          Adrian Brock Master

          You're doing it wrong. :-)

          The types shouldn't even be on the deployment (I agreed this with Scott before)
          but it obviously hasn't been removed from the api yet. :-)

          The types should be part of the ManagedObject stuff for the profile service
          such that the console can sort the deployments into categories.

          Instead, you should add a marker into the attachments of the deployment.

          • 2. Re: Deployment.types not propagated
            Thomas Diesler Master

            With the current API it seems the attachments that I get from

            org.jboss.deployers.client.spi.Deployment.getPredeterminedManagedObjects()

            are read only.

            Please show me the correct usage of a client using attachments

            • 3. Re: Deployment.types not propagated
              Adrian Brock Master

               

              "thomas.diesler@jboss.com" wrote:
              With the current API it seems the attachments that I get from

              org.jboss.deployers.client.spi.Deployment.getPredeterminedManagedObjects()

              are read only.

              Please show me the correct usage of a client using attachments


              They're not read-only in the implementations.

              It's just that the Deployment interface assumes that they might be read only,
              i.e. you could implement Deployment yourself in a way that the attachments
              are immutable.

              You can in fact downcast the Attachments to a MutableAttachments
              in the provided implementations.
              MutableAttachments attachments = (MutableAttachments) deployment.getPredeterminedManagedObjects();
              


              Or if you don't like the cast, you can create an
              MutableAttachments yourself and set it on the deployment
              VFSDeploymentFactory factory = new VFSDeploymentFactory();
              VFSDeployment deployment = factory.createDeployment(virtualFile);
              MutableAttachments attachments = new AttachmentsImpl();
              attachments.addAttachment("blah", serializable);
              deployment.setPredeterminedMangedObjects(myAttachments).
              


              The latter is also method where you could replace AttachmentsImpl
              with some form of immutable attachments implementation that loads
              them using some other method.
              e.g. the profile service might load them a database.