TransferORM / transfer

ColdFusion ORM library created by Mark Mandel, updated by @ghidinelli
Other
5 stars 3 forks source link

Cannot add cache listener for EHCache on Lucee #15

Open bdw429s opened 9 years ago

bdw429s commented 9 years ago

The EHCache provider throws the following error on Lucee 4.5.2. (I made some local changes to treat Lucee the same as Railo)

No matching Method/Function for net.sf.ehcache.event.RegisteredEventListeners.registerListener(V6d57925c63b555fdf78d498ed5f6fc2e5308) found

The error happens in transfer/com/cache/provider/EHCacheProvider.cfc on line 127 which is this code:

cache.getCacheEventNotificationService().registerListener(getProxy());

The registerListener() method expects an instance of net.sf.ehcache.event.CacheEventListener and I isInstanceOf() confirms that the object returned by getProxy() (which was created by createDynamicProxy()) correctly implements net.sf.ehcache.event.CacheEventListener. Is this a classloader issue?

ghidinelli commented 8 years ago

@bdw429s - what version of ehcache do you have on Lucee? IIRC there was a newer ehcache 3 and if Lucee is shipping with that, the interface/methods may not be the same as ehcache 2 (or maybe it's ehcache 2 vs 1).

One other suggestion would be to try overriding this line on 111:

var element = getJavaLoader().create("net.sf.ehcache.Element").init(arguments.key, arguments.object);

With something more native to Lucee (I think it has a javaloader equivalent built in, right?) and see if you get any different results by removing one intermediate step.

bdw429s commented 8 years ago

Hi @ghidinelli, I've moved on from this client project now so I don't have that code in front of me any longer. If I get a chance, I'll try to reproduce this again. I just switched to a different caching provider on the project to get it working.