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 544089B8E for ; Mon, 26 Mar 2012 15:27:54 +0000 (UTC) Received: (qmail 10541 invoked by uid 500); 26 Mar 2012 15:27:54 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 10502 invoked by uid 500); 26 Mar 2012 15:27:54 -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 10495 invoked by uid 99); 26 Mar 2012 15:27:54 -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 15:27:54 +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 15:27:50 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E19A2238897A; Mon, 26 Mar 2012 15:27:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1305398 - in /geronimo/server/branches/2.2/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 15:27:28 -0000 To: scm@geronimo.apache.org From: xiaming@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120326152728.E19A2238897A@eris.apache.org> Author: xiaming Date: Mon Mar 26 15:27:28 2012 New Revision: 1305398 URL: http://svn.apache.org/viewvc?rev=1305398&view=rev Log: GERONIMO-5802 1. Only fail start when service module is failed 2. log missing dependency, for 2.2 branch Modified: geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java geronimo/server/branches/2.2/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java Modified: geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=1305398&r1=1305397&r2=1305398&view=diff ============================================================================== --- geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java (original) +++ geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java Mon Mar 26 15:27:28 2012 @@ -483,7 +483,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); @@ -1311,11 +1317,11 @@ public class SimpleConfigurationManager * @throws InvalidConfigException on error */ private void applyOverrides(Configuration configuration) throws InvalidConfigException{ - ClassLoader configurationClassLoader = configuration.getConfigurationClassLoader(); + ClassLoader configurationClassLoader = configuration.getConfigurationClassLoader(); Collection gbeans = configuration.getConfigurationData().getGBeans(configurationClassLoader); if (configuration.getManageableAttributeStore() != null) { - configuration.getManageableAttributeStore().applyOverrides(configuration.getId(), gbeans, - configurationClassLoader); + configuration.getManageableAttributeStore().applyOverrides(configuration.getId(), gbeans, + configurationClassLoader); } } Modified: geronimo/server/branches/2.2/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java?rev=1305398&r1=1305397&r2=1305398&view=diff ============================================================================== --- geronimo/server/branches/2.2/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java (original) +++ geronimo/server/branches/2.2/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java Mon Mar 26 15:27:28 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; @@ -169,10 +170,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); + // --override wasn't used (nothing explicit), see what was running before for (AbstractName configListName : configLists) { try { configs.addAll((List) kernel.invoke(configListName, "restore")); @@ -199,14 +200,32 @@ public class EmbeddedDaemon implements M for (Artifact configID : sorted) { monitor.moduleLoading(configID); configurationManager.loadConfiguration(configID, lifecycleMonitor); + int configModuleType = configurationManager.getConfiguration(configID).getModuleType().getValue(); monitor.moduleLoaded(configID); - monitor.moduleStarting(configID); - configurationManager.startConfiguration(configID, lifecycleMonitor); - monitor.moduleStarted(configID); + try { + monitor.moduleStarting(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; + } + } } } 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()); @@ -228,7 +247,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); }