geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiam...@apache.org
Subject svn commit: r1305370 - in /geronimo/server/branches/3.0-beta/framework/modules: geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ geronimo-system/src/main/java/org/apache/geronimo/system/main/
Date Mon, 26 Mar 2012 14:16:01 GMT
Author: xiaming
Date: Mon Mar 26 14:16:01 2012
New Revision: 1305370

URL: http://svn.apache.org/viewvc?rev=1305370&view=rev
Log:
GERONIMO-5802 1. Only fail start when service module is failed 2. log missing dependency

Modified:
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
    geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=1305370&r1=1305369&r2=1305370&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
(original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
Mon Mar 26 14:16:01 2012
@@ -642,7 +642,13 @@ public class SimpleConfigurationManager 
         List<Dependency> dependencies = new ArrayList<Dependency>(environment.getDependencies());
         for (ListIterator<Dependency> iterator = dependencies.listIterator(); iterator.hasNext();)
{
             Dependency dependency = iterator.next();
-            Artifact resolvedArtifact = artifactResolver.resolveInClassLoader(dependency.getArtifact());
+            Artifact resolvedArtifact = null;
+            try {
+                resolvedArtifact = artifactResolver.resolveInClassLoader(dependency.getArtifact());
+            } catch (MissingDependencyException e) {
+                log.error("Cannot resolve dependency " + dependency.getArtifact() + " for
configuration " + configurationData.getId());
+                throw e;
+            }
 //            if (isConfiguration(resolvedArtifact)) {
             parentIds.add(resolvedArtifact);
 

Modified: geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java?rev=1305370&r1=1305369&r2=1305370&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
(original)
+++ geronimo/server/branches/3.0-beta/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
Mon Mar 26 14:16:01 2012
@@ -35,6 +35,7 @@ import org.apache.geronimo.gbean.GBeanIn
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.DebugLoggingLifecycleMonitor;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
@@ -49,6 +50,9 @@ import org.osgi.framework.BundleExceptio
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
+
+
 /**
  * @version $Rev:385659 $ $Date: 2007-03-07 14:40:07 +1100 (Wed, 07 Mar 2007) $
  */
@@ -194,10 +198,10 @@ public class EmbeddedDaemon implements M
             monitor.systemStarted(kernel);
 
             AbstractNameQuery query = new AbstractNameQuery(PersistentConfigurationList.class.getName());
-
+            Set<AbstractName> configLists = kernel.listGBeans(query);
+            
             if (configs.isEmpty()) {
                 // --override wasn't used (nothing explicit), see what was running before
-                Set<AbstractName> configLists = kernel.listGBeans(query);
                 for (AbstractName configListName : configLists) {
                     try {
                         configs.addAll((List<Artifact>) kernel.invoke(configListName,
"restore"));
@@ -226,17 +230,36 @@ public class EmbeddedDaemon implements M
                         for (Artifact configID : sorted) {
                             monitor.moduleLoading(configID);
                             configurationManager.loadConfiguration(configID, lifecycleMonitor);
+                            int configModuleType = configurationManager.getConfiguration(configID).getModuleType().getValue();
                             unloadedConfigs.remove(configID);
                             monitor.moduleLoaded(configID);
-                            monitor.moduleStarting(configID);
-                            if (!loadOnlyConfigs.contains(configID)) {
-                                configurationManager.startConfiguration(configID, lifecycleMonitor);
+                            try {
+                                monitor.moduleStarting(configID);
+                                if (!loadOnlyConfigs.contains(configID)) {
+                                    configurationManager.startConfiguration(configID, lifecycleMonitor);
+                                }
+                                monitor.moduleStarted(configID);
+                            } catch (Exception e) {
+                                if ( configModuleType != ConfigurationModuleType.SERVICE.getValue()
) {
+                                    log.warn("Failed to start module " + configID + "; Cause
by " + e.getCause());
+                                    configurationManager.unloadConfiguration(configID);
+                                    continue;
+                                }
                             }
-                            monitor.moduleStarted(configID);
                         }
                     } while (unloadedConfigsCount > unloadedConfigs.size());
                     if (!unloadedConfigs.isEmpty()) {
-                        throw new InvalidConfigException("Could not locate configs to start:
" + unloadedConfigs);
+                        // GERONIMO-5802 Not simply fail server when unloadedConfigs is not
empty, thus, server could
+                        // start in most cases as long as the system modules are started
OK.
+                        // throw new InvalidConfigException("Could not locate configs to
start: " + unloadedConfigs);
+                        for (Artifact configID:unloadedConfigs) {
+                            for (AbstractName configListName : configLists) {
+                                kernel.invoke(configListName, "stopConfiguration", new Object[]{configID},
new String[]{Artifact.class.getName()});
+                            }
+                            
+                        }
+                        log.warn("Could not start configs: " + unloadedConfigs);
+                        
                     }
                     // the server has finished loading the persistent configuration so inform
the gbean
                     AbstractNameQuery startedQuery = new AbstractNameQuery(ServerStatus.class.getName());
@@ -258,7 +281,7 @@ public class EmbeddedDaemon implements M
             }
 
             // Tell every persistent configuration list that the kernel is now fully started
-            Set<AbstractName> configLists = kernel.listGBeans(query);
+            configLists = kernel.listGBeans(query);
             for (AbstractName configListName : configLists) {
                 kernel.setAttribute(configListName, "kernelFullyStarted", Boolean.TRUE);
             }



Mime
View raw message