How can I deploy a Grails 3 application on Tomcat 7?

I have a Grails application that I would like to deploy to a tomcat instance. Relevant versions of the libraries used:

Grails Version: 3.2.0
Groovy Version: 2.4.7
JVM Version: 1.7.0_79
Tomcat Version: 7.0.39

I built the WAR file (using grails war), uploaded it to the server, placed it in the webapp directory and restarted tomcat. The WAR file was unpacked as usual, but when I try to access the webapp index page, it simply returns a 404 error. If I manually placed a file called "ndex.html" in the webapp directory, then this file will be serviced. Therefore, I came to the conclusion that tomcat did not run the application at all.

I tried to check the logs for errors, but catalina.out is almost empty. Redeploying my webapp gives the following log output:

INFO: Reloading Context with name [/myapp] has started
Oct 18, 2016 1:56:30 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/<tomcat-path>/webapps/myapp/WEB-INF/lib/javax.el-api-2.2.4.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/el/Expression.class
Oct 18, 2016 1:57:43 PM org.apache.catalina.core.ApplicationContext log
INFO: 1 Spring WebApplicationInitializers detected on classpath
Oct 18, 2016 1:57:43 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/myapp] is completed

. , web.xml, , Grails 3, > 3.0 web.xml(tomcat 7 3.0). , :

  • ( java -Dgrails.env=prod -jar myapp.war). , 8080 ( , tomcat, , ).
  • grails (http://docs.grails.org/latest/guide/deployment.html): org.springframework.boot:spring-boot-starter-tomcat provided
  • tomcat build.gradle ext['tomcat.version'] = '7.0.72' ( . , tomcat (7.0.39), maven.

. , , .

!

+4

Source: https://habr.com/ru/post/1658087/


All Articles