drsmachado 11 de abr. de 2013
Posta o stackTrace completo, só essa linha dá muitas margens.
macbird 11 de abr. de 2013
trace
org . springframework . beans . factory . BeanCreationException : Error creating bean with name 'licencaBean' defined in file [ C : \Users \João Paulo \Steelbox2 \target \classes \br \com \aj2 \web \util \licencaBean . class ]: Instantiation of bean failed ; nested exception is org . springframework . beans . BeanInstantiationException : Could not instantiate bean class [ br . com . aj2 . web . util . licencaBean ]: Constructor threw exception ; nested exception is java . lang . NullPointerException
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . instantiateBean ( AbstractAutowireCapableBeanFactory . java : 1011 )
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . createBeanInstance ( AbstractAutowireCapableBeanFactory . java : 957 )
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . doCreateBean ( AbstractAutowireCapableBeanFactory . java : 490 )
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . createBean ( AbstractAutowireCapableBeanFactory . java : 461 )
at org . springframework . beans . factory . support . AbstractBeanFactory $ 2. getObject ( AbstractBeanFactory . java : 333 )
at org . springframework . web . context . request . AbstractRequestAttributesScope . get ( AbstractRequestAttributesScope . java : 43 )
at org . springframework . web . context . request . SessionScope . get ( SessionScope . java : 92 )
at org . springframework . beans . factory . support . AbstractBeanFactory . doGetBean ( AbstractBeanFactory . java : 329 )
at org . springframework . beans . factory . support . AbstractBeanFactory . getBean ( AbstractBeanFactory . java : 194 )
at org . springframework . context . support . AbstractApplicationContext . getBean ( AbstractApplicationContext . java : 1117 )
at org . springframework . beans . factory . access . el . SpringBeanELResolver . getValue ( SpringBeanELResolver . java : 56 )
at br . com . aj2 . web . conversation . ConversationAwareElResolver . getValue ( ConversationAwareElResolver . java : 35 )
at com . sun . faces . el . DemuxCompositeELResolver . _getValue ( DemuxCompositeELResolver . java : 176 )
at com . sun . faces . el . DemuxCompositeELResolver . getValue ( DemuxCompositeELResolver . java : 203 )
at org . jboss . el . parser . AstIdentifier . getValue ( AstIdentifier . java : 44 )
at org . jboss . el . parser . AstValue . getValue ( AstValue . java : 63 )
at org . jboss . el . ValueExpressionImpl . getValue ( ValueExpressionImpl . java : 186 )
at com . sun . faces . facelets . el . TagValueExpression . getValue ( TagValueExpression . java : 109 )
at javax . faces . component . ComponentStateHelper . eval ( ComponentStateHelper . java : 194 )
at javax . faces . component . ComponentStateHelper . eval ( ComponentStateHelper . java : 182 )
at javax . faces . component . UIOutput . getValue ( UIOutput . java : 169 )
at com . sun . faces . renderkit . html_basic . HtmlBasicInputRenderer . getValue ( HtmlBasicInputRenderer . java : 205 )
at com . sun . faces . renderkit . html_basic . HtmlBasicRenderer . getCurrentValue ( HtmlBasicRenderer . java : 355 )
at com . sun . faces . renderkit . html_basic . HtmlBasicRenderer . encodeEnd ( HtmlBasicRenderer . java : 164 )
at javax . faces . component . UIComponentBase . encodeEnd ( UIComponentBase . java : 875 )
at org . primefaces . renderkit . CoreRenderer . renderChild ( CoreRenderer . java : 60 )
at org . primefaces . renderkit . CoreRenderer . renderChildren ( CoreRenderer . java : 44 )
at org . primefaces . component . panel . PanelRenderer . encodeContent ( PanelRenderer . java : 207 )
at org . primefaces . component . panel . PanelRenderer . encodeMarkup ( PanelRenderer . java : 124 )
at org . primefaces . component . panel . PanelRenderer . encodeEnd ( PanelRenderer . java : 55 )
at javax . faces . component . UIComponentBase . encodeEnd ( UIComponentBase . java : 875 )
at org . primefaces . renderkit . CoreRenderer . renderChild ( CoreRenderer . java : 60 )
at org . primefaces . renderkit . CoreRenderer . renderChildren ( CoreRenderer . java : 44 )
at org . primefaces . component . layout . LayoutUnitRenderer . encodeEnd ( LayoutUnitRenderer . java : 51 )
at javax . faces . component . UIComponentBase . encodeEnd ( UIComponentBase . java : 875 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1786 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1782 )
at javax . faces . render . Renderer . encodeChildren ( Renderer . java : 168 )
at javax . faces . component . UIComponentBase . encodeChildren ( UIComponentBase . java : 845 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1779 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1782 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1782 )
at com . sun . faces . application . view . FaceletViewHandlingStrategy . renderView ( FaceletViewHandlingStrategy . java : 437 )
at com . sun . faces . application . view . MultiViewHandler . renderView ( MultiViewHandler . java : 124 )
at javax . faces . application . ViewHandlerWrapper . renderView ( ViewHandlerWrapper . java : 286 )
at com . sun . faces . lifecycle . RenderResponsePhase . execute ( RenderResponsePhase . java : 120 )
at com . sun . faces . lifecycle . Phase . doPhase ( Phase . java : 101 )
at com . sun . faces . lifecycle . LifecycleImpl . render ( LifecycleImpl . java : 139 )
at javax . faces . webapp . FacesServlet . service ( FacesServlet . java : 594 )
at org . eclipse . jetty . servlet . ServletHolder . handle ( ServletHolder . java : 652 )
at org . eclipse . jetty . servlet . ServletHandler $ CachedChain . doFilter ( ServletHandler . java : 1329 )
at org . springframework . orm . jpa . support . OpenEntityManagerInViewFilter . doFilterInternal ( OpenEntityManagerInViewFilter . java : 180 )
at org . springframework . web . filter . OncePerRequestFilter . doFilter ( OncePerRequestFilter . java : 107 )
at org . eclipse . jetty . servlet . ServletHandler $ CachedChain . doFilter ( ServletHandler . java : 1300 )
at br . com . aj2 . web . conversation . ConversationFilter . doFilter ( ConversationFilter . java : 99 )
at org . springframework . web . filter . DelegatingFilterProxy . invokeDelegate ( DelegatingFilterProxy . java : 346 )
at org . springframework . web . filter . DelegatingFilterProxy . doFilter ( DelegatingFilterProxy . java : 259 )
at org . eclipse . jetty . servlet . ServletHandler $ CachedChain . doFilter ( ServletHandler . java : 1300 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 330 )
at org . springframework . security . web . access . intercept . FilterSecurityInterceptor . invoke ( FilterSecurityInterceptor . java : 118 )
at org . springframework . security . web . access . intercept . FilterSecurityInterceptor . doFilter ( FilterSecurityInterceptor . java : 84 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 342 )
at org . springframework . security . web . access . ExceptionTranslationFilter . doFilter ( ExceptionTranslationFilter . java : 113 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 342 )
at org . springframework . security . web . session . SessionManagementFilter . doFilter ( SessionManagementFilter . java : 103 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 342 )
at org . springframework . security . web . authentication . AnonymousAuthenticationFilter . doFilter ( AnonymousAuthenticationFilter . java : 113 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 342 )
at org . springframework . security . web . servletapi . SecurityContextHolderAwareRequestFilter . doFilter ( SecurityContextHolderAwareRequestFilter . java : 54 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 342 )
at org . springframework . security . web . savedrequest . RequestCacheAwareFilter . doFilter ( RequestCacheAwareFilter . java : 45 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 342 )
at org . springframework . security . web . authentication . www . BasicAuthenticationFilter . doFilter ( BasicAuthenticationFilter . java : 150 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 342 )
at org . springframework . security . web . authentication . AbstractAuthenticationProcessingFilter . doFilter ( AbstractAuthenticationProcessingFilter . java : 183 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 342 )
at org . springframework . security . web . authentication . logout . LogoutFilter . doFilter ( LogoutFilter . java : 105 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 342 )
at org . springframework . security . web . context . SecurityContextPersistenceFilter . doFilter ( SecurityContextPersistenceFilter . java : 87 )
at org . springframework . security . web . FilterChainProxy $ VirtualFilterChain . doFilter ( FilterChainProxy . java : 342 )
at org . springframework . security . web . FilterChainProxy . doFilterInternal ( FilterChainProxy . java : 192 )
at org . springframework . security . web . FilterChainProxy . doFilter ( FilterChainProxy . java : 160 )
at org . springframework . web . filter . DelegatingFilterProxy . invokeDelegate ( DelegatingFilterProxy . java : 346 )
at org . springframework . web . filter . DelegatingFilterProxy . doFilter ( DelegatingFilterProxy . java : 259 )
at org . eclipse . jetty . servlet . ServletHandler $ CachedChain . doFilter ( ServletHandler . java : 1300 )
at br . com . aj2 . web . conversation . SessionExpirationFilter . doFilter ( SessionExpirationFilter . java : 45 )
at org . springframework . web . filter . DelegatingFilterProxy . invokeDelegate ( DelegatingFilterProxy . java : 346 )
at org . springframework . web . filter . DelegatingFilterProxy . doFilter ( DelegatingFilterProxy . java : 259 )
at org . eclipse . jetty . servlet . ServletHandler $ CachedChain . doFilter ( ServletHandler . java : 1300 )
at org . primefaces . webapp . filter . FileUploadFilter . doFilter ( FileUploadFilter . java : 79 )
at org . eclipse . jetty . servlet . ServletHandler $ CachedChain . doFilter ( ServletHandler . java : 1300 )
at org . omnifaces . filter . GzipResponseFilter . doFilter ( GzipResponseFilter . java : 148 )
at org . omnifaces . filter . HttpFilter . doFilter ( HttpFilter . java : 75 )
at org . eclipse . jetty . servlet . ServletHandler $ CachedChain . doFilter ( ServletHandler . java : 1300 )
at org . eclipse . jetty . servlet . ServletHandler . doHandle ( ServletHandler . java : 445 )
at org . eclipse . jetty . server . handler . ScopedHandler . handle ( ScopedHandler . java : 137 )
at org . eclipse . jetty . security . SecurityHandler . handle ( SecurityHandler . java : 559 )
at org . eclipse . jetty . server . session . SessionHandler . doHandle ( SessionHandler . java : 227 )
at org . eclipse . jetty . server . handler . ContextHandler . doHandle ( ContextHandler . java : 1038 )
at org . eclipse . jetty . servlet . ServletHandler . doScope ( ServletHandler . java : 374 )
at org . eclipse . jetty . server . session . SessionHandler . doScope ( SessionHandler . java : 189 )
at org . eclipse . jetty . server . handler . ContextHandler . doScope ( ContextHandler . java : 972 )
at org . eclipse . jetty . server . handler . ScopedHandler . handle ( ScopedHandler . java : 135 )
at org . eclipse . jetty . server . handler . ContextHandlerCollection . handle ( ContextHandlerCollection . java : 255 )
at org . eclipse . jetty . server . handler . HandlerCollection . handle ( HandlerCollection . java : 154 )
at org . eclipse . jetty . server . handler . HandlerWrapper . handle ( HandlerWrapper . java : 116 )
at org . eclipse . jetty . server . Server . handle ( Server . java : 363 )
at org . eclipse . jetty . server . AbstractHttpConnection . handleRequest ( AbstractHttpConnection . java : 483 )
at org . eclipse . jetty . server . AbstractHttpConnection . headerComplete ( AbstractHttpConnection . java : 920 )
at org . eclipse . jetty . server . AbstractHttpConnection $ RequestHandler . headerComplete ( AbstractHttpConnection . java : 982 )
at org . eclipse . jetty . http . HttpParser . parseNext ( HttpParser . java : 635 )
at org . eclipse . jetty . http . HttpParser . parseAvailable ( HttpParser . java : 235 )
at org . eclipse . jetty . server . AsyncHttpConnection . handle ( AsyncHttpConnection . java : 82 )
at org . eclipse . jetty . io . nio . SelectChannelEndPoint . handle ( SelectChannelEndPoint . java : 627 )
at org . eclipse . jetty . io . nio . SelectChannelEndPoint $ 1. run ( SelectChannelEndPoint . java : 51 )
at org . eclipse . jetty . util . thread . QueuedThreadPool . runJob ( QueuedThreadPool . java : 608 )
at org . eclipse . jetty . util . thread . QueuedThreadPool $ 3. run ( QueuedThreadPool . java : 543 )
at java . lang . Thread . run ( Thread . java : 722 )
Caused by : org . springframework . beans . BeanInstantiationException : Could not instantiate bean class [ br . com . aj2 . web . util . licencaBean ]: Constructor threw exception ; nested exception is java . lang . NullPointerException
at org . springframework . beans . BeanUtils . instantiateClass ( BeanUtils . java : 163 )
at org . springframework . beans . factory . support . SimpleInstantiationStrategy . instantiate ( SimpleInstantiationStrategy . java : 87 )
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . instantiateBean ( AbstractAutowireCapableBeanFactory . java : 1004 )
... 117 more
Caused by : java . lang . NullPointerException
at br . com . aj2 . web . util . licencaBean . isExpirated ( licencaBean . java : 84 )
at br . com . aj2 . web . util . licencaBean .< init > ( licencaBean . java : 56 )
at sun . reflect . NativeConstructorAccessorImpl . newInstance0 ( Native Method )
at sun . reflect . NativeConstructorAccessorImpl . newInstance ( NativeConstructorAccessorImpl . java : 57 )
at sun . reflect . DelegatingConstructorAccessorImpl . newInstance ( DelegatingConstructorAccessorImpl . java : 45 )
at java . lang . reflect . Constructor . newInstance ( Constructor . java : 525 )
at org . springframework . beans . BeanUtils . instantiateClass ( BeanUtils . java : 148 )
... 119 more
drsmachado 12 de abr. de 2013
Veja que o stackTrace indica que há um NullPointerException no construtor.
Ele aponta a linha onde a falha ocorre.
Dê uma olhada com mais atenção.
macbird 13 de abr. de 2013
Consegui resolver o problema do construtor com @PostConstruct no metodo;
Mas agora tenho um outro problema, preciso matar a sessão.
Tentei da seguinte maneira criei o metodo destroySession.
private void destroySession() {
SecurityContextHolder.clearContext();
}
Aparentemente funciona normal mas há uma brecha esse MB esta linkado a pagina Home.faces (onde é redirecionado apos o login) se acesso outra pagina diretamente o spring Security manda ele pra pagina de login e apos efetuar o login e passa normal. Precisa linkar esse MB ao login mas este usa Spring Security que não sei como alterar;
macbird 13 de abr. de 2013
O metodo que faz o teste se expirou ou não a data de licença e este
@PostConstruct
private void isExpirated () {
String expirado = null ;
if ( this . getEmpresa (). getExpireDate () == null ) {
destroySession ();
try {
FacesContext . getCurrentInstance (). getExternalContext (). redirect ( "wizardInstalation.faces" );
} catch ( IOException ex ) {
Logger . getLogger ( LicencaBean . class . getName ()). log ( Level . SEVERE , null , ex );
}
} else {
expireDate = getEmpresa (). getExpireDate ();
destroySession ();
if ( expireDate . before ( new Date ()) || ( ! getEmpresa (). getAtivo ())) {
if ( this . getEmpresa (). getCodCliente () == null ) {
setRegistrado ( false );
setTitulo ( "Seu periodo de experiência acabou!!!" );
} else {
setRegistrado ( true );
setTitulo ( "Sua chave expirou!!!" );
}
getEmpresa (). setAtivo ( false );
empresaRepository . merge ( getEmpresa ());
try {
FacesContext . getCurrentInstance (). getExternalContext (). redirect ( "licenca.faces" );
} catch ( IOException ex ) {
Logger . getLogger ( LicencaBean . class . getName ()). log ( Level . SEVERE , null , ex );
}
}
}
}