[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Is it possible to rename ehcache.xml to something else ?  XML
Forum Index -> Ehcache
Author Message
aladijan

neo

Joined: 10/26/2009 05:09:51
Messages: 3
Offline


Hi,

we are using ehcache 1.5.0 in a java j2ee web application. I would need to rename the configuration file ehcache.xml to something else (e.g. like MyApp_ehcache.xml). I wonder if this is possible somehow through a property value or something ? The problem has arised in Oracle WebLogic 10.3, when we have two different applications in the same configuration domain. I would need to direct both applications to their own ehcache.xml files, but unfortunately in WLS 10.3 there is a problem related to this. Setting the ehcache configuration filename would overcome this problem.
I'm using the SimplePageCachingFilter without Hibernate.

I appreciate , if someone can assist me with this isuue !


Jan-Erik
teck

seraphim
[Avatar]
Joined: 05/24/2006 15:03:25
Messages: 1099
Offline

I didn't go back to ehcache 1.5.0, but looking at the latest source for SimplePageCachingFilter, it looks like you'd need to subclass it and override getCacheManager() to get a differently named config resource loaded.

You seem to be making reference to some wierdness in weblogic that is making this hard/impossible, but I would have thought that since these are difference apps/WARs that you could have the same resource (ehcache.xml) in each but with differing content.

It seems like maybe there is a request for an enhancement here which would be to take a servlet init param with the name of the resource to load when creating the cache manager. That would maybe help you avoid a subclass here.

Tim Eck (terracotta engineer)
gluck

qaestor

Joined: 09/15/2009 18:01:23
Messages: 179
Location: Brisbane, Australia
Offline

1. Create a ServletContextListener.
2. In the contextInitialized method call CacheManager.create(... As a parameter you can specify a filename for ehcache.xml, or an InputStream or an URL.

Now because you have created the singleton already, the filter will simply call CacheManager.getInstance() and return back the singleton you already create.

No need to subclass and all done in a few lines of code.
aladijan

neo

Joined: 10/26/2009 05:09:51
Messages: 3
Offline


Hi,

Thank's for your help!

I'll try to implement CacheManager.create method call and see if this will help.
I'll let you known, if I get it to work.

BR Jan-Erik
aladijan

neo

Joined: 10/26/2009 05:09:51
Messages: 3
Offline


Hi,

the Create method from the servlet contextInitialized seems to work.
thank's for your quick help !

BR Jan-Erik
rajoshi

seraphim

Joined: 07/04/2011 04:36:10
Messages: 1465
Offline

The issue seems to be resolved.Please let know in case of more information.

Rakesh Joshi
Terracotta.
tuno

neo

Joined: 02/02/2012 01:31:29
Messages: 1
Offline

Hi Jan-Erik,

I am looking for a similar solution where you can configure the SimplePageCachingFilter to load it's configuration outside the application classpath. For example a configuration directory. Maybe it's an idea to commit your solution back to the ehcache-web project so people could extend this features.

Kind Regards,

Tuno

aladijan wrote:

Hi,

the Create method from the servlet contextInitialized seems to work.
thank's for your quick help !

BR Jan-Erik 
 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team