title: Deploy grails 2.5.5 app to tomcat 7
body: <p>I'm trying to deploy a Grails 2.5.5 app to Tomcat 7 (running on Ubuntu server). I used the command <code>war -stacktrace -verbose</code> in Intellij 14 to create the war file. Inside my <code>target</code> directory it successfully created the war file, let's call it <code>myapp-0.1.war</code>. Then in the terminal (I'm using Linux Mint) I used the following command to copy it to my server (I substitued my details in the example below, like <code>mypcusername</code>, <code>myserverusername</code> and <code>123.123.123.123</code>)  </p>
  
  <pre><code>rsync -rtvW --delete /home/mypcusername/NetbeansProjects/myapp/target/myapp-0.1.war/ myserverusername@123.123.123.123:/home/myserverusername/myapp-0.1.war/
  </code></pre>
  
  <p>Don't worry about the <code>NetbeansProjects</code> part of the above command either, it was originally a Netbeans project. Then I used <code>sudo cp -a myapp-0.1.war/ /var/lib/tomcat7/webapps/</code> followed by <code>sudo rm -R ROOT</code> to delete the original <code>ROOT</code> directory. Then I ran <code>sudo service tomcat7 restart</code> and this is where the problem is. The logs gave me the following:</p>
  
  <pre><code>Sep 03, 2017 10:23:39 AM org.apache.coyote.AbstractProtocol pause
  INFO: Pausing ProtocolHandler ["http-bio-8080"]
  Sep 03, 2017 10:23:39 AM org.apache.catalina.core.StandardService stopInternal
  INFO: Stopping service Catalina
  Sep 03, 2017 10:23:39 AM org.apache.coyote.AbstractProtocol stop
  INFO: Stopping ProtocolHandler ["http-bio-8080"]
  Sep 03, 2017 10:23:39 AM org.apache.coyote.AbstractProtocol destroy
  INFO: Destroying ProtocolHandler ["http-bio-8080"]
  Sep 03, 2017 10:23:43 AM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["http-bio-8080"]
  Sep 03, 2017 10:23:43 AM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 1734 ms
  Sep 03, 2017 10:23:43 AM org.apache.catalina.core.StandardService startInternal
  INFO: Starting service Catalina
  Sep 03, 2017 10:23:43 AM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/7.0.52 (Ubuntu)
  Sep 03, 2017 10:23:43 AM org.apache.catalina.startup.HostConfig deployDirectory
  INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT
  Sep 03, 2017 10:24:18 AM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://www.springframework.org/tags is already defined
  Sep 03, 2017 10:24:18 AM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://www.springframework.org/tags/form is already defined
  2017-09-03 10:24:26,325 [localhost-startStop-1] ERROR context.ContextLoader  - Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]!
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
      at java.lang.Thread.run(Thread.java:748)
  Caused by: org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]!
      ... 5 more
  Caused by: java.lang.UnsupportedClassVersionError: grails/plugin/cache/CacheConfigArtefactHandler : Unsupported major.minor version 52.0 (unable to load class grails.plugin.cache.CacheConfigArtefactHandler)
      at CacheGrailsPlugin.&lt;init&gt;(CacheGrailsPlugin.groovy:49)
      ... 5 more
  2017-09-03 10:24:26,330 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing the application: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]!
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]!
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
      at java.lang.Thread.run(Thread.java:748)
  Caused by: org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]!
      ... 5 more
  Caused by: java.lang.UnsupportedClassVersionError: grails/plugin/cache/CacheConfigArtefactHandler : Unsupported major.minor version 52.0 (unable to load class grails.plugin.cache.CacheConfigArtefactHandler)
      at CacheGrailsPlugin.&lt;init&gt;(CacheGrailsPlugin.groovy:49)
      ... 5 more
  2017-09-03 10:24:26,332 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing Grails: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]!
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]!
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
      at java.lang.Thread.run(Thread.java:748)
  Caused by: org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]!
      ... 5 more
  Caused by: java.lang.UnsupportedClassVersionError: grails/plugin/cache/CacheConfigArtefactHandler : Unsupported major.minor version 52.0 (unable to load class grails.plugin.cache.CacheConfigArtefactHandler)
      at CacheGrailsPlugin.&lt;init&gt;(CacheGrailsPlugin.groovy:49)
      ... 5 more
  Sep 03, 2017 10:24:26 AM org.apache.catalina.core.StandardContext startInternal
  SEVERE: Error listenerStart
  Sep 03, 2017 10:24:26 AM org.apache.catalina.core.StandardContext startInternal
  SEVERE: Context [] startup failed due to previous errors
  Sep 03, 2017 10:24:26 AM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-bio-8080"]
  Sep 03, 2017 10:24:26 AM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 43228 ms
  </code></pre>
  
  <p><strong>EDIT</strong> Thanks to suricatta, I followed his instructions by creating and chowning all the directories which made all those warnings go away. I'm updating the logs. </p>
  
  <p>Since originally asking the question I realised that I never actually copied a .war file to my server because when I tried to extract the files it would tell me something like "you can't extract a directory", I then noticed that it created an empty directory called myapp-0.1.war every time I used <code>rsync -rtvW --delete /home/mypcusername/NetbeansProjects/myapp/target/myapp-0.1.war/ myserverusername@123.123.123.123:/home/myserverusername/myapp-0.1.war/</code>. </p>
  
  <p>I then used <code>scp /home/mypcusername/NetBeansProjects/myapp/target/myapp-0.1.war myserverusername@41.185.91.194:/home/myserverusername</code> which did actually copy the war to my server. After extracting the actual files this time in /var/lib/tomcat7/webapps/ROOT I restarted Tomcat and that then gave me the above logs. When I go to 123.123.123.123:8080 I get a blank page with a javascript error saying <code>GET http://123.123.123.123:8080/ 404 (Not Found)</code> and I tried different variations like <code>&lt;ip&gt;:8080/myapp</code> and <code>&lt;ip&gt;:8080/myapp/home</code> all with the same result. </p>
  
  <p>I checked out <a href="https://stackoverflow.com/questions/24511939/grails-applicationcontext-xml-grailsresourceloader">this</a> answer but that doesn't seem to  apply to me coz I don't have the same values in my applicationContext.xml that the OP of that question has. Let my know if I need to post my applicationContext.xml.</p>