title: InvalidResourceRequestException Yarn Exception while running Spark in Cluster mode with yarn in hadoop 2.4
body: <p>Using <code>Apache spark 1.1.0</code> with <code>hadoop 2.4</code></p>
  
  <p>Also my <code>cluster is on CDH 5.1.3</code></p>
  
  <p>I tried with below command to start <code>spark with yarn</code>.</p>
  
  <pre><code>./spark-shell --master yarn 
  ./spark-shell --master yarn-client
  </code></pre>
  
  <p>I got the following exception:</p>
  
  <blockquote>
    <p>14/10/15 21:33:32 INFO cluster.YarnClientSchedulerBackend: Application
    report from ASM:
             appMasterRpcPort: 0
             appStartTime: 1413388999108
             yarnAppState: RUNNING</p>
    
    <p>14/10/15 21:33:44 ERROR cluster.YarnClientSchedulerBackend: Yarn
    application already ended: FAILED</p>
    
    <p>======Node manager Exception ============================================</p>
    
    <p>Caused by:
    org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException):
    Invalid resource request, requested memory &lt; 0, or requested memory >
    max configured, requestedMemory=1408, maxMemory=1024  at
    org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils.validateResourceRequest(SchedulerUtils.java:228)
      at
    org.apache.hadoop.yarn.server.resourcemanager.RMServerUtils.validateResourceRequests(RMServerUtils.java:80)
      at
    org.apache.hadoop.yarn.server.resourcemanager.ApplicationMasterService.allocate(ApplicationMasterService.java:444)
      at
    org.apache.hadoop.yarn.api.impl.pb.service.ApplicationMasterProtocolPBServiceImpl.allocate(ApplicationMasterProtocolPBServiceImpl.java:60)
      at
    org.apache.hadoop.yarn.proto.ApplicationMasterProtocol$ApplicationMasterProtocolService$2.callBlockingMethod(ApplicationMasterProtocol.java:99)
      at
    org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585)
      at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1026)     at
    org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1986)  at
    org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1982)  at
    java.security.AccessController.doPrivileged(Native Method)    at
    javax.security.auth.Subject.doAs(Subject.java:396)    at
    org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1554)
      at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1980)</p>
    
    <p>at org.apache.hadoop.ipc.Client.call(Client.java:1410)  at
    org.apache.hadoop.ipc.Client.call(Client.java:1363)   at
    org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:206)
      at $Proxy11.allocate(Unknown Source)    at
    org.apache.hadoop.yarn.api.impl.pb.client.ApplicationMasterProtocolPBClientImpl.allocate(ApplicationMasterProtocolPBClientImpl.java:77)
      ... 20 more</p>
  </blockquote>