Announcement Announcement Module
Collapse
No announcement yet.
ApplicationContext refresh and Hibernate cache Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ApplicationContext refresh and Hibernate cache

    Hello community,

    I wanted to reload the spring configuration from within my web-app and used:
    Code:
    ServletContext ctx = JsfContextUtils.getServletContext();
    ConfigurableApplicationContext appCtx = (ConfigurableApplicationContext)
                		WebApplicationContextUtils.getRequiredWebApplicationContext(ctx);
    appCtx.refresh();
    Unfortunately the hibernate cache seems to not like it (I am using EHCache for second level caching btw.):
    Code:
    Caused by: java.lang.NullPointerException
    	at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.nextTimestamp(RegionFactoryCacheProviderBridge.java:93)
    	at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:637)
    	at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:646)
    	at org.springframework.orm.hibernate3.SessionFactoryUtils.doGetSession(SessionFactoryUtils.java:318)
    	at org.springframework.orm.hibernate3.SessionFactoryUtils.getSession(SessionFactoryUtils.java:233)
    	at org.springframework.orm.hibernate3.support.HibernateDaoSupport.getSession(HibernateDaoSupport.java:170)
    	at org.springframework.orm.hibernate3.support.HibernateDaoSupport.getSession(HibernateDaoSupport.java:143)
    Any hints on that one?

    Thank you in advance

    Jakob

  • #2
    Gentle bump. Should I probably rather ask in the "Data"-Forum than here?

    Comment


    • #3
      Application Context -- EHCache ?

      Originally posted by Jakob O. View Post
      Gentle bump. Should I probably rather ask in the "Data"-Forum than here?
      Why do you think this is ApplicationContext related problem... Error you posted says a NullPointerException. Also posting complete error stack may help.

      I have not seen you asking this question any where else, is this problem resolved?



      Caused by: java.lang.NullPointerException
      at org.hibernate.cache.impl.bridge.RegionFactoryCache ProviderBridge.nextTimestamp(RegionFactoryCachePro viderBridge.java:93

      Comment


      • #4
        Hi,

        no I didn't solve the problem, but I didn't want to cross-post. I guess it's an application-context related problem since the application works fine until I try to refresh the context, which might be caused by not shutting down the second level cache cleanly and reinstantiating it when the session factory singleton is refreshed (destroyed and recreated).

        Additionally I will turn on spring logging and add the output.

        Regards

        Jakob

        Stacktrace:
        Code:
        ERROR: Exceptions occurred in accesvoter - 2011-02-10 16:21:12,228 [xxx.security.spring.AbstractVoter]
        eu.codecamp.utils.lib.exceptions.SecurityException: eu.codecamp.utils.lib.exceptions.DataAccessException: java.lang.NullPointerException
        	at xxx.security.spring.AuthenticationManagerImpl.getCurrentUser(AuthenticationManagerImpl.java:81)
        	at xxx.security.spring.AbstractVoter.vote(AbstractVoter.java:58)
        	at eu.codecamp.utils.lib.security.spring.DenyDecisionManager.decide(DenyDecisionManager.java:40)
        	at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:203)
        	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:106)
        	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
        	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
        	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
        	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
        	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
        	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:215)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
        	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
        	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
        	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
        	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
        	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
        	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
        	at java.lang.Thread.run(Thread.java:595)
        Caused by: eu.codecamp.utils.lib.exceptions.DataAccessException: java.lang.NullPointerException
        	at xxx.persistence.hibernate.UserDaoImpl.findByName(UserDaoImpl.java:43)
        	at xxx.persistence.hibernate.UserDaoImpl.getByName(UserDaoImpl.java:30)
        	at xxx.security.spring.AuthenticationManagerImpl.getCurrentUser(AuthenticationManagerImpl.java:79)
        	... 29 more
        Caused by: java.lang.NullPointerException
        	at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.nextTimestamp(RegionFactoryCacheProviderBridge.java:93)
        	at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:637)
        	at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:646)
        	at org.springframework.orm.hibernate3.SessionFactoryUtils.doGetSession(SessionFactoryUtils.java:318)
        	at org.springframework.orm.hibernate3.SessionFactoryUtils.getSession(SessionFactoryUtils.java:233)
        	at org.springframework.orm.hibernate3.support.HibernateDaoSupport.getSession(HibernateDaoSupport.java:170)
        	at org.springframework.orm.hibernate3.support.HibernateDaoSupport.getSession(HibernateDaoSupport.java:143)
        	at xxx.persistence.hibernate.UserDaoImpl.findByName(UserDaoImpl.java:37)
        	... 31 more

        Comment

        Working...
        X