为什么 tomcat 找不到我的索引?
Why is my index not found by tomcat?
几年来我一直在开发 grails 应用程序,最近 运行 在将应用程序部署到 tomcat6 时遇到了一个奇怪的问题。我可以访问登录页面。我可以登录并获得身份验证。但是,当被重定向到我的索引页面时,我得到一个 404 /myapp/ 资源不可用。
有趣的是,我可以导航到应用程序中的其他页面并执行我需要的任何操作,但是当导航回主页时 returns 找不到 404。
我搜索了已部署的视图目录,index.gsp 出现在它应该出现的位置。我的 spock 测试没有失败。我不知所措。两年多来我没有修改过我的家庭控制器或索引页面本身。我错过了什么?
我正在使用 grails 2.1.1 和 tomcat6
更新:
这是我的 UrlMappings.groovy:
class UrlMappings {
static mappings = {
"/$controller/$action?/$id?" {
constraints {
// apply constraints here
}
}
"/"(controller: "home",action:"index")
//(view: "/index")
// special mapping for jqgrid errors
"500"(controller: "errors", action: "validation", exception: ValidationException)
//"500"(controller: "errors")
"500"(view: '/error')
//"/searchable"(view:"/searchable/index")
/*name homeView: "/bullMaster" {
controller = "bullMaster"
action = "index"
}
*/
}
}
我的 HomeController 非常基础:
class HomeController {
def index = {
render(view:"index")
}
def termsAndConditions ={
render(view:"termsAndConditions")
}
}
我通常使用以下方式导航到应用程序:
http://ipAddress:8080/appName/
日志中是否有任何错误?
下一步,一个接一个地尝试(每一步都要测试):
"/"(controller: "home")
- 删除 'action'.
- 将
def index = {}
更改为def index() {}
- 添加'layout':
render(view:"index", layout:null)
- 从 'index.gsp' 中删除几乎所有代码。
- 添加 /home 进行渲染:
render(view:"/home/index")
- 将
render(view:"index")
替换为render text: 'test'
- 这个url有效吗? http://yourip:8080/appName/home/index
这可能有助于发现问题。你会不会每一步都报404错误?
几年来我一直在开发 grails 应用程序,最近 运行 在将应用程序部署到 tomcat6 时遇到了一个奇怪的问题。我可以访问登录页面。我可以登录并获得身份验证。但是,当被重定向到我的索引页面时,我得到一个 404 /myapp/ 资源不可用。
有趣的是,我可以导航到应用程序中的其他页面并执行我需要的任何操作,但是当导航回主页时 returns 找不到 404。
我搜索了已部署的视图目录,index.gsp 出现在它应该出现的位置。我的 spock 测试没有失败。我不知所措。两年多来我没有修改过我的家庭控制器或索引页面本身。我错过了什么?
我正在使用 grails 2.1.1 和 tomcat6
更新:
这是我的 UrlMappings.groovy:
class UrlMappings {
static mappings = {
"/$controller/$action?/$id?" {
constraints {
// apply constraints here
}
}
"/"(controller: "home",action:"index")
//(view: "/index")
// special mapping for jqgrid errors
"500"(controller: "errors", action: "validation", exception: ValidationException)
//"500"(controller: "errors")
"500"(view: '/error')
//"/searchable"(view:"/searchable/index")
/*name homeView: "/bullMaster" {
controller = "bullMaster"
action = "index"
}
*/
}
}
我的 HomeController 非常基础:
class HomeController {
def index = {
render(view:"index")
}
def termsAndConditions ={
render(view:"termsAndConditions")
}
}
我通常使用以下方式导航到应用程序:
http://ipAddress:8080/appName/
日志中是否有任何错误?
下一步,一个接一个地尝试(每一步都要测试):
"/"(controller: "home")
- 删除 'action'.- 将
def index = {}
更改为def index() {}
- 添加'layout':
render(view:"index", layout:null)
- 从 'index.gsp' 中删除几乎所有代码。
- 添加 /home 进行渲染:
render(view:"/home/index")
- 将
render(view:"index")
替换为render text: 'test'
- 这个url有效吗? http://yourip:8080/appName/home/index
这可能有助于发现问题。你会不会每一步都报404错误?