6 Replies Latest reply on Mar 5, 2009 11:07 PM by Amit Bhayani

    Hotdeployment problem - Nested deployment

    Amit Bhayani Newbie

      hi Guys,

      I have a .sar and within it another .sar. Bellow is the structure of top level mobicents-media-server.sar

      [root@localhost mobicents-media-server.sar]# ls -R1
      .:
      lib
      META-INF
      mgcp-controller-service.sar
      
      ./lib:
      jspeex.jar
      mms-impl.jar
      stun4j.jar
      tritonus_gsm.jar
      tritonus_share.jar
      
      ./META-INF:
      jboss-beans.xml
      jboss-structure.xml
      
      ./mgcp-controller-service.sar:
      lib
      META-INF
      
      ./mgcp-controller-service.sar/lib:
      jain-mgcp-ri-1.0.jar
      mms-controllers-mgcp.jar
      mms-impl.jar
      mobicents-mgcp-impl-2.0.0.RC1.jar
      
      ./mgcp-controller-service.sar/META-INF:
      jboss-beans.xml


      The mobicents-media-server.sar/META-INF/jboss-structure.xml looks like


      <?xml version="1.0" encoding="UTF-8"?>
      <structure>
       <context>
       <path name=""/>
       <metaDataPath>
       <path name="META-INF"/>
       </metaDataPath>
       <classpath>
       <path name=""/>
       <!-- path name="" suffixes=".jar" / -->
       <path name="lib" suffixes=".jar" />
       </classpath>
       </context>
      
      
       <context>
       <path name="mgcp-controller-service.sar"/>
       <metaDataPath>
       <path name="META-INF"/>
       </metaDataPath>
       <classpath>
       <path name="mgcp-controller-service.sar/lib" suffixes=".jar"/>
       </classpath>
      
       </context>
      </structure>
      
      
      



      So far so good. This gets deployed in JBoss AS 5 without problems.

      But mgcp-controller-service.sar is really like service on demand which if user doesn't want to use, he/she can delete it from mobicents-media-server.sar/mgcp-controller-service.sar after JBoss AS is started. But in jboss-structure.xml I already have reference of mgcp-controller-service.sar, so this fails.

      I know moving mgcp-controller-service.sar directly to /deploy dir is an option, but since this is really a service of mobicents-media-server, I would like to keep it in within mobicents-media-server.sar.

      is this achievable? Can nested deployment work without jboss-structure.xml in which case should this work?

      Thanks for your response in advance


      Amit Bhayani
      http://amitbhayani.blogspot.com

        • 1. Re: Hotdeployment problem - Nested deployment
          Ales Justin Master

           

          "amit.bhayani@jboss.com" wrote:

          is this achievable? Can nested deployment work without jboss-structure.xml in which case should this work?

          You can enable DirectoryStructure,
          which means lib directory's contents will be recognized as potential sub-deployments.
          Hence you won't need the jboss-structure.xml anymore.
          But then you pay a performance penalty, since every dir is checked for sub-deployments.

          Or you can just flatten .sar into plain .jar == removing the lib dir.

          • 2. Re: Hotdeployment problem - Nested deployment
            Ales Justin Master

            Or you can do another complex thing. :-)

            You can add your own ModificationTypeMatcher
            which will check if the mgcp-controller-service.sar doesn't exist,
            and will remove it from ContextInfo's classpath.

            See ModificationTypeStructureProcessor for more details.

            • 3. Re: Hotdeployment problem - Nested deployment
              Amit Bhayani Newbie

              Thanks Ales

              I tried completely normalized .jar directory structure like

              [root@localhost mobicents-media-server.jar]# ls -R1
              .:
              jain-mgcp-ri-1.0.jar
              jspeex.jar
              META-INF
              mgcp-controller-service.jar
              mms-controllers-mgcp.jar
              mms-impl.jar
              mobicents-mgcp-impl-2.0.0.RC1.jar
              stun4j.jar
              tritonus_gsm.jar
              tritonus_share.jar
              
              ./META-INF:
              jboss-beans.xml
              jboss-structure.xml.bak
              
              ./mgcp-controller-service.jar:
              META-INF
              
              ./mgcp-controller-service.jar/META-INF:
              jboss-beans.xml
              



              This also deploys good (no jboss-structure.xml) However I still cannot delete the mgcp-controller-service.jar once JBoss AS is started. Bellow is the exception that I get

              23:57:02,352 INFO [ServerImpl] JBoss (Microcontainer) [5.0.0.GA (build: SVNTag=JBoss_5_0_0_GA date=200812041714)] Started in 53s:159ms
              23:57:21,906 WARN [HDScanner] Scan failed
              java.io.IOException: Error listing files: /home/abhayani/workarea/mobicents/jboss-5.0.0.GA/server/default/deploy/mobicents-media-server.jar/mgcp-controller-service.jar/META-INF
               at org.jboss.virtual.plugins.context.file.FileHandler.getChildren(FileHandler.java:209)
               at org.jboss.virtual.plugins.context.AbstractVFSContext.getChildren(AbstractVFSContext.java:171)
               at org.jboss.virtual.plugins.context.AbstractVFSContext.visit(AbstractVFSContext.java:288)
              



              I am new to JBoss AS and MC hence no clue what do you mean by

              You can enable DirectoryStructure,


              I will look more into ModificationTypeMatcher from your DZone article and MC docs

              Thanks,

              Amit Bhayani
              http://amitbhayani.blogspot.com

              • 4. Re: Hotdeployment problem - Nested deployment
                Ales Justin Master

                 

                "amit.bhayani@jboss.com" wrote:

                This also deploys good (no jboss-structure.xml) However I still cannot delete the mgcp-controller-service.jar once JBoss AS is started. Bellow is the exception that I get

                Can you try this on 5.0.1,
                as I completely rewrote that modification part.

                But I think you'll still need a new modification checker,
                as we currently only check for metadata file changes (see deployers.xml).
                Hence I doubt it will pick up complete sub-deployment deletion.

                "amit.bhayani@jboss.com" wrote:

                I am new to JBoss AS and MC hence no clue what do you mean by
                You can enable DirectoryStructure,


                Search for DirectoryStructure class.
                It's something that enables old .sar's lib behavior.
                But this doesn't help your case.

                "amit.bhayani@jboss.com" wrote:

                I will look more into ModificationTypeMatcher from your DZone article and MC docs

                I haven't written about that yet, as I need to go over VFS first (which is the next in series).

                • 5. Re: Hotdeployment problem - Nested deployment
                  Ales Justin Master

                  Actually, this is the easiest solution you can find. :-)

                  Simply create a new dir in deploy/,
                  e.g. deploy/mobicents,
                  and separate two jars (as you already suggested).

                  This should then have all the things you want
                  * grouped mobicents deployments
                  * hot deployment

                  • 6. Re: Hotdeployment problem - Nested deployment
                    Amit Bhayani Newbie

                    Thanks Ales, the easiest solution indeed worked for me :) And I don't care if top level mobicents-media-server dir has no extension and is just a simple dir as all I want is grouping.

                    Just copying the dir structure for other followers

                    [root@localhost mobicents-media-server]# ls -R1
                    .:
                    mobicents-media-server.sar
                    zmgcp-controller-service.sar
                    
                    ./mobicents-media-server.sar:
                    lib
                    META-INF
                    
                    ./mobicents-media-server.sar/lib:
                    jspeex.jar
                    mms-impl.jar
                    stun4j.jar
                    tritonus_gsm.jar
                    tritonus_share.jar
                    
                    ./mobicents-media-server.sar/META-INF:
                    jboss-beans.xml
                    jboss-structure.xml
                    
                    ./zmgcp-controller-service.sar:
                    lib
                    META-INF
                    
                    ./zmgcp-controller-service.sar/lib:
                    jain-mgcp-ri-1.0.jar
                    mms-controllers-mgcp.jar
                    mobicents-mgcp-impl-2.0.0.RC1.jar
                    
                    ./zmgcp-controller-service.sar/META-INF:
                    jboss-beans.xml
                    jboss-structure.xml