--- org/mobicents/slee/container/deployment/jboss/DeployableUnit.java	2010-12-28 04:28:10.000000000 +0100
+++ src/main/java/org/mobicents/slee/container/deployment/jboss/DeployableUnit.java	2011-02-25 15:19:17.000000000 +0100
@@ -52,9 +52,12 @@
   // A collection of the IDs of the components in this DU.
   private Collection<String> componentIDs = new ArrayList<String>();
 
-  // A collection of the IDs of the components that this DU depends on. 
+  // A collection of the IDs of the components that this DU depends on.
   private Collection<String> dependencies = new ArrayList<String>();
 
+  // A collection of the IDs of the components that this DU depends on. 
+  private Collection<String> deployDependencies = new ArrayList<String>();
+
   // The install actions needed to install/activate this DU components.
   private Collection<Object[]> installActions = new ArrayList<Object[]>();
 
@@ -116,13 +119,15 @@
         && postInstallActionsStrings.size() > 0) {
       installActions.addAll(postInstallActionsStrings);
     } else if (dc.getComponentType() == DeployableComponent.RA_COMPONENT) {
+
+        /*
       ComponentID cid = dc.getComponentID();
 
       String raID = dc.getComponentKey();
 
       logger
       .warn("\r\n------------------------------------------------------------"
-          + "\r\nNo RA Entity and Link config for "
+          + "\r\nNo RA Entity **************** and Link config for "
           + raID
           + " found. Using default values!"
           + "\r\n------------------------------------------------------------");
@@ -146,6 +151,8 @@
           "deactivateResourceAdaptorEntity", raName });
       uninstallActions.add(new Object[] { "removeResourceAdaptorEntity",
           raName });
+         *
+         */
     }
 
     // .. pre-uninstall actions (if any) ..
@@ -175,6 +182,7 @@
   public Collection<String> getExternalDependencies() {
     // Take all dependencies...
     Collection<String> externalDependencies = new HashSet<String>(dependencies);
+    externalDependencies.addAll(deployDependencies);
 
     // Remove those which are contained in this DU
     externalDependencies.removeAll(componentIDs);
@@ -271,7 +279,11 @@
     // Let's check if we have some remaining install actions
     if (postInstallActions.values().size() > 0) {
       for (String componentId : postInstallActions.keySet()) {
-        iActions.addAll(postInstallActions.get(componentId));
+        if (deployDependencies.contains(componentId)) {
+            iActions.addAll(0,postInstallActions.get(componentId));
+        } else {
+            iActions.addAll(postInstallActions.get(componentId));
+        }
       }
     }
 
@@ -386,12 +398,14 @@
 
       // Get the JarEntry for the deploy-config.xml
       JarEntry deployInfoXML = componentJarFile.getJarEntry("META-INF/deploy-config.xml");
+      logger.info("Deployment Configuration Found");
 
       // If it exists, set an Input Stream on it 
       is = deployInfoXML != null ? componentJarFile.getInputStream(deployInfoXML) : null;
 
       if (is != null) {
 
+          logger.info("Deployment Configuration Processing");
         // Read the file into a Document
         SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
         Schema schema = schemaFactory.newSchema(DeployableUnit.class.getClassLoader().getResource("deploy-config.xsd"));
@@ -486,6 +500,9 @@
 
           for (int j = 0; j < links.getLength(); j++) {
             String linkName = ((Element) links.item(j)).getAttribute("name");
+            logger.info("Removing Dependency " + linkName);
+            componentIDs.add(linkName.trim());
+
 
             cPostInstallActions.add(new Object[] {"bindLinkName", entityName, linkName});
 
@@ -513,8 +530,10 @@
             else {
               preUninstallActions.put(raId, cPreUninstallActions);
             }
+            deployDependencies.add(raId);
           }
 
+
           // Now we clean the lists for the next round (might come a new RA ID)...
           cPostInstallActions = new ArrayList<Object[]>();
           cPreUninstallActions = new ArrayList<Object[]>();
@@ -523,7 +542,10 @@
 
         }
       }
+    } catch (Exception ex){
+      logger.info("Exception  ",ex);
     }
+
     finally {
       // Clean depoy-config.xml inputstream
       try {
