Trt Trt
Trt Trt

Reputation: 5552

Tomcat 7 and Grails deployment - what should the conf/web.xml look like?

I have added this to my web.xml file in Tomcat:

<servlet-mapping>
 <servlet-name>GroovyTemplate</servlet-name>
 <url-pattern>*.gsp</url-pattern>
</servlet-mapping>

But I get this from Catalina:

Caused by: java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name GroovyTemplate

The problem is that it will not load the manager anymore or any other apache tools that come with it.

But also if I do not have that in my web.xml then my Grails app will not start and returns a 404 error.

So what is the correct set up of the web.xml for grails app?

This is how it looks now (part of it):

<!-- The mapping for the default servlet -->
<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

<!-- The mappings for the JSP servlet -->
<servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jsp</url-pattern>
    <url-pattern>*.jspx</url-pattern>
</servlet-mapping>

<servlet-mapping>
 <servlet-name>GroovyTemplate</servlet-name>
 <url-pattern>*.gsp</url-pattern>
</servlet-mapping>

Upvotes: 0

Views: 306

Answers (1)

Michal_Szulc
Michal_Szulc

Reputation: 4177

please check out file yourGrailsProject/target/work/web.xml.tmp or here: https://github.com/wshearn/grails-test/blob/master/target/web.xml.tmp where you can find sections like:

<!-- The Groovy Server Pages servlet -->
<servlet>
    <servlet-name>gsp</servlet-name>
    <servlet-class>org.codehaus.groovy.grails.web.pages.GroovyPagesServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>gsp</servlet-name>
    <url-pattern>*.gsp</url-pattern>
</servlet-mapping>

which contain full path to GroovyPagesServlet.

Upvotes: 1

Related Questions