User: starksm 
  Date: 01/05/24 00:02:57

  Modified:    src/main/org/jboss/deployment Tag: Branch_2_2
                        J2eeDeployer.java
  Log:
  Switch the deploy order of ejbs/wars
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.20.2.1  +31 -29    jboss/src/main/org/jboss/deployment/J2eeDeployer.java
  
  Index: J2eeDeployer.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/J2eeDeployer.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- J2eeDeployer.java 2001/02/27 21:13:22     1.20
  +++ J2eeDeployer.java 2001/05/24 07:02:57     1.20.2.1
  @@ -65,7 +65,7 @@
   *  (ContainerFactory for JBoss and EmbededTomcatService for Tomcat).
   *
   *   @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Schulze</a>
  -*   @version $Revision: 1.20 $
  +*   @version $Revision: 1.20.2.1 $
   */
   public class J2eeDeployer 
   extends ServiceMBeanSupport
  @@ -400,13 +400,28 @@
         String message;
         try
         {
  -         // Tomcat
  -         Iterator it = _d.webModules.iterator ();
  +         // Deploy the ejb modules
  +         moduleName = _d.name;
  +         Vector tmp = new java.util.Vector();
  +         Iterator it = _d.ejbModules.iterator();
  +         while( it.hasNext() )
  +         {
  +             m = (Deployment.Module) it.next();
  +             tmp.add( m.localUrls.firstElement().toString() );
  +         }
  +         String[] jarUrls = new String[ tmp.size() ];
  +         tmp.toArray( jarUrls );
  +         // Call the ContainerFactory that is loaded in the JMX server
  +         server.invoke(jarDeployer, "deploy",
  +            new Object[]{ _d.localUrl.toString(), jarUrls },
  +            new String[]{ String.class.getName(), String[].class.getName() } );
  +
  +         // Deploy the web application modules
  +         it = _d.webModules.iterator ();
                 if (it.hasNext() && !warDeployerAvailable())
                         throw new J2eeDeploymentException ("application contains war 
files but no web container available");
  -                      
  -              
  -         while (it.hasNext ())
  +
  +         while( it.hasNext() )
            {
               m = (Deployment.Module)it.next ();
               moduleName = m.name;
  @@ -419,26 +434,12 @@
               // since tomcat changes the context classloader...
               Thread.currentThread().setContextClassLoader (appCl);
            }
  -
  -         // JBoss
  -         // gather the ejb module urls and deploy the application
  -         moduleName = _d.name;
  -         Vector tmp = new java.util.Vector();
  -         for( it = _d.ejbModules.iterator(); it.hasNext(); )
  -         {
  -             m = (Deployment.Module) it.next();
  -             tmp.add( m.localUrls.firstElement().toString() );
  -         }
  -         String[] jarUrls = new String[ tmp.size() ];
  -         tmp.toArray( jarUrls );
  -         // Call the ContainerFactory that is loaded in the JMX server
  -         server.invoke(jarDeployer, "deploy",
  -            new Object[]{ _d.localUrl.toString(), jarUrls }, new String[]{ 
String.class.getName(), String[].class.getName() } );
         }
  -      catch (MBeanException _mbe)
  +      catch (MBeanException e)
         {
            log.error ("Starting "+moduleName+" failed!");
  -         throw new J2eeDeploymentException ("Error while starting "+moduleName+": " 
+ _mbe.getTargetException ().getMessage (), _mbe.getTargetException ());
  +         e.getTargetException().printStackTrace();
  +         throw new J2eeDeploymentException ("Error while starting "+moduleName+": " 
+ e.getTargetException ().getMessage (), e.getTargetException ());
         }
         catch (RuntimeErrorException e)
         {
  @@ -452,10 +453,11 @@
            e.getTargetException ().printStackTrace();
            throw new J2eeDeploymentException ("Error while starting "+moduleName+": " 
+ e.getTargetException ().getMessage (), e.getTargetException ());
         }
  -      catch (JMException _jme)
  +      catch (JMException e)
         {
            log.error ("Starting failed!");
  -         throw new J2eeDeploymentException ("Fatal error while interacting with 
deployer MBeans... " + _jme.getMessage ());
  +         e.printStackTrace();
  +         throw new J2eeDeploymentException ("Fatal error while interacting with 
deployer MBeans... " + e.getMessage ());
         }
         finally
         {
  @@ -475,10 +477,6 @@
         ClassLoader oldCl = Thread.currentThread().getContextClassLoader ();
         StringBuffer error = new StringBuffer ();
   
  -      // stop the jar modules (the ContainerFactory is responsible for undeploying
  -      // all jars associated w/ a given application)
  -      stopModule( jarDeployer, _d.name, _d.localUrl.toString(), error );
  -
         // stop the web modules
         if( warDeployer != null )
         {
  @@ -494,6 +492,10 @@
            // should only happen for tomcat (i=1)
            log.warning("Cannot find web container");
         }
  +
  +      // stop the jar modules (the ContainerFactory is responsible for undeploying
  +      // all jars associated w/ a given application)
  +      stopModule( jarDeployer, _d.name, _d.localUrl.toString(), error );
   
         if (!error.toString ().equals ("")) // there was at least one error...
           throw new J2eeDeploymentException ("Error(s) on stopping application 
"+_d.name+":\n"+error.toString ());
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to