EhCache name issue -jboss 5 upgrade
I am facing a very strange issue with respect to the cache names referenced by the EhCache module under jboss5. It is pre-pending the word "true" before my cache names and hence they can no be found:
"starting query cache at region: true.org.hibernate.xxx.yyy "
and also:
"Could not find a specific ehcache configuration for cache named true.com.xxx.yyy.xxx.userList]; using defaults.
Has anyone faced a similar issue and was able to resolve it?
No Google references please unless trhere is an answer there, thank you.

Comments
ehcache is used under hibernate second-level cache?
Yes it is. standard entry in my ehcache.xml config looks as follows:
<cache name="org.hibernate.cache.StandardQueryCache"maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="150"
timeToLiveSeconds="600"
overflowToDisk="false"
diskPersistent="false"
memoryStoreEvictionPolicy="LRU"
/>
Found the problem (persistance.xml):
<property name="hibernate.cache.region_prefix" value="true"/>However, after I remove this property, I still get a warning:
WARNING [net.sf.ehcache.hibernate.SingletonEhCacheProvider] Could not find a specific ehcache configuration for cache named [persistence.unit:unitName=xpr-cms-app.ear/xpr-cms-model.jar#xprCms.com.xxx.cache.objects]; using defaultsPlease try to configure net.sf.ehcache.configurationResourceName in your persistence.xml file to point to your ehcache.xml file - It looks as it takes the default file provided inside the ehcahe.jar itself...
Yes, I want it to use the default, i changed it and re-pakced the jar, it worked perfectly with the previous Jboss version.
OK, apparently this is the reason for the warning...It just warn for using the default rather using your "own configuration" (assuming most of users will NOT repackage it). I think you can simply remove the warning with Log4J configuration, or (better?) go with their mind, skip the "repackage" and configure the property above.
I tried your approach, however there is still a problem with the cache prefix which is preventing the correct resolution of cache regions:
[org.hibernate.cfg.SettingsFactory] Cache region prefix: persistence.unit:unitName=xxx-yyy-app.ear/xxx-yyy-model.jar#xxxYyy
As you can see if I REMOVE the hibernate.cache.region_prefix property what you see above is what you get, its taking the EAR name and the JAR name and concatenates them.
Me bad:
We deliberately left out the cache region name from the cache Annotation for several Entities so that they will appear as separate cache names which was useful at the time for gathering statistics. What I mean is:
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region= EhCacheJMXAgent.GENERAL_CACHE_POOL_NAME)
compared with:
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
Thanks for the help
hi Shlomo!
Looks like my problem and your is almost same... did you get it fixed the issue ?
I am trying for many days and it is becoming a nightmare...
Thanks!
Hi, You must specify the name of the cache region explicitly as shown in the example above.
If this does not solve your issue, please post you configuration files and i am sure we can help you.
hi Shlomo thanks for your reply, we do not use any region in our mapping classes or configuration files... did not use in jboss4 and it worked fine... but do we need to use region to make it work?
<?xml version="1.0"?>
<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/persistence_1_0.xsd" version="1.0">
<persistence-unit name="MYAppDBLocal">
<!-- not needed in JBoss?
-->
<!-- <provider>org.hibernate.ejb.HibernatePersistence</provider> -->
<jta-data-source>java:/MYAppDS</jta-data-source>
<properties>
<property name="hibernate.archive.autodetection" value="class"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="false"/>
<property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.generate_statistics" value="true"/>
<property name="hibernate.order_updates" value="true"/>
<property name="hibernate.dialect" value="com.db.MySqlDialect"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
</properties>
</persistence-unit>
<persistence-unit name="MyAppDBStatistics">
<jta-data-source>java:/MyAppStatisticsDS</jta-data-source>
<properties>
<property name="hibernate.archive.autodetection" value="class"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="false"/>
<property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.generate_statistics" value="true"/>
<property name="hibernate.order_updates" value="true"/>
<property name="hibernate.dialect" value="com.db.MySqlDialect"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
</properties>
</persistence-unit>
</persistence>
this is my percistence.xml look like... we use ehcache with the mapping classes... it all worked perfectly fine in jboss 4 ...only difference was that we used non-jta data sources in jboss4 but in jboss5 we can not use non-jta as i saw over the internet..
please help or suggest anything so i can get forward... kind of stuck with this problem..
Thanks
when i am starting application.. .first warning about cache i get is this one
WARNING [ConfigurationFactory] No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath c:/doc/jboss5/server/myApp/lib/ehcache-core-2.1.jar
and then next warnings start that can not find the specific configuration for the specified mapping class..