title: How can I deploy a Grails 3.0.1 war file in Tomcat7?
body: <p>How can I deploy a <code>Grails 3.0.1</code> war file in, a non-embedded version of, Tomcat7? All I'm getting is a blank page or a 404 error.  I can successfully deploy my other war files, so I know it's not a problem with Tomcat.  My versions, and the steps I took are below:</p>
  
  <pre><code>Server version: Apache Tomcat/7.0.52 (Ubuntu)
  Grails Version: 3.0.1
  Groovy Version: 2.4.3
  JVM Version: 1.7.0_80
  </code></pre>
  
  <p>I suspect that the problem has something to do with Spring framework or Gradle. I am not very familiar with either of them, but I did notice that 3.0.1 no longer uses a <code>web.xml</code> and no longer has a <code>Config.groovy</code> file. The site below details how to deploy a Grails project in 3.0.x.</p>
  
  <p><a href="http://grails.github.io/grails-doc/3.0.x/guide/deployment.html" rel="noreferrer">http://grails.github.io/grails-doc/3.0.x/guide/deployment.html</a></p>
  
  <ol>
  <li>I ran <code>grails run-app</code> and it deployed to <code>localhost:8080</code> beautifully with no problems.</li>
  </ol>
  
  <p>I don't want to use the embedded version of Tomcat though. I'd like to deploy it to a different version of Tomcat, and this is where I am running into problems.</p>
  
  <ol start="2">
  <li>I changed the scope of my Tomcat dependencies to provided:
  
  <ul>
  <li><code>provided "org.springframework.boot:spring-boot-starter-tomcat"</code></li>
  </ul></li>
  <li>I generated the war file using <code>grails war</code>
  
  <ul>
  <li>added <code>website.war</code> to <code>/var/lib/tomcat7/webapps</code></li>
  <li>ran <code>sudo service tomcat7 restart</code> to restart tomcat</li>
  <li>checked to see if <code>website.war</code> unpacked automatically (it did)</li>
  <li>checked <code>localhost:9999/website</code></li>
  </ul></li>
  </ol>
  
  <p>^ This gives me is a blank white page.</p>
  
  <ol start="4">
  <li>I deleted <code>website.war</code> and it's associated unpacked folder.
  
  <ul>
  <li>checked <code>localhost:9999</code></li>
  <li>it successfully brought me to the default Tomcat screen</li>
  <li>signed into manager app</li>
  <li>deployed <code>website.war</code> on the manager app</li>
  <li>it gave me the <code>ok</code> status</li>
  <li>checked <code>localhost:9999/website</code></li>
  </ul></li>
  </ol>
  
  <p>^ This gives me the following error:</p>
  
  <blockquote>
    <p>HTTP Status 404 - /website, The requested resource is not available.</p>
  </blockquote>
  
  <p><strong>Other relevant information:</strong></p>
  
  <p><a href="https://grails.github.io/grails-doc/3.0.x/guide/single.html" rel="noreferrer">https://grails.github.io/grails-doc/3.0.x/guide/single.html</a>:</p>
  
  <blockquote>
    <p>"Grails 3.0 no longer requires web.xml. Customizations can be done via Spring"</p>
  </blockquote>
  
  <p>The<code>BuildConfig.groovy</code> file has also been changed.</p>
  
  <blockquote>
    <p>Old Location: <code>grails-app/conf/BuildConfig.groovy</code>
    New Location: <code>build.gradle</code>
    Description: Build time configuration is now defined in a Gradle build file</p>
  </blockquote>
  
  <p><strong>Other posts I've found:</strong>
  (sorry for not providing links, I cannot post more than two links without at least 10 reputation points.)</p>
  
  <p><em>grails.org/wiki/Deployment#Tomcat</em></p>
  
  <ul>
  <li>This suggests putting a war in the webapps folder.  I've already tried that and it's not working. </li>
  </ul>
  
  <p><em>stackoverflow.com/questions/27557893/grails-app-deploy-in-tomcat-server-using-war-file-fails</em></p>
  
  <ul>
  <li>He is asking a very similar question but he is using a different version of Grails</li>
  <li>The marked solution references <code>Config.groovy</code></li>
  <li>However build time configuration in <code>Grails 3.0.1</code> is now in <code>Build.gradle</code></li>
  <li>I don't know if he successfully solved the problem.</li>
  </ul>
  
  <p><em>stackoverflow.com/questions/23664421/cant-deploy-grails-war-file-in-tomcat-results-in-404</em></p>
  
  <ul>
  <li>Solution requires change to <code>Config.groovy</code>, which is no longer available in <code>Grails 3.0.1</code> projects</li>
  </ul>
  
  <p><strong>EDIT:</strong></p>
  
  <p>When it unpacks the <code>website.war</code> folder the <code>catalina.out</code> log file shows this:</p>
  
  <pre><code>:: Spring Boot ::        (v1.2.3.RELEASE)
  Jun 07, 2015 3:01:23 PM org.apache.catalina.core.ContainerBase addChildInternal
  SEVERE: ContainerBase.addChild: start: 
  org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/website]]
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
  at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
  at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
  at org.apache.tomcat.websocket.server.WsServerContainer.&lt;init&gt;(WsServerContainer.java:147)
  at org.apache.tomcat.websocket.server.WsSci.init(WsSci.java:131)
  at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:47)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5456)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  ... 10 more
  
  Jun 07, 2015 3:01:23 PM org.apache.catalina.startup.HostConfig deployWAR
  SEVERE: Error deploying web application archive /var/lib/tomcat7/webapps/website.war
  java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/website]]
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
  at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
  at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:745)
  
  Jun 07, 2015 3:01:23 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-bio-9999"]
  Jun 07, 2015 3:01:23 PM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 26775 ms
  </code></pre>
  
  <p>Then, when I try to load <code>localhost:9999/website</code> the <code>catalina.out</code> file shows this:</p>
  
  <pre><code>Jun 07, 2015 3:05:04 PM org.apache.coyote.AbstractProtocol pause
  INFO: Pausing ProtocolHandler ["http-bio-9999"]
  Jun 07, 2015 3:05:04 PM org.apache.catalina.core.StandardService stopInternal
  INFO: Stopping service Catalina
  Jun 07, 2015 3:05:04 PM org.apache.coyote.AbstractProtocol stop
  INFO: Stopping ProtocolHandler ["http-bio-9999"]
  Jun 07, 2015 3:05:04 PM org.apache.coyote.AbstractProtocol destroy
  INFO: Destroying ProtocolHandler ["http-bio-9999"]
  Jun 07, 2015 3:05:06 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
  Jun 07, 2015 3:05:06 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
  Jun 07, 2015 3:05:06 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
  Jun 07, 2015 3:05:06 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
  Jun 07, 2015 3:05:06 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
  Jun 07, 2015 3:05:06 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
  Jun 07, 2015 3:05:06 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["http-bio-9999"]
  Jun 07, 2015 3:05:06 PM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 576 ms
  Jun 07, 2015 3:05:06 PM org.apache.catalina.core.StandardService startInternal
  INFO: Starting service Catalina
  Jun 07, 2015 3:05:06 PM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/7.0.52 (Ubuntu)
  Jun 07, 2015 3:05:06 PM org.apache.catalina.startup.HostConfig deployDescriptor
  INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/host-manager.xml
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.HostConfig deployDescriptor
  INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/docs.xml
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.HostConfig deployDescriptor
  INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/manager.xml
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.HostConfig deployDescriptor
  INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/examples.xml
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.TaglibUriRule body
  INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
  Jun 07, 2015 3:05:07 PM org.apache.catalina.startup.HostConfig deployWAR
  INFO: Deploying web application archive /var/lib/tomcat7/webapps/website.war
  Jun 07, 2015 3:05:07 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
  INFO: validateJarFile(/var/lib/tomcat7/webapps/website/WEB-INF/lib/tomcat-embed-core-8.0.20.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
  Jun 07, 2015 3:05:07 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
  INFO: validateJarFile(/var/lib/tomcat7/webapps/website/WEB-INF/lib/tomcat-embed-el-8.0.20.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
  Jun 07, 2015 3:05:07 PM org.apache.catalina.deploy.WebXml setVersion
  WARNING: Unknown version string [3.1]. Default version will be used.
  </code></pre>