You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by vi...@apache.org on 2012/08/22 21:45:45 UTC

svn commit: r1376206 - in /incubator/oozie/trunk: ./ core/src/main/java/org/apache/oozie/ core/src/main/java/org/apache/oozie/action/ core/src/main/java/org/apache/oozie/action/hadoop/ core/src/main/java/org/apache/oozie/service/

Author: virag
Date: Wed Aug 22 19:45:45 2012
New Revision: 1376206

URL: http://svn.apache.org/viewvc?rev=1376206&view=rev
Log:
OOZIE-934 Exception reporting during Services startup is inadequate (mona via virag)

Modified:
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/ErrorCode.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/ActionExecutor.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/ActionService.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/Services.java
    incubator/oozie/trunk/release-log.txt

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/ErrorCode.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/ErrorCode.java?rev=1376206&r1=1376205&r2=1376206&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/ErrorCode.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/ErrorCode.java Wed Aug 22 19:45:45 2012
@@ -40,7 +40,7 @@ public enum ErrorCode {
 
     E0100(XLog.OPS, "Could not initialize service [{0}], {1}"),
     E0101(XLog.OPS, "Service [{0}] does not implement declared interface [{1}]"),
-    E0102(XLog.OPS, "Could not instanciate service class [{0}], {1}"),
+    E0102(XLog.OPS, "Could not instantiate service class [{0}], {1}"),
     E0103(XLog.OPS, "Could not load service classes, {0}"),
     E0110(XLog.OPS, "Could not parse or validate EL definition [{0}], {1}"),
     E0111(XLog.OPS, "class#method not found [{0}#{1}]"),

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/ActionExecutor.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/ActionExecutor.java?rev=1376206&r1=1376205&r2=1376206&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/ActionExecutor.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/ActionExecutor.java Wed Aug 22 19:45:45 2012
@@ -27,9 +27,10 @@ import org.apache.oozie.util.ParamChecke
 import org.apache.oozie.util.XLog;
 import org.apache.oozie.service.HadoopAccessorException;
 import org.apache.oozie.service.Services;
-import org.apache.oozie.servlet.CallbackServlet;
 
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.PrintStream;
 import java.net.URISyntaxException;
 import java.util.HashMap;
 import java.util.Map;
@@ -264,6 +265,7 @@ public abstract class ActionExecutor {
      * all its possible errors. <p/> Subclasses overriding must invoke super.
      */
     public void initActionType() {
+        XLog.getLog(getClass()).trace(" Init Action Type : [{0}]", getType());
         ERROR_INFOS.put(getType(), new LinkedHashMap<Class, ErrorInfo>());
     }
 
@@ -312,11 +314,16 @@ public abstract class ActionExecutor {
             Map<Class, ErrorInfo> executorErrorInfo = ERROR_INFOS.get(getType());
             executorErrorInfo.put(klass, new ErrorInfo(errorType, errorCode));
         }
-        catch (ClassNotFoundException ex) {
+        catch (ClassNotFoundException cnfe) {
             XLog.getLog(getClass()).warn(
-                    "Exception [{0}] no in classpath, ActionExecutor [{1}] will handled it as ERROR", exClass,
+                    "Exception [{0}] not in classpath, ActionExecutor [{1}] will handle it as ERROR", exClass,
                     getType());
         }
+        catch (java.lang.NoClassDefFoundError err) {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            err.printStackTrace(new PrintStream(baos));
+            XLog.getLog(getClass()).warn(baos.toString());
+        }
     }
 
     /**

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java?rev=1376206&r1=1376205&r2=1376206&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java Wed Aug 22 19:45:45 2012
@@ -18,11 +18,13 @@
 package org.apache.oozie.action.hadoop;
 
 import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.PrintStream;
 import java.io.StringReader;
 import java.net.ConnectException;
 import java.net.URI;
@@ -132,6 +134,7 @@ public class JavaActionExecutor extends 
 
     @Override
     public void initActionType() {
+        XLog log = XLog.getLog(getClass());
         super.initActionType();
         maxActionOutputLen = getOozieConf()
           .getInt(LauncherMapper.CONF_OOZIE_ACTION_MAX_OUTPUT_DATA,
@@ -166,6 +169,11 @@ public class JavaActionExecutor extends 
         catch (IOException ex) {
             throw new RuntimeException(ex);
         }
+        catch (java.lang.NoClassDefFoundError err) {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            err.printStackTrace(new PrintStream(baos));
+            log.warn(baos.toString());
+        }
     }
 
     /**

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/ActionService.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/ActionService.java?rev=1376206&r1=1376205&r2=1376206&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/ActionService.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/ActionService.java Wed Aug 22 19:45:45 2012
@@ -84,9 +84,10 @@ public class ActionService implements Se
     public void register(Class<? extends ActionExecutor> klass) throws ServiceException {
         XLog log = XLog.getLog(getClass());
         ActionExecutor executor = (ActionExecutor) ReflectionUtils.newInstance(klass, services.getConf());
+        log.trace("Registering action type [{0}] class [{1}]", executor.getType(), klass);
         if (executors.containsKey(executor.getType())) {
             throw new ServiceException(ErrorCode.E0150, XLog.format(
-                    "Action executor for action type [{1}] already registered", executor.getType()));
+                    "Action executor for action type [{0}] already registered", executor.getType()));
         }
         ActionExecutor.enableInit();
         executor.initActionType();

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/Services.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/Services.java?rev=1376206&r1=1376205&r2=1376206&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/Services.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/Services.java Wed Aug 22 19:45:45 2012
@@ -207,11 +207,12 @@ public class Services {
         try {
             loadServices();
         }
-        catch (RuntimeException ex) {
-            XLog.getLog(getClass()).fatal(ex.getMessage(), ex);
-            throw ex;
+        catch (RuntimeException rex) {
+            XLog.getLog(getClass()).fatal(rex.getMessage(), rex);
+            throw rex;
         }
         catch (ServiceException ex) {
+            XLog.getLog(getClass()).fatal(ex.getMessage(), ex);
             SERVICES = null;
             throw ex;
         }
@@ -267,7 +268,9 @@ public class Services {
         try {
             Map<Class, Service> map = new LinkedHashMap<Class, Service>();
             Class[] classes = conf.getClasses(CONF_SERVICE_CLASSES);
+            log.debug("Services list obtained from property '" + CONF_SERVICE_CLASSES + "'");
             Class[] classesExt = conf.getClasses(CONF_SERVICE_EXT_CLASSES);
+            log.debug("Services list obtained from property '" + CONF_SERVICE_EXT_CLASSES + "'");
             List<Service> list = new ArrayList<Service>();
             loadServices(classes, list);
             loadServices(classesExt, list);
@@ -283,8 +286,9 @@ public class Services {
             for (Map.Entry<Class, Service> entry : map.entrySet()) {
                 setService(entry.getValue().getClass());
             }
-        } catch (RuntimeException ex) {
-            throw new ServiceException(ErrorCode.E0103, ex.getMessage(), ex);
+        } catch (RuntimeException rex) {
+            log.fatal("Runtime Exception during Services Load. Check your list of '" + CONF_SERVICE_CLASSES + "' or '" + CONF_SERVICE_EXT_CLASSES + "'");
+            throw new ServiceException(ErrorCode.E0103, rex.getMessage(), rex);
         }
     }
 

Modified: incubator/oozie/trunk/release-log.txt
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/release-log.txt?rev=1376206&r1=1376205&r2=1376206&view=diff
==============================================================================
--- incubator/oozie/trunk/release-log.txt (original)
+++ incubator/oozie/trunk/release-log.txt Wed Aug 22 19:45:45 2012
@@ -1,5 +1,6 @@
 -- Oozie 3.3.0 release (trunk - unreleased)
 
+OOZIE-934 Exception reporting during Services startup is inadequate (mona via virag)
 OOZIE-914 Make sure all commands do their JPA writes within a single JPA executor (mona via virag)
 OOZIE-918 Changing log level from DEBUG to TRACE for trivial log statements (mona via virag)
 OOZIE-957 TestStatusTransitService and TestCoordKillXCommand are failing randomly; replace Thread.sleep() (rkanter via tucu)