Examples of HadoopException


Examples of com.cloudera.lib.service.HadoopException

  }

  protected void validateJobtracker(String jobtracker) throws HadoopException {
    if (jobTrackerWhitelist.size() > 0 && !jobTrackerWhitelist.contains("*")) {
      if (!jobTrackerWhitelist.contains(jobtracker.toLowerCase())) {
        throw new HadoopException(HadoopException.ERROR.H05, jobtracker, "not in whitelist");
      }
    }
  }
View Full Code Here

Examples of com.cloudera.lib.service.HadoopException

  }

  protected void validateNamenode(String namenode) throws HadoopException {
    if (nameNodeWhitelist.size() > 0 && !nameNodeWhitelist.contains("*")) {
      if (!nameNodeWhitelist.contains(namenode.toLowerCase())) {
        throw new HadoopException(HadoopException.ERROR.H05, namenode, "not in whitelist");
      }
    }
  }
View Full Code Here

Examples of com.cloudera.lib.service.HadoopException

    throws HadoopException {
    Check.notEmpty(user, "user");
    Check.notNull(conf, "conf");
    Check.notNull(executor, "executor");
    if (conf.get(NAME_NODE_PROPERTY) == null || conf.getTrimmed(NAME_NODE_PROPERTY).length() == 0) {
      throw new HadoopException(HadoopException.ERROR.H06, NAME_NODE_PROPERTY);
    }
    try {
      validateNamenode(new URI(conf.get(NAME_NODE_PROPERTY)).getAuthority());
      UserGroupInformation ugi = getUGI(user);
      return ugi.doAs(new PrivilegedExceptionAction<T>() {
        public T run() throws Exception {
          Configuration namenodeConf = createNameNodeConf(conf);
          FileSystem fs = createFileSystem(namenodeConf);
          Instrumentation instrumentation = getServer().get(Instrumentation.class);
          Instrumentation.Cron cron = instrumentation.createCron();
          try {
            checkNameNodeHealth(fs);
            cron.start();
            return executor.execute(fs);
          }
          finally {
            cron.stop();
            instrumentation.addCron(INSTRUMENTATION_GROUP, executor.getClass().getSimpleName(), cron);
            closeFileSystem(fs);
          }
        }
      });
    }
    catch (HadoopException ex) {
      throw ex;
    }
    catch (Exception ex) {
      throw new HadoopException(HadoopException.ERROR.H03, ex);
    }
  }
View Full Code Here

Examples of com.cloudera.lib.service.HadoopException

    throws HadoopException {
    Check.notEmpty(user, "user");
    Check.notNull(conf, "conf");
    Check.notNull(executor, "executor");
    if (conf.get(JOB_TRACKER_PROPERTY) == null || conf.getTrimmed(JOB_TRACKER_PROPERTY).length() == 0) {
      throw new HadoopException(HadoopException.ERROR.H06, JOB_TRACKER_PROPERTY);
    }
    if (conf.get(NAME_NODE_PROPERTY) == null || conf.getTrimmed(NAME_NODE_PROPERTY).length() == 0) {
      throw new HadoopException(HadoopException.ERROR.H06, NAME_NODE_PROPERTY);
    }
    try {
      validateJobtracker(new URI(conf.get(JOB_TRACKER_PROPERTY)).getAuthority());
      validateNamenode(new URI(conf.get(NAME_NODE_PROPERTY)).getAuthority());
      UserGroupInformation ugi = getUGI(user);
      return ugi.doAs(new PrivilegedExceptionAction<T>() {
        public T run() throws Exception {
          JobConf jobtrackerConf = createJobTrackerConf(conf);
          Configuration namenodeConf = createNameNodeConf(conf);
          JobClient jobClient = createJobClient(jobtrackerConf);
          try {
            checkJobTrackerHealth(jobClient);
            FileSystem fs = createFileSystem(namenodeConf);
            Instrumentation instrumentation = getServer().get(Instrumentation.class);
            Instrumentation.Cron cron = instrumentation.createCron();
            try {
              checkNameNodeHealth(fs);
              cron.start();
              return executor.execute(jobClient, fs);
            }
            finally {
              cron.stop();
              instrumentation.addCron(INSTRUMENTATION_GROUP, executor.getClass().getSimpleName(), cron);
              closeFileSystem(fs);
            }
          }
          finally {
            closeJobClient(jobClient);
          }
        }
      });
    }
    catch (HadoopException ex) {
      throw ex;
    }
    catch (Exception ex) {
      throw new HadoopException(HadoopException.ERROR.H04, ex);
    }
  }
View Full Code Here

Examples of com.cloudera.lib.service.HadoopException

    }
    catch (HadoopException ex) {
      throw ex;
    }
    catch (Exception ex) {
      throw new HadoopException(HadoopException.ERROR.H08, ex.getMessage(), ex);
    }
  }
View Full Code Here

Examples of org.apache.hadoop.gateway.shell.HadoopException

          URIBuilder uri = uri( Hdfs.SERVICE_PATH, to );
          addQueryParam( uri, "op", "CREATE" );
          HttpPut nn = new HttpPut( uri.build() );
          HttpResponse r = execute( nn );
          if( r.getStatusLine().getStatusCode() != HttpStatus.SC_TEMPORARY_REDIRECT ) {
            throw new HadoopException( r.getStatusLine().toString() );
          }
          EntityUtils.consumeQuietly( r.getEntity() );
          Header[] h = r.getHeaders( "Location" );
          if( h == null || h.length != 1 ) {
            throw new HadoopException( "Invalid Location header." );
          }
          String loc = h[0].getValue();
          HttpPut dn = new HttpPut( loc );
          HttpEntity e = null;
          if( text != null ) {
View Full Code Here

Examples of org.apache.hadoop.gateway.shell.HadoopException

          URIBuilder uri = uri( Hdfs.SERVICE_PATH, to );
          addQueryParam( uri, "op", "CREATE" );
          HttpPut nn = new HttpPut( uri.build() );
          HttpResponse r = execute( nn );
          if( r.getStatusLine().getStatusCode() != HttpStatus.SC_TEMPORARY_REDIRECT ) {
            throw new HadoopException( r.getStatusLine().toString() );
          }
          EntityUtils.consumeQuietly( r.getEntity() );
          Header[] h = r.getHeaders( "Location" );
          if( h == null || h.length != 1 ) {
            throw new HadoopException( "Invalid Location header." );
          }
          String loc = h[0].getValue();
          HttpPut dn = new HttpPut( loc );
          HttpEntity e = null;
          if( text != null ) {
View Full Code Here

Examples of org.springframework.data.hadoop.HadoopException

    Method registerScript = ReflectionUtils.findMethod(PigServer.class, "registerScript", InputStream.class, Map.class);
    if (registerScript != null) {
      ReflectionUtils.invokeMethod(registerScript, pig, in, arguments);
    }
    else {
      throw new HadoopException("Pig versions older than 0.8.0 are not supported.");
    }

  }
View Full Code Here

Examples of org.springframework.data.hadoop.HadoopException

        ReflectionUtils.invokeMethod(m, target, args);
        m = ReflectionUtils.findMethod(cmd, "processRawArguments", LinkedList.class);
        ReflectionUtils.makeAccessible(m);
        ReflectionUtils.invokeMethod(m, target, args);
      } catch (IllegalStateException ex){
        throw new HadoopException("Cannot change permissions/ownership " + ex);
      }
    }
  }
View Full Code Here

Examples of org.springframework.data.hadoop.HadoopException

    try {
      this.fs = (fs != null ? fs : FileSystem.get(configuration));
      this.internalFs = (fs == null);
      this.trash = new Trash(configuration);
    } catch (IOException ex) {
      throw new HadoopException("Cannot create shell " + ex.getMessage(), ex);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.