Return-Path: X-Original-To: apmail-geronimo-scm-archive@www.apache.org Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D38A49678 for ; Mon, 26 Mar 2012 14:16:27 +0000 (UTC) Received: (qmail 33143 invoked by uid 500); 26 Mar 2012 14:16:27 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 33072 invoked by uid 500); 26 Mar 2012 14:16:27 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 33058 invoked by uid 99); 26 Mar 2012 14:16:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2012 14:16:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2012 14:16:23 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 22A9C2388865; Mon, 26 Mar 2012 14:16:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: scm@geronimo.apache.org From: xiaming@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120326141602.22A9C2388865@eris.apache.org> 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 dependencies = new ArrayList(environment.getDependencies()); for (ListIterator 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 configLists = kernel.listGBeans(query); + if (configs.isEmpty()) { // --override wasn't used (nothing explicit), see what was running before - Set configLists = kernel.listGBeans(query); for (AbstractName configListName : configLists) { try { configs.addAll((List) 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 configLists = kernel.listGBeans(query); + configLists = kernel.listGBeans(query); for (AbstractName configListName : configLists) { kernel.setAttribute(configListName, "kernelFullyStarted", Boolean.TRUE); }