StandardQueryCache not alive after EntityManagerFactory is re-created
---------------------------------------------------------------------
Key: HHH-5346
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5346
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.5.3
Environment: Ubuntu 8.04
Java SDK 1.6_07
Tomcat 6.0.20
Hibernate-core: 3.3.2.GA
Hibernate-annotations3.4.0.GA
Hibernate-entitymanager: 3.4.0.GA
EhCache 2.1.1
Specific databse product: Data Federator (SAP)
JAX-WS stack: 2.1.7 RT
Reporter: Franck Michel
Hi all,
I'm facing a trouble that no post seems to be treating yet: I use Hibernate through
the JPA API + EhCache as a 2nd level cache.
In the appli.
After a long inactivity period, I happen to get a PersistenceException at the first
request to my entity manager. In this case, I create a new EntityManagerFactory, and a new
EntityManager. At that moment:
- the first request raises an exception about the StandardCacheQuery not being alive.
- most curious, the second request works fine.
The exception stack is listed at the end. Other information about the context follows.
Thx in advance for your help. Regards.
Franck.
- ehcache.xml config:
---------------------
same exception happens with or without the StandardQueryCache region configuration.
<ehcache>
<diskStore path="java.io.tmpdir"/>
<defaultCache
maxElementsInMemory="20000"
eternal="false"
timeToIdleSeconds="600"
timeToLiveSeconds="600"
overflowToDisk="true"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="600"
memoryStoreEvictionPolicy="LRU"/>
<cache name="RefTables" eternal="true"
maxElementsInMemory="10000" overflowToDisk="false" />
<cache name="org.hibernate.cache.StandardQueryCache"
maxElementsInMemory="20000"
eternal="false"
timeToIdleSeconds="600"
timeToLiveSeconds="600"
overflowToDisk="true"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="600"
memoryStoreEvictionPolicy="LRU"/>
</ehcache>
- persistence.xml:
------------------
<persistence-unit name="DataFederator@localhost"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>fr.anr.techlog.neurolog.server.persistence.neurologdb.AcquisitionEquipment</class>
<class>fr.anr.techlog.neurolog.server.persistence.neurologdb.Centre</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.connection.username"
value="neurolog"/>
<property name="hibernate.connection.password"
value="neurolog"/>
...
<property name="hibernate.connection.driver_class"
value="LeSelect.ThinDriver.ThinDriver"/>
<property name="hibernate.connection.url"
value="jdbc:datafederator://localhost:3055/schema"/>
<property name="hibernate.dialect"
value="fr.anr.techlog.neurolog.server.persistence.DataFederatorSQLDialect"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.cache.use_second_level_cache"
value="true"/>
<property name="hibernate.cache.use_query_cache"
value="true"/>
<property name="hibernate.cache.region.factory_class"
value="net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory"/>
<property name="net.sf.ehcache.configurationResourceName"
value="/conf/ehcache.xml"/>
</properties>
</persistence-unit>
Entities:
---------
My entities are described with the annotation:
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, include =
"non-lazy")
or
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, include = "non-lazy")
Exception stack:
----------------
java.lang.IllegalStateException: The org.hibernate.cache.StandardQueryCache Cache is not
alive.
at net.sf.ehcache.Cache.checkStatus(Cache.java:2191)
at net.sf.ehcache.Cache.get(Cache.java:1354)
at
net.sf.ehcache.hibernate.regions.EhcacheGeneralDataRegion.get(EhcacheGeneralDataRegion.java:58)
at
net.sf.ehcache.hibernate.regions.EhcacheQueryResultsRegion.get(EhcacheQueryResultsRegion.java:29)
at org.hibernate.cache.StandardQueryCache.get(StandardQueryCache.java:130)
at org.hibernate.loader.Loader.getResultFromQueryCache(Loader.java:2188)
at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2151)
at org.hibernate.loader.Loader.list(Loader.java:2121)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:88)
at
fr.anr.techlog.neurolog.common.PersistenceManager.retrieveSingleNamedQuery(PersistenceManager.java:521)
at
fr.anr.techlog.neurolog.common.PersistenceManager.retrieveSingleNamedQuery(PersistenceManager.java:501)
at
fr.anr.techlog.neurolog.server.metadata.MetadataPuller.findDatasetExpressionById(MetadataPuller.java:147)
at
fr.anr.techlog.neurolog.server.data.webservices.filemanagement.FileManagement.delegateMakePublicCopyOfDsExpressionFiles(FileManagement.java:633)
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:597)
at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira