geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiam...@apache.org
Subject svn commit: r1305380 - in /geronimo/server/trunk/framework/modules: geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
Date Mon, 26 Mar 2012 14:49:20 GMT
Author: xiaming
Date: Mon Mar 26 14:49:20 2012
New Revision: 1305380

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

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

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=1305380&r1=1305379&r2=1305380&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
Mon Mar 26 14:49:20 2012
@@ -727,7 +727,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/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java?rev=1305380&r1=1305379&r2=1305380&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
Mon Mar 26 14:49:20 2012
@@ -39,6 +39,7 @@ import org.apache.geronimo.gbean.Abstrac
 import org.apache.geronimo.gbean.AbstractNameQuery;
 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.DebugLoggingLifecycleMonitor;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.LifecycleMonitor;
@@ -280,17 +281,34 @@ public class EmbeddedDaemon {
                             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 (PersistentConfigurationList persistentConfigurationList
: configurationLists) {
+                                    persistentConfigurationList.stopConfiguration(configID);
+                                }                            
+                            }
+                            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());



Mime
View raw message