geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r505821 - in /geronimo/server/trunk/modules: geronimo-kernel/src/main/java/org/apache/geronimo/gbean/ geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/ geronimo-kernel/src/main/java/org/apache/geronimo/kernel/ geronimo-kernel...
Date Sun, 11 Feb 2007 02:00:20 GMT
Author: djencks
Date: Sat Feb 10 18:00:20 2007
New Revision: 505821

URL: http://svn.apache.org/viewvc?view=rev&rev=505821
Log:
Try to help show what went wrong if a configuration won
't start

Modified:
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/ReferenceMap.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/Kernel.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/KernelGBean.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelDelegate.java

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/ReferenceMap.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/ReferenceMap.java?view=diff&rev=505821&r1=505820&r2=505821
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/ReferenceMap.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/ReferenceMap.java
Sat Feb 10 18:00:20 2007
@@ -16,15 +16,13 @@
  */
 package org.apache.geronimo.gbean;
 
-import java.util.Map;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.HashMap;
+import java.util.Map;
 import java.util.Set;
 
 
 public class ReferenceMap implements Map, ReferenceCollectionListener {
-    private final ReferenceCollection collection;
     private final Map map;
     private final Key key;
 
@@ -37,14 +35,14 @@
      * @param key
      */
     public ReferenceMap(Collection collection, Map map, Key key) {
-        this.collection = (ReferenceCollection) collection;
         this.map = map;
         this.key = key;
-        for (Iterator iterator = this.collection.iterator(); iterator.hasNext();) {
-            Object object = iterator.next();
+        for (Object object : collection) {
             map.put(key.getKey(object), object);
         }
-        this.collection.addReferenceCollectionListener(this);
+        if (collection instanceof ReferenceCollection) {
+            ((ReferenceCollection)collection).addReferenceCollectionListener(this);
+        }
     }
 
     /**

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java?view=diff&rev=505821&r1=505820&r2=505821
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
Sat Feb 10 18:00:20 2007
@@ -937,8 +937,10 @@
             } catch (InvocationTargetException e) {
                 Throwable targetException = e.getTargetException();
                 if (targetException instanceof Exception) {
+                    stateReason = "the service constructor threw an exception. \n" + printException(targetException);
                     throw (Exception) targetException;
                 } else if (targetException instanceof Error) {
+                    stateReason = "the service constructor threw an exception. \n" + printException(targetException);
                     throw (Error) targetException;
                 }
                 stateReason = "the service constructor threw an exception. \n" + printException(e);

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/Kernel.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/Kernel.java?view=diff&rev=505821&r1=505820&r2=505821
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/Kernel.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/Kernel.java
Sat Feb 10 18:00:20 2007
@@ -373,4 +373,6 @@
      * @deprecated Use AbstractName version instead
      */
     Object invoke(ObjectName name, String methodName, Object[] args, String[] types) throws
GBeanNotFoundException, NoSuchOperationException, InternalKernelException, Exception;
+
+    String getStateReason(AbstractName abstractName);
 }

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/KernelGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/KernelGBean.java?view=diff&rev=505821&r1=505820&r2=505821
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/KernelGBean.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/KernelGBean.java
Sat Feb 10 18:00:20 2007
@@ -334,6 +334,10 @@
         return kernel.invoke(objectName, methodName, args, types);
     }
 
+    public String getStateReason(AbstractName abstractName) {
+        return kernel.getStateReason(abstractName);
+    }
+
     public Object invoke(AbstractName abstractName, String methodName, Object[] args, String[]
types) throws GBeanNotFoundException, NoSuchOperationException, InternalKernelException, Exception
{
         return kernel.invoke(abstractName, methodName, args, types);
     }

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java?view=diff&rev=505821&r1=505820&r2=505821
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
Sat Feb 10 18:00:20 2007
@@ -160,7 +160,8 @@
         try {
             kernel.startGBean(configurationName);
             if (State.RUNNING_INDEX != kernel.getGBeanState(configurationName)) {
-                throw new InvalidConfigurationException("Configuration gbean failed to start
" + configurationId);
+                String stateReason = kernel.getStateReason(configurationName);
+                throw new InvalidConfigurationException("Configuration gbean failed to start
" + configurationId + "\nreason: " + stateReason);
             }
 
             // get the configuration

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelDelegate.java?view=diff&rev=505821&r1=505820&r2=505821
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelDelegate.java
(original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelDelegate.java
Sat Feb 10 18:00:20 2007
@@ -537,6 +537,16 @@
         return invokeKernel("invoke", new Object[]{objectName, methodName, args, types},
new String[]{ObjectName.class.getName(), String.class.getName(), Object[].class.getName(),
String[].class.getName()});
     }
 
+    public String getStateReason(AbstractName abstractName) {
+        try {
+            return ((String) invokeKernel("getStateReason", new Object[]{abstractName}, new
String[]{AbstractName.class.getName()}));
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new InternalKernelException(e);
+        }
+    }
+
     public Object invoke(AbstractName abstractName, String methodName, Object[] args, String[]
types) throws GBeanNotFoundException, NoSuchOperationException, InternalKernelException, Exception
{
         return invokeKernel("invoke", new Object[]{abstractName, methodName, args, types},
new String[]{AbstractName.class.getName(), String.class.getName(), Object[].class.getName(),
String[].class.getName()});
     }



Mime
View raw message