Hi,
I cannot enable the second level cache using EHcache. I have followed the instructions, and at deployment the ehcache.xml file seems not to be found, even though it is placed inside war
in WEB-INF/classes( More specific: the application is called ibxrequest.ear, and the ehcache.xml has the path:
ibxrequest.ear\ibxrequest.war\WEB-INF\classes\ehcache.xml)
We are using JBoss 4.2.0 as an application server. Below is a list of logs, configurations, etc.
Please help!
Thanks
Hibernate version:
[Version] Hibernate Annotations 3.3.0.GA
[Environment] Hibernate 3.2.4.sp1
[Version] Hibernate EntityManager 3.3.1.GA
[Version] Hibernate Validator 3.0.0.GA
[Version] Hibernate Search 3.0.0.GA
persistence.xml:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/ ... ce_1_0.xsd"
version="1.0">
<persistence-unit name="ibxrequest">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/ibxrequestDatasource</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
<property name="hibernate.cache.provider_configuration_file_resource_path" value="/ehcache.xml"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/ibxrequestEntityManagerFactory"/>
<property name="hibernate.connection.driver_class" value="net.sourceforge.jtds.jdbc.Driver"/>
<property name="hibernate.default_schema" value="dbo"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
</properties>
</persistence-unit>
</persistence>
ehcache.xml:
<ehcache>
<diskStore path="java.io.tmpdir"/>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="false"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
<cache name="com.ibx.ibxrequest.model.CoreMessageBuyerTranslation"
maxElementsInMemory="300"
timeToIdleSeconds="0"
timeToLiveSeconds="600"
eternal="false"
overflowToDisk="false"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
</ehcache>
The entity that has second level cache enabled:
package com.ibx.ibxrequest.model;
@Entity
@Table(name = "CORE_MessageBuyerTranslation", uniqueConstraints = {})
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region="com.ibx.ibxrequest.model.CoreMessageBuyerTranslation")
public class CoreMessageBuyerTranslation implements java.io.Serializable {
...
}
Name and version of the database and driver:
[SettingsFactory] RDBMS: Microsoft SQL Server, version: 08.00.2039
[SettingsFactory] JDBC driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase, version: 1.2
[Dialect] Using dialect: org.hibernate.dialect.SQLServerDialect
Debug level Hibernate log excerpt:
2008-03-03 12:47:23,520 INFO (org.hibernate.cfg.SettingsFactory.buildSettings:235) Second-level cache: enabled
2008-03-03 12:47:23,520 INFO (org.hibernate.cfg.SettingsFactory.createCacheProvider:373) Cache provider: org.hibernate.cache.EhCacheProvider
2008-03-03 12:47:23,535 INFO (org.hibernate.cfg.SettingsFactory.buildSettings:254) Optimize cache for minimal puts: disabled
2008-03-03 12:47:23,535 INFO (org.hibernate.cfg.SettingsFactory.buildSettings:259) Cache region prefix: ibxrequest_ear,ibxrequest_jar,ibxrequest
2008-03-03 12:47:23,535 INFO (org.hibernate.cfg.SettingsFactory.buildSettings:263) Structured second-level cache entries: disabled
2008-03-03 12:47:23,535 INFO (org.hibernate.cfg.SettingsFactory.createQueryCacheFactory:360) Query cache factory: org.hibernate.cache.StandardQueryCacheFactory
2008-03-03 12:47:24,504 DEBUG (org.hibernate.cache.EhCacheProvider.loadResource:146)
Creating EhCacheProvider from a specified resource: /ehcache.xml Resolved to URL: null
2008-03-03 12:47:27,926 DEBUG (org.hibernate.cache.CacheFactory.createCache:39) instantiating cache region: ibxrequest_ear,ibxrequest_jar,ibxrequest.com.ibx.ibxrequest.model.CoreMessageBuyerTranslation usage strategy: nonstrict-read-write
2008-03-03 12:47:27,926 WARN (org.hibernate.cache.EhCacheProvider.buildCache:86) Could not find configuration [ibxrequest_ear,ibxrequest_jar,ibxrequest.com.ibx.ibxrequest.model.CoreMessageBuyerTranslation]; using defaults.
2008-03-03 12:47:27,957 DEBUG (org.hibernate.cache.EhCacheProvider.buildCache:89) started EHCache region: ibxrequest_ear,ibxrequest_jar,ibxrequest.com.ibx.ibxrequest.model.CoreMessageBuyerTranslation
2008-03-03 12:47:35,066 INFO (org.hibernate.cache.UpdateTimestampsCache.<init>:41) starting update timestamps cache at region: ibxrequest_ear,ibxrequest_jar,ibxrequest.org.hibernate.cache.UpdateTimestampsCache
2008-03-03 12:47:35,066 WARN (org.hibernate.cache.EhCacheProvider.buildCache:86) Could not find configuration [ibxrequest_ear,ibxrequest_jar,ibxrequest.org.hibernate.cache.UpdateTimestampsCache]; using defaults.
2008-03-03 12:47:35,066 DEBUG (org.hibernate.cache.EhCacheProvider.buildCache:89) started EHCache region: ibxrequest_ear,ibxrequest_jar,ibxrequest.org.hibernate.cache.UpdateTimestampsCache
2008-03-03 12:47:35,082 INFO (org.hibernate.cache.StandardQueryCache.<init>:52) starting query cache at region: ibxrequest_ear,ibxrequest_jar,ibxrequest.org.hibernate.cache.StandardQueryCache
2008-03-03 12:47:35,082 WARN (org.hibernate.cache.EhCacheProvider.buildCache:86) Could not find configuration [ibxrequest_ear,ibxrequest_jar,ibxrequest.org.hibernate.cache.StandardQueryCache]; using defaults.
2008-03-03 12:47:35,098 DEBUG (org.hibernate.cache.EhCacheProvider.buildCache:89) started EHCache region: ibxrequest_ear,ibxrequest_jar,ibxrequest.org.hibernate.cache.StandardQueryCache
2008-03-03 12:47:24,488 DEBUG (org.hibernate.impl.SessionFactoryImpl.<init>:177) instantiating session factory with properties: {java.vendor=Sun Microsystems Inc., sun.java.launcher=SUN_STANDARD, catalina.base=C:\Program Files\jboss-4.2.0.GA\server\default, sun.management.compiler=HotSpot Server Compiler, hibernate.ejb.discard_pc_on_close=false, catalina.useNaming=false, hibernate.transaction.flush_before_completion=false, os.name=Windows XP, sun.boot.class.path=C:\Program Files\jboss-4.2.0.GA\lib\endorsed\serializer.jar;C:\Program Files\jboss-4.2.0.GA\lib\endorsed\xalan.jar;C:\Program Files\jboss-4.2.0.GA\lib\endorsed\xercesImpl.jar;D:\Programs\jdk1.5.0_11\jre\lib\rt.jar;D:\Programs\jdk1.5.0_11\jre\lib\i18n.jar;D:\Programs\jdk1.5.0_11\jre\lib\sunrsasign.jar;D:\Programs\jdk1.5.0_11\jre\lib\jsse.jar;D:\Programs\jdk1.5.0_11\jre\lib\jce.jar;D:\Programs\jdk1.5.0_11\jre\lib\charsets.jar;D:\Programs\jdk1.5.0_11\jre\classes, sun.desktop=windows, hibernate.c3p0.max_size=200, java.vm.specification.vendor=Sun Microsystems Inc., java.runtime.version=1.5.0_11-b03, hibernate.connection.autocommit=true, hibernate.c3p0.min_size=5, ibxrequest.jobs.execute=false, hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider, user.name=agheorghe, shared.loader=, jboss.remoting.version=22, jboss.bind.address=127.0.0.1, tomcat.util.buf.StringCache.byte.enabled=true, hibernate.session_factory_name=persistence.units:ear=ibxrequest.ear,jar=ibxrequest.jar,unitName=ibxrequest, hibernate.connection.release_mode=auto, jboss.remoting.instanceid=727dd148fb073293x68c245b5x113531def34x-8000364, hibernate.c3p0.timeout=1800, jboss.home.dir=C:\Program Files\jboss-4.2.0.GA, com.arjuna.common.util.logging.DebugLevel=0x00000000, user.language=en, java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, sun.boot.library.path=D:\Programs\jdk1.5.0_11\jre\bin, hibernate.jndi.java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, com.arjuna.ats.jta.lastResourceOptimisationInterface=org.jboss.tm.LastResource, jboss.home.url=file:/C:/Program Files/jboss-4.2.0.GA/, java.version=1.5.0_11, user.timezone=Europe/Athens, jboss.server.home.dir=C:\Program Files\jboss-4.2.0.GA\server\default, hibernate.bytecode.provider=javassist, sun.arch.data.model=32, java.endorsed.dirs=C:\Program Files\jboss-4.2.0.GA\lib\endorsed, jboss.server.home.url=file:/C:/Program Files/jboss-4.2.0.GA/server/default/, sun.cpu.isalist=, sun.jnu.encoding=Cp1252, file.encoding.pkg=sun.io, package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans., file.separator=\, java.specification.name=Java Platform API Specification, hibernate.format_sql=false, com.arjuna.ats.tsmx.agentimpl=com.arjuna.ats.internal.jbossatx.agent.LocalJBossAgentImpl, java.class.version=49.0, jboss.server.config.url=file:/C:/Program Files/jboss-4.2.0.GA/server/default/conf/, user.country=US, java.home=D:\Programs\jdk1.5.0_11\jre, java.vm.info=mixed mode, jboss.lib.url=file:/C:/Program Files/jboss-4.2.0.GA/lib/, os.version=5.1, hibernate.jndi.java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces, hibernate.jacc.ctx.id=ibxrequest.jar, hibernate.transaction.factory_class=org.hibernate.ejb.transaction.JoinableCMTTransactionFactory, hibernate.query.jpaql_strict_compliance=true, path.separator=;, java.vm.version=1.5.0_11-b03, user.variant=, java.protocol.handler.pkgs=org.jboss.net.protocol, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper., com.arjuna.common.util.logger=log4j_releveler, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces, hibernate.cache.region_prefix=ibxrequest_ear,ibxrequest_jar,ibxrequest, jboss.server.temp.dir=C:\Program Files\jboss-4.2.0.GA\server\default\tmp, java.rmi.server.RMIClassLoaderSpi=org.jboss.system.JBossRMIClassLoader, user.home=C:\Documents and Settings\agheorghe.TSWARP, sun.rmi.dgc.client.gcInterval=3600000, jboss.identity=727dd148fb073293x68c245b5x113531def34x-8000364, java.specification.vendor=Sun Microsystems Inc., hibernate.hbm2ddl.auto=validate, java.vendor.url=http://java.sun.com/, java.library.path=D:\Programs\jdk1.5.0_11\bin;.;C:\WINDOWS\system32;C:\WINDOWS;D:\Programs\jdk1.5.0_11\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\Programs\OpenSSL\bin;D:\Programs\apache-ant-1.6.5\bin;D:\Programs\maven-2.0.6\bin;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\Subversion\bin;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\MSSQL7\BINN, program.name=run.bat, hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver, java.vm.vendor=Sun Microsystems Inc., sun.rmi.dgc.server.gcInterval=3600000, hibernate.dialect=org.hibernate.dialect.SQLServerDialect, common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, java.class.path=D:\Programs\jdk1.5.0_11\lib\tools.jar;C:\Program Files\jboss-4.2.0.GA\bin\run.jar, hibernate.bytecode.use_reflection_optimizer=false, jboss.server.log.dir=C:\Program Files\jboss-4.2.0.GA\server\default\log, jbossmx.loader.repository.class=org.jboss.mx.loading.UnifiedLoaderRepository3, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, jboss.remoting.domain=JBOSS, catalina.home=C:\Program Files\jboss-4.2.0.GA\server\default, jboss.server.lib.url=file:/C:/Program Files/jboss-4.2.0.GA/server/default/lib/, sun.os.patch.level=Service Pack 2, sun.cpu.endian=little, com.arjuna.common.util.logging.VisibilityLevel=0xffffffff, hibernate.cache.use_query_cache=true, hibernate.connection.provider_class=org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider, com.arjuna.ats.arjuna.objectstore.objectStoreDir=C:\Program Files\jboss-4.2.0.GA\server\default\data/tx-object-store, java.io.tmpdir=C:\DOCUME~1\AGHEOR~1.TSW\LOCALS~1\Temp\, java.rmi.server.codebase=http://127.0.0.1:8083/, TSMX_VERSION=unknown, org.w3c.dom.DOMImplementationSourceList=org.apache.xerces.dom.DOMXSImplementationSourceImpl, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, server.loader=, hibernate.default_schema=dbo, jboss.server.data.dir=C:\Program Files\jboss-4.2.0.GA\server\default\data, java.rmi.server.hostname=127.0.0.1, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, os.arch=x86, jboss.remoting.jmxid=agheorghe_1204541180145, java.ext.dirs=D:\Programs\jdk1.5.0_11\jre\lib\ext, user.dir=C:\Program Files\jboss-4.2.0.GA\bin, PROPERTIES_FILE=tsmx.properties, jboss.entity.manager.factory.jndi.name=java:/ibxrequestEntityManagerFactory, line.separator=
, java.vm.name=Java HotSpot(TM) Server VM, jboss.server.base.dir=C:\Program Files\jboss-4.2.0.GA\server, org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger, com.arjuna.common.util.logging.FacilityLevel=0xffffffff, hibernate.cache.provider_configuration_file_resource_path=/ehcache.xml, hibernate.cache.use_second_level_cache=true, jboss.server.base.url=file:/C:/Program Files/jboss-4.2.0.GA/server/, javax.management.builder.initial=org.jboss.mx.server.MBeanServerBuilderImpl, file.encoding=Cp1252, hibernate.use_identifier_rollback=false, catalina.ext.dirs=C:\Program Files\jboss-4.2.0.GA\server\default\lib, hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup, java.specification.version=1.5, jboss.server.name=default, hibernate.c3p0.max_statements=50, hibernate.show_sql=true}