JBoss Community

Query cache with custom Objects

created by Midhun Agnihotram in JBoss Cache - View the full discussion

Hi,

 

We are using jboss Cache 3.2.5 as the second level cache for Hibernate 3.3.2. The second level cache and query cache have been enabled in the hibernate config file. We get the following error when the application is running and Hibernate is trying to cache a query :

 

2010-09-28 13:09:07 HKT [http-28401-Processor24] ERROR com.xxxxxxxx.xxxxxxxx.common.web.controller.HandlerExceptionResolver - com.xxxxxxxx.xxxxxxxx.common.data.dataobject.DataRef
java.lang.ClassCastException: com.xxxxxxxx.xxxxxxxx.common.data.dataobject.DataRef
                at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:104)
                at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2212)
                at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2163)
                at org.hibernate.loader.Loader.list(Loader.java:2121)
                at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
                at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1597)
                at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
                at com.xxxxxxxx.xxxxxxxx.common.data.dao.impl.GenericDaoImpl$4.doInJpa(GenericDaoImpl.java:249)
                at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:185)
                at com.xxxxxxxx.xxxxxxxx.common.data.dao.impl.GenericDaoImpl.findByHibernateDetachedCriteria(GenericDaoImpl.java:226)
                at com.xxxxxxxx.xxxxxxxx.common.data.dao.impl.GenericDaoImpl.findByCriterion(GenericDaoImpl.java:151)
                at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:585)
                at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
                at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
                at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
                at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
                at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
                at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
                at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
                at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
                at $Proxy291.findByCriterion(Unknown Source)
                at com.xxxxxxxx.xxxxxxxx.xxxxxxxx.business.corporateaction.impl.CASwiftOutgoingServiceImpl$SwiftIdBackedValueListHandler.doGetIdList(CASwiftOutgoingServiceImpl.java:141)
                at com.xxxxxxxx.xxxxxxxx.common.util.valuelist.IdBackedValueListHandler.getIdList(IdBackedValueListHandler.java:49)
                at com.xxxxxxxx.xxxxxxxx.common.util.valuelist.IdBackedValueListHandler.doGetSize(IdBackedValueListHandler.java:29)
                at com.xxxxxxxx.xxxxxxxx.common.util.valuelist.ValueListHandler.getSize(ValueListHandler.java:63)
                at com.xxxxxxxx.xxxxxxxx.common.web.controller.SimpleSearchController.getPageItem(SimpleSearchController.java:178)
                at com.xxxxxxxx.xxxxxxxx.common.web.controller.SimpleSearchController.getPageItem(SimpleSearchController.java:144)
                at com.xxxxxxxx.xxxxxxxx.xxxxxxxx.web.controller.corporateaction.CASwiftOutgoingController.doSearch(CASwiftOutgoingController.java:330)
                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:585)
                at org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:445)
                at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:382)
                at com.xxxxxxxx.xxxxxxxx.common.web.controller.SimpleSearchController.handleRequestInternal(SimpleSearchController.java:54)
                at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:148)
                at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
                at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:859)
                at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:793)
                at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
                at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
                at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
                at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
                at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
                at com.xxxxxxxx.xxxxxxxx.common.web.interceptor.UrlPatternSecurityInterceptor.doFilter(UrlPatternSecurityInterceptor.java:64)
                at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
                at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
                at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
                at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
                at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:166)
                at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
                at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
                at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
                at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
                at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
                at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
                at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
                at com.xxxxxxxx.xxxxxxxx.common.web.security.SiteminderAuthenticationProcessingFilter.doFilter(SiteminderAuthenticationProcessingFilter.java:117)
                at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
                at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
                at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
                at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
                at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
                at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
                at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
                at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
                at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
                at com.planetj.servlet.filter.compression.CompressingFilter.doFilter(CompressingFilter.java:222)
                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:210)
                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.valves.AccessLogValve.invoke(AccessLogValve.java:542)
                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:870)
                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:685)
                at java.lang.Thread.run(Thread.java:595)

 

 

Seems like there is an issue with caching DataRef objects. Can any one please let me know what needs to be done to resolve this ?

 

Please let me know if you need any more information.

 

Thanks,

Midhun.

Reply to this message by going to Community

Start a new discussion in JBoss Cache at Community