Title: Web-Inf Deployment and MainDeployer

Hi there (Marc, I hope I reach you before you leave to Sidney!),

with the following two patches, jboss.net would run again agains the current head and I could finally focus on getting it to beta status.

Since the jboss testsuite doesn�t compile on my machine, I currently have no means to decide whether committing these would be safe. Hence I like to ask the usual suspects whether I should  ...

The first patch leads to AbstractWebContainer.parseWebInfClasses really ignore non-jar web application deployments ... jboss.net is a sar that, as a by-product, installs itself (i.e., a deployment with its own ucl and an extracted xml descriptor in a temp directory) immediately in the web container.

RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/web/AbstractWebContainer.java,v
retrieving revision 1.20
diff -r1.20 AbstractWebContainer.java
248c248
<          catch (Exception ignored) {throw new DeploymentException(ignored.getMessage());}
---
>          catch (Exception ignored) {log.warn("Could not extract web inf classes",ignored); return;}

The second patch splits the current MainDeployer.deploy(DeploymentInfo) method into two phases. A first phase that just creates classloaders and registers the deployment and a second phase that performs the actual deploy at the target deployers. This ensures that, e.g., if you have an ear consisting of an ejb-jar and a

war or a wsr (web service archive - has been added to the subdeployment extension list - wouldn�t it be better to have that list being dynamically constructed from the individually registered real deployers?), it does not matter in which order the sub-deployments are deployed because the classloaders are already there. Otherwise, it could lead to ClassNotFoundExceptions, because, e.g., an ejb-interface located in the ejb-jar and referenced by a web-service will be deployed too late.

RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v
retrieving revision 1.9
diff -r1.9 MainDeployer.java
365c365,371
<    public void deploy(DeploymentInfo deployment)
---
>    /** deploys an already given deployment structure
>     *  works in two phases:
>     *  - first sets up the classloaders
>     *  - then starts the modules (the actual deploy action)
>     */
>
>    public void deploy(DeploymentInfo deployment)
367,368c373,377
<    {     
<       boolean debug = log.isDebugEnabled();
---
>    {
>       if(preDeploy(deployment)) {
>         doDeploy(deployment);
>       }
>    }
370,373c379,386
<       try {
<          // If we are already deployed return
<          if (deployments.containsKey(deployment.url)) return;
<            
---
>    /** first phase of deployment: set up the classloaders */
>    protected boolean preDeploy(DeploymentInfo deployment) throws DeploymentException {
>       // If we are already deployed return
>       if (deployments.containsKey(deployment.url)) {
>         return false;
>       } else {
>           boolean debug = log.isDebugEnabled();
>         try {
375c388
<         
---
>
378c391
<         
---
>
381,393d393
<         
<          // What deployer is able to deploy this file
<          findDeployer(deployment);
<         
<          if(deployment.deployer != null) deployment.deployer.init(deployment);
<            
<          // create subdeployments as needed
<          deploySubPackages(deployment);
<         
<          // Deploy this SDI, if it is a deployable type
<          if (deployment.deployer != null) deployment.deployer.deploy(deployment);
<            
<          deployment.status="Deployed";
395,400c395,399
<          if (debug) {
<           log.debug("Done deploying " + deployment.shortName);
<        }
<       } 
<       catch (DeploymentException e)
<       {
---
>          // proceed with second phase
>          return true;
>         }
>         catch (DeploymentException e)
>         {
402c401
<         
---
>
404,406c403,405
<       }
<       finally
<       {
---
>         }
>         finally
>         {
409c408
<         
---
>
412c411
<         
---
>
418,419c417,443
<              log.debug("Watching new file: " + deployment.url); 
<           }
---
>                log.debug("Watching new file: " + deployment.url);
>             }
>          }
>         }
>       }
>    }
>
>    /** second phase: perform the actual deployment */
>    protected void doDeploy(DeploymentInfo deployment) throws DeploymentException {
>          try{
>           boolean debug = log.isDebugEnabled();
>
>          // What deployer is able to deploy this file
>          findDeployer(deployment);
>
>          if(deployment.deployer != null) deployment.deployer.init(deployment);
>
>          // create subdeployments as needed
>          deploySubPackages(deployment);
>
>          // Deploy this SDI, if it is a deployable type
>          if (deployment.deployer != null) deployment.deployer.deploy(deployment);
>
>          deployment.status="Deployed";
>
>          if (debug) {
>             log.debug("Done deploying " + deployment.shortName);
421a446,451
>       catch (DeploymentException e)
>       {
>          deployment.status="Deployment FAILED reason: "+e.getMessage();
>
>          throw e;
>       }
423c453
<   
---

Best,
CGJ ("Dr. Schorsch")
Currently spinnin� all-time soul classic: Herbert, "Suddenly"

Reply via email to