[URGENTE] - Problemas com SecurityFilters
03/08/2010 00:00
0
Pessoal, primeiramente vou dizer como está arquitetada a minha aplicação.

Um Usuário (classe domínio) pode estar em um ou vários Grupos (classe domínio), e um Grupo pode ter vários Usuários. Dessa forma, cria-se uma terceira classe UsuarioGrupo para vincular um Usuário a um Grupo. Cada Grupo, tem acesso a várias Permissões, e cada Permissão, pode ser acessada por vários Grupos. Dessa forma, temos uma terceira classe, chamada GrupoPermissao. Cada Permissão é identificada com uma url unica.

No Bootstrap.groovy eu já inicializo no banco de dados usuários e grupos como segue:

import carteiro_veloz.*;
class BootStrap {


def init = { servletContext ->


def password = CriptografaSenha.criptografa("pa")
def u = new Usuario(login:'carteiro.veloz@gmail.com',emailAlternativo:'jguilhermemv@gmail.com',senha:password,nome:'administrador',admin:true).save(flush:true)
def u1 = new Usuario(login:'cliente@gmail.com',emailAlternativo:'cliente@gmail.com',senha:password,nome:'cliente',admin:false).save(flush:true)

def g = new Grupo(nome:'ADMIN',descricao:'ADMINISTRADOR').save(flush:true)
def g1 = new Grupo(nome:'CLIENTE',descricao:'USUARIO CLIENTE').save(flush:true)

def uG = UsuarioGrupo.create(u,g,true)
def uG1 = UsuarioGrupo.create(u1,g1,true)


def p1 = new Permissao(url:'/carteiro_veloz_grails/usuario/auth').save(flush:true);
def p2 = new Permissao(url:'/carteiro_veloz_grails/usuario/create').save(flush:true);
def p3 = new Permissao(url:'/carteiro_veloz_grails/usuario/list').save(flush:true);
def p4 = new Permissao(url:'/carteiro_veloz_grails/usuario/show').save(flush:true);
def p5 = new Permissao(url:'/carteiro_veloz_grails/usuario/save').save(flush:true);
def p6 = new Permissao(url:'/carteiro_veloz_grails/usuario/show/**').save(flush:true);
def p7 = new Permissao(url:'/carteiro_veloz_grails/usuario/index').save(flush:true);
def p8 = new Permissao(url:'/carteiro_veloz_grails/usuario/logout').save(flush:true);

GrupoPermissao.create(p1,g1,true)
GrupoPermissao.create(p2,g1,true)
GrupoPermissao.create(p3,g1,true)
GrupoPermissao.create(p4,g1,true)
GrupoPermissao.create(p5,g1,true)
GrupoPermissao.create(p7,g1,true)
GrupoPermissao.create(p8,g1,true)
//GrupoPermissao.create(p6,g1,true)


}

def destroy = {
}
}


O responsável pela filtragem de URL é o SecurityFilters, através do filtro logincheck, que deve ser executado ANTES de cada action, controller, ou url. O SecurityFilters está como segue:

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author Guilherme
*/
import carteiro_veloz.*
class SecurityFilters {
def filters = {
loginCheck(controller:'*', action:'*') {
before = {
if(controllerName == null && actionName == null ){
println "controller e action null"
render(view: "index")
}else{

if(!session.usuario && actionName != "login") {
flash.message = "Você não tem permissão para acessar a página, por favor efetue o login"
redirect(uri:"/")
return false
}else if(session.usuario && actionName != "login"){
println "usuario esta logado e a action nao é login"
if(!session.usuario.admin){
println "usuario nao é administrador"
/*if(actionName == "logout"){
println 'entrou logout 1'
redirect(controller:"usuario", action:"list")
return false
}else{

}*/

println "Parametros: "+params
def uri = request.forwardURI
def gruposPermissoes = null
println uri

def count = 0
def b = UsuarioGrupo.findAllByUsuario(session.usuario)
boolean error = false
b.each { i ->

error = false

if(!error){
count++
println "Pesquisando UsuarioGrupo com grupo "+i.grupo.nome+" e usuario "+i.usuario.login

def p = Permissao.findByUrl('/carteiro_veloz_grails/'+controllerName+'/'+actionName+'/**')

if(p == null){
println "Permissao "+'/carteiro_veloz_grails/'+controllerName+'/'+actionName+'/**' + 'nao encontrada'


p = Permissao.findByUrl('/carteiro_veloz_grails/'+controllerName+'/'+actionName+'/*')

if(p == null){

println "Permissao "+'/carteiro_veloz_grails/'+controllerName+'/'+actionName+'/*' + 'nao encontrada'

p = Permissao.findByUrl(uri)

if(p == null){
println "Permissao "+uri+ ' nao encontrada'
error = true
}else{
println "Permissao encontrada 2"
gruposPermissoes = GrupoPermissao.findAllByPermissaoAndGrupo(p,i.grupo)
if(gruposPermissoes != null){
println "achou a permissao no banco de dados"
error = false
}else{
error = true
println "nao achou a permissao no banco de dados"
}
}
}else{

println "Permissao "+'/carteiro_veloz_grails/'+controllerName+'/'+actionName+'/*' + ' encontrada'

def temp = uri
def index1 = temp.lastIndexOf("/")
def j = '/carteiro_veloz_grails/'+controllerName+'/'+actionName+'/'
def index2 = j.lastIndexOf("/")

if(index2 != index1 ){
error = true
}else{
println "Permissao encontrada 1"
gruposPermissoes = GrupoPermissao.findAllByPermissaoAndGrupo(p,i.grupo)

if(gruposPermissoes != null){
println "achou a permissao no banco de dados"
error = false
}else{
error = true
println "nao achou a permissao no banco de dados"
}
}
}
}else{
println "Permissao encontrada 3"
println "Procurando permissao "+p.url+"para o grupo " +i.grupo.nome

gruposPermissoes = GrupoPermissao.findByPermissaoAndGrupo(p,i.grupo)

if(gruposPermissoes != null){
println "achou a permissao no banco de dados"
error = false
}else{
error = true
println "nao achou a permissao no banco de dados"
}
}
}
}

println "Contagem: "+count
if(gruposPermissoes == null || error){
println "teste 11"
flash.message = "Você não tem permissão para acessar a página."
redirect(controller:"usuario",action:"index")
return false
}else{
println controllerName + " - "+actionName
}
}
}
}

}
}
}
}


O código-fonte da classe usuário é:

package carteiro_veloz
class Usuario {

String login
String emailAlternativo
String senha
String nome
boolean ativo = true
boolean admin = false
Date dataCadastro = new Date()

static hasMany = [contatos:Contato]

static constraints = {
login blank: false, unique: true, email:true
senha blank: false, password:true
emailAlternativo blank:false,nullable:false
dataCadastro blank: false, nullable: false
nome blank: false, nullable: false
ativo blank: false, nullable:false
admin blank: false, nullable:false
}

static mapping = {
id(generator:'sequence',params:[sequence:'usuario_id_seq'])
table name: 'usuario'
table schema: 'acesso'
login column: 'login'
admin column: 'admin'
emailAlternativo column: 'email_alternativo'
ativo column: 'ativo'
senha column: 'senha'
version: false
}

Set<Grupo> getGrupos() {
UsuarioGrupo.findAllByUsuario(this).collect { it.grupo } as Set
}

String toString(){
return login
}
}


O controller de Usuário:

package carteiro_veloz

class UsuarioController {

static allowedMethods = [save&#58; &quot;POST&quot;, update&#58; &quot;POST&quot;, delete&#58; &quot;POST&quot;]

def index = {
redirect(action&#58; &quot;list&quot;, params&#58; params)
}

def login = {
if(request.get){
println &quot;view auth&quot;
render(view&#58;&quot;auth&quot;)
}else {
def u = Usuario.findByLogin(params.login)
println &quot;tentou encontrar usuario&quot;
if(u.ativo){
if(u) {
println &quot;usuario encontrado&quot;
params.senha = CriptografaSenha.criptografa(params.senha)
if(u.senha == params.senha) {
session.usuario = u
redirect(action&#58;&quot;index&quot;)
}
else {
flash.message = &quot;Usuario ou senha inválidos&quot;
render(view&#58;&quot;auth&quot;)
}
}
else {
println &quot;usuario nao encontado&quot;
flash.message = &quot;Usuario ou senha inválidos&quot;
render(view&#58;&quot;auth&quot;)
}
}else{
flash.message = &quot;Não existe o usuário informado no sistema.&quot;
render(view&#58;&quot;auth&quot;)
}

}
}

def logout = {
println &quot;entrou logout&quot;
session.usuario = null
session.invalidate()
redirect(controller&#58;&quot;usuario&quot;, action&#58;&quot;login&quot;)
}

def list = {
params.max = Math.min(params.max ? params.int('max') &#58; 10, 100)
[usuarioInstanceList&#58; Usuario.list(params), usuarioInstanceTotal&#58; Usuario.count()]
}

def create = {
def usuarioInstance = new Usuario()
usuarioInstance.properties = params
return [usuarioInstance&#58; usuarioInstance]
}

def save = {

println &quot;entrou no save&quot;

def user = Usuario.findByLogin(params.login)


if(user != null){
def usuarioInstance = new Usuario(params)
usuarioInstance.errors.rejectValue(&quot;login&quot;, &quot;default.usuario.alreadyCreated&quot;)
render(view&#58; &quot;create&quot;, model&#58; [usuarioInstance&#58; usuarioInstance])
}else{
if(!params.emailAlternativo.isEmpty() &amp;&amp; !params.login.isEmpty() &amp;&amp; params.emailAlternativo.equals(params.login)){
def usuarioInstance = new Usuario(params)
println 'entrou no email alternativo'
usuarioInstance.errors.rejectValue(&quot;emailAlternativo&quot;, &quot;default.usuario.emailAlternativoIgualLogin&quot;, [message(code&#58; 'default.usuario.emailAlternativoIgualLogin')] as Object[], &quot;O email alternativo não pode ser o mesmo do login. Insira um e-mail diferente.&quot;)
render(view&#58; &quot;create&quot;, model&#58; [usuarioInstance&#58; usuarioInstance])
}else{
def senha = &quot;&quot;;

if(!params.senha.isEmpty() &amp;&amp; params.senha != null ){
params.senha = CriptografaSenha.criptografa(params.senha)
senha = params.senha
}

def usuarioInstance = new Usuario(params)
if (usuarioInstance.save(flush&#58; true)) {
println &quot;entrou apos save&quot;
flash.message = &quot;${message(code&#58; 'default.created.message', args&#58; [message(code&#58; 'usuario.label', default&#58; 'Usuario'), usuarioInstance.id])}&quot;
redirect(action&#58; &quot;show&quot;, id&#58; usuarioInstance.id)
}
else {
usuarioInstance.senha = senha
render(view&#58; &quot;create&quot;, model&#58; [usuarioInstance&#58; usuarioInstance])
}
}
}
}


def show = {
println &quot;entrou no show&quot;
println &quot;procurando usuario de id&#58; &quot;+params.id
def usuarioInstance = Usuario.get(params.id)
if (!usuarioInstance) {
println &quot;nao achou o usuario&quot;
flash.message = &quot;${message(code&#58; 'default.not.found.message', args&#58; [message(code&#58; 'usuario.label', default&#58; 'Usuario'), params.id])}&quot;
redirect(action&#58; &quot;list&quot;)
return false
}
else {
println &quot;renderiza show&quot;
return [usuarioInstance&#58; usuarioInstance]
}
}

def edit = {
def usuarioInstance = Usuario.get(params.id)
if (!usuarioInstance) {
flash.message = &quot;${message(code&#58; 'default.not.found.message', args&#58; [message(code&#58; 'usuario.label', default&#58; 'Usuario'), params.id])}&quot;
redirect(action&#58; &quot;list&quot;)
}
else {
return [usuarioInstance&#58; usuarioInstance]
}
}

def update = {
def usuarioInstance = Usuario.get(params.id)
if (usuarioInstance) {
if (params.version) {
def version = params.version.toLong()
if (usuarioInstance.version > version) {

usuarioInstance.errors.rejectValue(&quot;version&quot;, &quot;default.optimistic.locking.failure&quot;, [message(code&#58; 'usuario.label', default&#58; 'Usuario')] as Object[], &quot;Another user has updated this Usuario while you were editing&quot;)
render(view&#58; &quot;edit&quot;, model&#58; [usuarioInstance&#58; usuarioInstance])
return
}
}

if(params.senha.length() != 128){
println 'entrou 128'
params.senha = CriptografaSenha.criptografa(params.senha)
}

usuarioInstance.properties = params
if (!usuarioInstance.hasErrors() &amp;&amp; usuarioInstance.save(flush&#58; true)) {
flash.message = &quot;${message(code&#58; 'default.updated.message', args&#58; [message(code&#58; 'usuario.label', default&#58; 'Usuario'), usuarioInstance.id])}&quot;
redirect(action&#58; &quot;show&quot;, id&#58; usuarioInstance.id)
}
else {
render(view&#58; &quot;edit&quot;, model&#58; [usuarioInstance&#58; usuarioInstance])
}
}
else {
flash.message = &quot;${message(code&#58; 'default.not.found.message', args&#58; [message(code&#58; 'usuario.label', default&#58; 'Usuario'), params.id])}&quot;
redirect(action&#58; &quot;list&quot;)
}
}

def delete = {
def usuarioInstance = Usuario.get(params.id)
if (usuarioInstance) {
usuarioInstance.ativo = false
try {
usuarioInstance.save(flush&#58; true)
flash.message = &quot;${message(code&#58; 'default.deleted.message', args&#58; [message(code&#58; 'usuario.label', default&#58; 'Usuario'), params.id])}&quot;
redirect(action&#58; &quot;list&quot;)
}
catch (org.springframework.dao.DataIntegrityViolationException e) {
flash.message = &quot;${message(code&#58; 'default.not.deleted.message', args&#58; [message(code&#58; 'usuario.label', default&#58; 'Usuario'), params.id])}&quot;
redirect(action&#58; &quot;show&quot;, id&#58; params.id)
}
}
else {
flash.message = &quot;${message(code&#58; 'default.not.found.message', args&#58; [message(code&#58; 'usuario.label', default&#58; 'Usuario'), params.id])}&quot;
redirect(action&#58; &quot;list&quot;)
}
}
}


E o erro aprensentado:

2010-08-03 14:56:51,231 [http-8080-3] ERROR [/carteiro_veloz_grails].[jsp] - Servlet.service() for servlet jsp threw exception
javax.servlet.ServletException: File &amp;quot;/WEB-INF/grails-app/views/filterConfig/index.jsp&amp;quot; not found
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:319)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:229)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callSafe(AbstractCallSite.java:104)
at org.codehaus.groovy.grails.plugins.web.filters.FilterToHandlerAdapter.renderModelAndView(FilterToHandlerAdapter.groovy:163)
at org.codehaus.groovy.grails.plugins.web.filters.FilterToHandlerAdapter.this$2$renderModelAndView(FilterToHandlerAdapter.groovy)
at org.codehaus.groovy.grails.plugins.web.filters.FilterToHandlerAdapter$this$2$renderModelAndView.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:143)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:163)
at org.codehaus.groovy.grails.plugins.web.filters.FilterToHandlerAdapter.preHandle(FilterToHandlerAdapter.groovy:113)
at org.springframework.web.servlet.HandlerInterceptor$preHandle.call(Unknown Source)
at org.codehaus.groovy.grails.plugins.web.filters.CompositeInterceptor.preHandle(CompositeInterceptor.groovy:42)
at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:281)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:286)
at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:260)
at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:251)
at org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter.doFilterInternal(UrlMappingsFilter.java:183)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.obtainContent(GrailsPageFilter.java:245)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.doFilter(GrailsPageFilter.java:134)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.codehaus.groovy.grails.web.servlet.filter.GrailsReloadServletFilter.doFilterInternal(GrailsReloadServletFilter.java:104)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:67)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.codehaus.groovy.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:69)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
2010-08-03 14:56:51,283 [http-8080-3] ERROR errors.GrailsExceptionResolver - File &amp;quot;/WEB-INF/grails-app/views/filterConfig/index.jsp&amp;quot; not found
javax.servlet.ServletException: File &amp;quot;/WEB-INF/grails-app/views/filterConfig/index.jsp&amp;quot; not found
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:319)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at java.lang.Thread.run(Thread.java:619)

E aí, por favor, me dêem uma luz, porque tá ocorrendo isso?
Tags: Grails


0
uma coisa, reparei que as constraints do Usuario estão sem parenteses, talvez seja esse o problema da exception.

static constraints = {
login blank&#58; false, unique&#58; true, email&#58;true
senha blank&#58; false, password&#58;true
emailAlternativo blank&#58;false,nullable&#58;false
dataCadastro blank&#58; false, nullable&#58; false
nome blank&#58; false, nullable&#58; false
ativo blank&#58; false, nullable&#58;false
admin blank&#58; false, nullable&#58;false
}


deixe assim:

static constraints = {
login (blank&#58; false, unique&#58; true, email&#58;true)
senha (blank&#58; false, password&#58;true)
emailAlternativo (blank&#58;false,nullable&#58;false)
dataCadastro (blank&#58; false, nullable&#58; false)
nome (blank&#58; false, nullable&#58; false)
ativo (blank&#58; false, nullable&#58;false)
admin (blank&#58; false, nullable&#58;false)
}


outra coisa,

acredito que você não precise das entidades UsuarioGrupo e GrupoPermissao

Você vai mapear as entidades como many-to-many dá uma olhada na documentação do grails para esse mapeamento.
03/08/2010 00:00



Ainda não faz parte da comunidade???

Para se registrar, clique aqui.


Aprenda Groovy e Grails com a Formação itexto!

Newsletter Semana Groovy

Assinar

Envie seu link!


Livro de Grails


/dev/All

Os melhores blogs de TI (e em português) em um único lugar!

 
Creative Commons
RSS Grails Brasil é mantido por itexto Consultoria.
Em caso de problemas contacte Henrique Lobo Weissmann (Kico) por e-mail: kico@itexto.com.br
Todo o conteúdo presente neste site adota o Creative Commons como licença padrão.
Ver: 4.14.0
itexto