title: WAR file throws OutOfMemoryError in Tomcat server
body: <p>I have a Spring MVC WAR file that works perfectly in my local machine (program and website).</p>
  
  <p>Once I upload the file into the server (a <code>Tomcat 7</code>) and try to access it, the catalina log file indicates <code>java.lang.OutOfMemoryError</code>.</p>
  
  <p>I have tried modifying the memory in the <code>Arguments</code> tab of Eclipse IDE's <code>Run &gt; Run Configurations</code> section by appending <code>-Xmx2048m</code> or <code>-Xmx1024m</code> to the <code>VM Arguments</code> section before exporting but neither did any changes except the first resulted into a </p>
  
  <pre><code>Error occurred during initialization of VM
  Could not reserve enough space for object heap
  </code></pre>
  
  <p>in my local machine.</p>
  
  <p>Here is the full log file from my initial visit to the site:</p>
  
  <pre><code>12 25, 13 6:16:23 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["http-bio-11032"]
  12 25, 13 6:16:23 PM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 658 ms
  12 25, 13 6:16:23 PM org.apache.catalina.core.StandardService startInternal
  INFO: Starting service Catalina
  12 25, 13 6:16:23 PM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
  12 25, 13 6:16:23 PM org.apache.catalina.startup.HostConfig deployWAR
  INFO: Deploying web application archive /home/username/tomcat7/webapps/project.war
  12 25, 13 6:16:23 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
  INFO: validateJarFile(/home/username/tomcat7/webapps/project/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
  12 25, 13 6:16:40 PM org.apache.catalina.startup.HostConfig deployWARs
  SEVERE: Error waiting for multi-thread deployment of WAR files to complete
  java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
    at java.util.concurrent.FutureTask.get(FutureTask.java:83)
    at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:751)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:471)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1412)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:312)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:401)
    at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:346)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1145)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:782)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
  Caused by: java.lang.OutOfMemoryError: Java heap space
    at org.apache.tomcat.util.bcel.classfile.LineNumberTable.&lt;init&gt;(LineNumberTable.java:68)
    at org.apache.tomcat.util.bcel.classfile.Attribute.readAttribute(Attribute.java:144)
    at org.apache.tomcat.util.bcel.classfile.Code.&lt;init&gt;(Code.java:86)
    at org.apache.tomcat.util.bcel.classfile.Attribute.readAttribute(Attribute.java:140)
    at org.apache.tomcat.util.bcel.classfile.FieldOrMethod.&lt;init&gt;(FieldOrMethod.java:58)
    at org.apache.tomcat.util.bcel.classfile.Method.&lt;init&gt;(Method.java:72)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.readMethods(ClassParser.java:268)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:128)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2032)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1923)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1891)
    at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1877)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1270)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:855)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    ... 5 more
  12 25, 13 6:16:41 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-bio-11032"]
  12 25, 13 6:16:45 PM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 21778 ms
  </code></pre>
  
  <p>How do I solve this?</p>