1. java
  2. android
  3. c#
  4. .net
  5. javascript
  6. php
  7. jquery
  8. html
  9. sql

VRaptor Brutauth interceptar IDs de entidade

Boa tarde,

Estou tentando usar o VRaptor Brutauth no meu projeto, mas estou tendo problema quando quero validar se o usuario pode acessar um metódo do controlador que recebe um id (Long)

    public boolean isAllowed(Long id) { ... }

No controlador eu tenho o seguinte método:

    @Override
    @Transacional
    @CustomBrutauthRules(PodeManipularFonteDados.class)
    public void remover(Long id) { ... }

Quando executo o método estou recebendo o seguinte erro:

br.com.caelum.vraptor.InterceptionException: com.thoughtworks.paranamer.ParameterNamesNotFoundException: Unable to get class bytes
    at br.com.caelum.vraptor.interceptor.StepInvoker.invokeMethod(StepInvoker.java:68) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.StepInvoker.tryToInvoke(StepInvoker.java:54) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.StepInvoker$Proxy$_$$_WeldClientProxy.tryToInvoke(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.InterceptorExecutor.executeAround(InterceptorExecutor.java:75) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.InterceptorExecutor$Proxy$_$$_WeldClientProxy.executeAround(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.AspectStyleInterceptorHandler.execute(AspectStyleInterceptorHandler.java:87) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.core.DefaultInterceptorStack$Proxy$_$$_WeldClientProxy.next(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.DefaultSimpleInterceptorStack.next(DefaultSimpleInterceptorStack.java:49) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.DefaultSimpleInterceptorStack$Proxy$_$$_WeldClientProxy.next(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.logique.lsvraptorarq.interceptador.ExcecaoInterceptador.trataExcecao(ExcecaoInterceptador.java:55) ~[VRaptor-arq-1.1-SNAPSHOT.jar:na]
    at br.com.logique.lsvraptorarq.interceptador.ExcecaoInterceptador$Proxy$_$$_WeldClientProxy.trataExcecao(Unknown Source) [VRaptor-arq-1.1-SNAPSHOT.jar:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_79]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_79]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]
    at net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:38) [mirror-1.6.1.jar:na]
    at net.vidageek.mirror.invoke.MethodHandlerByMethod.withArgs(MethodHandlerByMethod.java:54) [mirror-1.6.1.jar:na]
    at br.com.caelum.vraptor.interceptor.StepInvoker.invokeMethod(StepInvoker.java:63) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.StepInvoker.tryToInvoke(StepInvoker.java:54) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.StepInvoker$Proxy$_$$_WeldClientProxy.tryToInvoke(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.InterceptorExecutor.executeAround(InterceptorExecutor.java:75) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.InterceptorExecutor$Proxy$_$$_WeldClientProxy.executeAround(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.AspectStyleInterceptorHandler.execute(AspectStyleInterceptorHandler.java:87) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.FlashInterceptor.intercept(FlashInterceptor.java:98) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.FlashInterceptor$Proxy$_$$_WeldClientProxy.intercept(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:58) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.core.DefaultInterceptorStack$Proxy$_$$_WeldClientProxy.next(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.DefaultSimpleInterceptorStack.next(DefaultSimpleInterceptorStack.java:49) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.DefaultSimpleInterceptorStack$Proxy$_$$_WeldClientProxy.next(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.simplemail.AsyncMailerFlushInterceptor.intercept(AsyncMailerFlushInterceptor.java:33) [vraptor-simplemail-4.0.0.jar:na]
    at br.com.caelum.vraptor.simplemail.AsyncMailerFlushInterceptor$Proxy$_$$_WeldClientProxy.intercept(Unknown Source) [vraptor-simplemail-4.0.0.jar:na]
    at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source) ~[na:na]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]
    at net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:38) [mirror-1.6.1.jar:na]
    at net.vidageek.mirror.invoke.MethodHandlerByMethod.withArgs(MethodHandlerByMethod.java:54) [mirror-1.6.1.jar:na]
    at br.com.caelum.vraptor.interceptor.StepInvoker.invokeMethod(StepInvoker.java:63) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.StepInvoker.tryToInvoke(StepInvoker.java:54) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.StepInvoker$Proxy$_$$_WeldClientProxy.tryToInvoke(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.InterceptorExecutor.executeAround(InterceptorExecutor.java:75) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.InterceptorExecutor$Proxy$_$$_WeldClientProxy.executeAround(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.AspectStyleInterceptorHandler.execute(AspectStyleInterceptorHandler.java:87) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.AspectStyleInterceptorHandler.execute(AspectStyleInterceptorHandler.java:90) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.core.DefaultInterceptorStack.start(DefaultInterceptorStack.java:93) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.core.DefaultInterceptorStack$Proxy$_$$_WeldClientProxy.start(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.observer.RequestHandlerObserver.handle(RequestHandlerObserver.java:86) [vraptor-4.0.0.Final.jar:na]
    at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source) ~[na:na]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]
    at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:266) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:253) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
    at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:232) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
    at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:169) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
    at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:165) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
    at org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:119) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
    at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:112) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
    at org.jboss.weld.event.EventImpl.fire(EventImpl.java:83) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
    at br.com.caelum.vraptor.VRaptor.doFilter(VRaptor.java:116) [vraptor-4.0.0.Final.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.61]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.61]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) [catalina.jar:7.0.61]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.61]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) [catalina.jar:7.0.61]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) [catalina.jar:7.0.61]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:7.0.61]
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) [catalina.jar:7.0.61]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.61]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423) [catalina.jar:7.0.61]
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079) [tomcat-coyote.jar:7.0.61]
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620) [tomcat-coyote.jar:7.0.61]
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2476) [tomcat-coyote.jar:7.0.61]
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2465) [tomcat-coyote.jar:7.0.61]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.61]
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]
Caused by: com.thoughtworks.paranamer.ParameterNamesNotFoundException: Unable to get class bytes
    at com.thoughtworks.paranamer.BytecodeReadingParanamer.lookupParameterNames(BytecodeReadingParanamer.java:95) ~[paranamer-2.6.jar:na]
    at com.thoughtworks.paranamer.AdaptiveParanamer.lookupParameterNames(AdaptiveParanamer.java:75) ~[paranamer-2.6.jar:na]
    at com.thoughtworks.paranamer.CachingParanamer.lookupParameterNames(CachingParanamer.java:79) ~[paranamer-2.6.jar:na]
    at br.com.caelum.brutauth.reflection.NamedParametersMethod.getParameters(NamedParametersMethod.java:19) ~[vraptor-brutauth-4.0.1.Final.jar:na]
    at br.com.caelum.brutauth.reflection.methodsearchers.AdaptedMethodSearcher.search(AdaptedMethodSearcher.java:33) ~[vraptor-brutauth-4.0.1.Final.jar:na]
    at br.com.caelum.brutauth.reflection.methodsearchers.MethodSearchers.search(MethodSearchers.java:17) ~[vraptor-brutauth-4.0.1.Final.jar:na]
    at br.com.caelum.brutauth.reflection.DefaultMethodInvoker.invoke(DefaultMethodInvoker.java:13) ~[vraptor-brutauth-4.0.1.Final.jar:na]
    at br.com.caelum.brutauth.verifier.CustomBrutauthRulesVerifier.rulesAllows(CustomBrutauthRulesVerifier.java:51) ~[vraptor-brutauth-4.0.1.Final.jar:na]
    at br.com.caelum.brutauth.verifier.CustomBrutauthRulesVerifier.rulesOfTypeAllows(CustomBrutauthRulesVerifier.java:42) ~[vraptor-brutauth-4.0.1.Final.jar:na]
    at br.com.caelum.brutauth.interceptors.CustomBrutauthRuleInterceptor.intercept(CustomBrutauthRuleInterceptor.java:37) ~[vraptor-brutauth-4.0.1.Final.jar:na]
    at br.com.caelum.brutauth.interceptors.CustomBrutauthRuleInterceptor$Proxy$_$$_WeldClientProxy.intercept(Unknown Source) ~[vraptor-brutauth-4.0.1.Final.jar:na]
    at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:58) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.core.DefaultInterceptorStack$Proxy$_$$_WeldClientProxy.next(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.DefaultSimpleInterceptorStack.next(DefaultSimpleInterceptorStack.java:49) [vraptor-4.0.0.Final.jar:na]
    at br.com.caelum.vraptor.interceptor.DefaultSimpleInterceptorStack$Proxy$_$$_WeldClientProxy.next(Unknown Source) [vraptor-4.0.0.Final.jar:na]
    at br.com.logique.bralarmexpert.autenticacao.interceptador.AutenticacaoInterceptor.verificaAutenticacao(AutenticacaoInterceptor.java:40) ~[AutenticacaoInterceptor.class:na]
    at br.com.logique.bralarmexpert.autenticacao.interceptador.AutenticacaoInterceptor$Proxy$_$$_WeldClientProxy.verificaAutenticacao(Unknown Source) ~[AutenticacaoInterceptor.class:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_79]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_79]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]
    at net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:38) [mirror-1.6.1.jar:na]
    at net.vidageek.mirror.invoke.MethodHandlerByMethod.withArgs(MethodHandlerByMethod.java:54) [mirror-1.6.1.jar:na]
    at br.com.caelum.vraptor.interceptor.StepInvoker.invokeMethod(StepInvoker.java:63) [vraptor-4.0.0.Final.jar:na]
    ... 81 common frames omitted

Uma segunda regra, que checa se o usuário pode salvar uma entidade, funciona normalmente.

public boolean isAllowed(FonteDados fonteDados) {...}

Estou me perguntando se o plugin não permite que regras que recebam tipos primitivos (ou os seus Wrappers) ou se eu estou fazendo alguma coisa muito errada.

  1. Você vai ver essas setas em qualquer página de pergunta. Com elas, você pode dizer se uma pergunta ou uma resposta foram relevantes ou não.
  2. Edite sua pergunta ou resposta caso queira alterar ou adicionar detalhes.
  3. Caso haja alguma dúvida sobre a pergunta, adicione um comentário. O espaço de respostas deve ser utilizado apenas para responder a pergunta.
  4. Se o autor da pergunta marcar uma resposta como solucionada, esta marca aparecerá.
  5. Clique aqui para mais detalhes sobre o funcionamento do GUJ!

1 resposta

Não é a resposta que estava procurando? Procure outras perguntas com as tags vraptor ou faça a sua própria pergunta.