0

I've deployed my application to an ubuntu server running tomcat6. I did the deployment via a WAR file, and I've renamed it to ROOT. When I go to the base url, I get a 404 error saying cannot find 'index.jsp'. I found on the grails FAQ site, that this means it already tried to find a gsp but wasn't able to find it--however, I've verified in the extracted war that it does, indeed exist.

My default settings point to a HomeController which calls index() and there is a corresponing /home/index.gsp in the views folder under the extracted WAR.

Now to add some further confusion, I have another controller ContactController and the same view setup (i.e Contact/index.gsp) and that one will work! In fact, out of the 5 controllers I have, it's the only one that can find the view apparently, even though each view is named index.gsp in their own respective view folders.

I'm not sure that it's related to the app itself since it works using the run-app (although I certainly won't rule it out). My guess is it's server related, but all the docs say a simple drop of the WAR in the /webapps/ directory and restart.

Any suggestions?

UPDATE: UrlMappings.groovy:

class UrlMappings {

    static mappings = {
        "/$controller/$action?/$id?"{
            constraints {
                // apply constraints here
            }
        }

        "/"(controller:"home", action:"index")
        "500" (view: '/error')
    }
}

The error exactly:

The requested resource (/WEB-INF/grails-app/views/home/index.jsp) is not available

7
  • Can you post your UrlMappings.groovy file?
    – Kelly
    Jul 12, 2012 at 22:23
  • I've added it to the question. My Controller is named 'HomeController' not 'homeController'. Does that matter?
    – OnResolve
    Jul 12, 2012 at 23:21
  • That all looks right to me. Lower case is what should be used when referring to controllers. Can you go directly to /appName/home/index? Next can you add your index action from the home controller?
    – Kelly
    Jul 13, 2012 at 0:03
  • @Kelly I've put in the action too. I get the error: 'The requested resource (/WEB-INF/grails-app/views/home/index.jsp) is not available.' still
    – OnResolve
    Jul 13, 2012 at 0:08
  • I don't see the index controller action in the question. Could there be something you are doing in the individual index.gsp files that is keeping them from compiling?
    – Kelly
    Jul 13, 2012 at 0:20

3 Answers 3

4

We had this issue recently. Make sure that your controller is in the right package that corresponds to the directory structure.

For example:

package com.mypackage

class HomeController {
   def index = {
   }
}

is in ./grails-app/controllers/com/mypackage.

1

Does it work if you name the action as well as the controller in your root mapping?

"/"(controller:"home", action:"index")
1
  • Nope :( also, remember that the home one is not the only one that doesn't load, just one particular controller + view works.
    – OnResolve
    Jul 13, 2012 at 0:11
0

You have to add ' allowLinking="true" ' attribute to the Context tag in the context.xml file

you can see that context.xml file in ${TOMCAT_HOME}\conf folder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.