yorgan 22 de fev. de 2011
Segue o stacktrace quando eu não coloco o construtor sem argumentos:
22 : 30 : 13 , 302 ERROR [ org.apache.catalina.core.ContainerBase.[jboss.web ] . [ localhost ] . [ /app ] . [ default ] ] Servlet . service () for servlet default threw exception : org . springframework . beans . factory . BeanCreationException : Error creating bean with name 'homeController' : Initialization of bean failed ; nested exception is org . springframework . aop . framework . AopConfigException : Could not generate CGLIB subclass of class [ class br.com.k2studio.climp.web.controller.secure.HomeController ] : Common causes of this problem include using a final class or a non - visible class ; nested exception is java . lang . IllegalArgumentException : Superclass has no null constructors but no arguments were given
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . doCreateBean ( AbstractAutowireCapableBeanFactory . java : 527 ) [ :3.0.5.RELEASE ]
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . createBean ( AbstractAutowireCapableBeanFactory . java : 456 ) [ :3.0.5.RELEASE ]
at org . springframework . beans . factory . support . AbstractBeanFactory $ 2. getObject ( AbstractBeanFactory . java : 329 ) [ :3.0.5.RELEASE ]
at org . springframework . web . context . request . AbstractRequestAttributesScope . get ( AbstractRequestAttributesScope . java : 43 ) [ :3.0.5.RELEASE ]
at org . springframework . beans . factory . support . AbstractBeanFactory . doGetBean ( AbstractBeanFactory . java : 325 ) [ :3.0.5.RELEASE ]
at org . springframework . beans . factory . support . AbstractBeanFactory . getBean ( AbstractBeanFactory . java : 194 ) [ :3.0.5.RELEASE ]
at org . springframework . beans . factory . support . DefaultListableBeanFactory . getBean ( DefaultListableBeanFactory . java : 263 ) [ :3.0.5.RELEASE ]
at org . springframework . context . support . AbstractApplicationContext . getBean ( AbstractApplicationContext . java : 1083 ) [ :3.0.5.RELEASE ]
at br . com . caelum . vraptor . ioc . spring . SpringBasedContainer . instanceFor ( SpringBasedContainer . java : 86 ) [ : ]
at br . com . caelum . vraptor . interceptor . InstantiateInterceptor . intercept ( InstantiateInterceptor . java : 46 ) [ : ]
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 ) [ : ]
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 ) [ : ]
at br . com . caelum . vraptor . interceptor . ResourceLookupInterceptor . intercept ( ResourceLookupInterceptor . java : 69 ) [ : ]
at br . com . caelum . vraptor . core . ToInstantiateInterceptorHandler . execute ( ToInstantiateInterceptorHandler . java : 54 ) [ : ]
at br . com . caelum . vraptor . core . DefaultInterceptorStack . next ( DefaultInterceptorStack . java : 54 ) [ : ]
at br . com . caelum . vraptor . core . EnhancedRequestExecution . execute ( EnhancedRequestExecution . java : 23 ) [ : ]
at br . com . caelum . vraptor . VRaptor $ 1. insideRequest ( VRaptor . java : 92 ) [ : ]
at br . com . caelum . vraptor . ioc . spring . SpringProvider . provideForRequest ( SpringProvider . java : 58 ) [ : ]
at br . com . caelum . vraptor . VRaptor . doFilter ( VRaptor . java : 89 ) [ : ]
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 274 ) [ :6.0.0.Final ]
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 242 ) [ :6.0.0.Final ]
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 368 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . access . intercept . FilterSecurityInterceptor . invoke ( FilterSecurityInterceptor . java : 109 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . access . intercept . FilterSecurityInterceptor . doFilter ( FilterSecurityInterceptor . java : 83 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 380 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . access . ExceptionTranslationFilter . doFilter ( ExceptionTranslationFilter . java : 97 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 380 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . session . SessionManagementFilter . doFilter ( SessionManagementFilter . java : 100 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 380 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . authentication . AnonymousAuthenticationFilter . doFilter ( AnonymousAuthenticationFilter . java : 78 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 380 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . servletapi . SecurityContextHolderAwareRequestFilter . doFilter ( SecurityContextHolderAwareRequestFilter . java : 54 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 380 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . savedrequest . RequestCacheAwareFilter . doFilter ( RequestCacheAwareFilter . java : 35 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 380 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . authentication . www . BasicAuthenticationFilter . doFilter ( BasicAuthenticationFilter . java : 177 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 380 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . authentication . AbstractAuthenticationProcessingFilter . doFilter ( AbstractAuthenticationProcessingFilter . java : 187 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 380 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . authentication . logout . LogoutFilter . doFilter ( LogoutFilter . java : 105 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 380 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . context . SecurityContextPersistenceFilter . doFilter ( SecurityContextPersistenceFilter . java : 79 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 380 ) [ :3.0.5.RELEASE ]
at org . springframework . security . web . FilterChainProxy . doFilter ( FilterChainProxy . java : 169 ) [ :3.0.5.RELEASE ]
at org . springframework . web . filter . DelegatingFilterProxy . invokeDelegate ( DelegatingFilterProxy . java : 237 ) [ :3.0.5.RELEASE ]
at org . springframework . web . filter . DelegatingFilterProxy . doFilter ( DelegatingFilterProxy . java : 167 ) [ :3.0.5.RELEASE ]
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 274 ) [ :6.0.0.Final ]
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 242 ) [ :6.0.0.Final ]
at org . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 275 ) [ :6.0.0.Final ]
at org . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 191 ) [ :6.0.0.Final ]
at org . jboss . web . tomcat . security . SecurityAssociationValve . invoke ( SecurityAssociationValve . java : 181 ) [ :6.0.0.Final ]
at org . jboss . modcluster . catalina . CatalinaContext $ RequestListenerValve . event ( CatalinaContext . java : 285 ) [ :1.1.0.Final ]
at org . jboss . modcluster . catalina . CatalinaContext $ RequestListenerValve . invoke ( CatalinaContext . java : 261 ) [ :1.1.0.Final ]
at org . jboss . web . tomcat . security . JaccContextValve . invoke ( JaccContextValve . java : 88 ) [ :6.0.0.Final ]
at org . jboss . web . tomcat . security . SecurityContextEstablishmentValve . invoke ( SecurityContextEstablishmentValve . java : 100 ) [ :6.0.0.Final ]
at org . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 127 ) [ :6.0.0.Final ]
at org . apache . catalina . valves . ErrorReportValve . invoke ( ErrorReportValve . java : 102 ) [ :6.0.0.Final ]
at org . jboss . web . tomcat . service . jca . CachedConnectionValve . invoke ( CachedConnectionValve . java : 158 ) [ :6.0.0.Final ]
at org . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 109 ) [ :6.0.0.Final ]
at org . jboss . web . tomcat . service . request . ActiveRequestResponseCacheValve . invoke ( ActiveRequestResponseCacheValve . java : 53 ) [ :6.0.0.Final ]
at org . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 362 ) [ :6.0.0.Final ]
at org . apache . coyote . http11 . Http11Processor . process ( Http11Processor . java : 877 ) [ :6.0.0.Final ]
at org . apache . coyote . http11 . Http11Protocol $ Http11ConnectionHandler . process ( Http11Protocol . java : 654 ) [ :6.0.0.Final ]
at org . apache . tomcat . util . net . JIoEndpoint $ Worker . run ( JIoEndpoint . java : 951 ) [ :6.0.0.Final ]
at java . lang . Thread . run ( Thread . java : 680 ) [ :1.6.0_22 ]
Caused by : org . springframework . aop . framework . AopConfigException : Could not generate CGLIB subclass of class [ class br.com.k2studio.climp.web.controller.secure.HomeController ] : Common causes of this problem include using a final class or a non - visible class ; nested exception is java . lang . IllegalArgumentException : Superclass has no null constructors but no arguments were given
at org . springframework . aop . framework . Cglib2AopProxy . getProxy ( Cglib2AopProxy . java : 212 ) [ :3.0.5.RELEASE ]
at org . springframework . aop . framework . ProxyFactory . getProxy ( ProxyFactory . java : 112 ) [ :3.0.5.RELEASE ]
at org . springframework . aop . framework . autoproxy . AbstractAutoProxyCreator . createProxy ( AbstractAutoProxyCreator . java : 476 ) [ :3.0.5.RELEASE ]
at org . springframework . aop . framework . autoproxy . AbstractAutoProxyCreator . wrapIfNecessary ( AbstractAutoProxyCreator . java : 362 ) [ :3.0.5.RELEASE ]
at org . springframework . aop . framework . autoproxy . AbstractAutoProxyCreator . postProcessAfterInitialization ( AbstractAutoProxyCreator . java : 322 ) [ :3.0.5.RELEASE ]
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . applyBeanPostProcessorsAfterInitialization ( AbstractAutowireCapableBeanFactory . java : 407 ) [ :3.0.5.RELEASE ]
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . initializeBean ( AbstractAutowireCapableBeanFactory . java : 1426 ) [ :3.0.5.RELEASE ]
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . doCreateBean ( AbstractAutowireCapableBeanFactory . java : 519 ) [ :3.0.5.RELEASE ]
... 64 more
Caused by : java . lang . IllegalArgumentException : Superclass has no null constructors but no arguments were given
at net . sf . cglib . proxy . Enhancer . emitConstructors ( Enhancer . java : 718 ) [ : ]
at net . sf . cglib . proxy . Enhancer . generateClass ( Enhancer . java : 499 ) [ : ]
at net . sf . cglib . transform . TransformingClassGenerator . generateClass ( TransformingClassGenerator . java : 33 ) [ : ]
at net . sf . cglib . core . DefaultGeneratorStrategy . generate ( DefaultGeneratorStrategy . java : 25 ) [ : ]
at net . sf . cglib . core . AbstractClassGenerator . create ( AbstractClassGenerator . java : 216 ) [ : ]
at net . sf . cglib . proxy . Enhancer . createHelper ( Enhancer . java : 377 ) [ : ]
at net . sf . cglib . proxy . Enhancer . create ( Enhancer . java : 285 ) [ : ]
at org . springframework . aop . framework . Cglib2AopProxy . getProxy ( Cglib2AopProxy . java : 200 ) [ :3.0.5.RELEASE ]
... 71 more
yorgan 22 de fev. de 2011
Resolvido.
Anotei o construtor default com @Deprecated e o outro com @Autowired .
Bobagem minha, eu já tinha visto isso num post antigo meu onde discutimos sobre um tutorial de Spring Security.
[]'s
Daniel
Lucas_Cavalcanti 22 de fev. de 2011
tem duas coisas que vc pode fazer:
transformar o construtor num init method:
@Inject
public init ( Result result , HttpServletRequest request , ...) {
this . result = result ;
this . request = request ;
}
e a outra seria tentar mover a lógica do controle pra um component com interface/implementação, e anotar esse componente com @RolesAllowed .
talvez dê pra mudar o VRaptor, mas precisaria estudar direito como
juniorsatanas 10 de mar. de 2011
yorgan boa noite !
Tu consegue setar esse usuario logado e mandar o nome dele para o banco ?
jr.