• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

classloader conflict using mybatis/ehcache/terracotta within a custom container

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

I am using MyBatis 3.1.1, mybatis-ehcache 1.0.0, mybatis-spring 1.1.0 with Spring 3.0.6 and Ehcache 2.0 for caching. I would also like to use Terracotta for a distributed cache at some future date.

I am forced to deploy my application in a container that is itself an application. Unfortunately, it uses Ehcache itself. This would not be a problem except the classloader of this container application is used by my application to find . And of course it does not find my version but the container version which then cannot find my application ehcache.xml.

I have tried moving my config file to the container classpath and that seems to work. I have also tried to remove the container Ehcache JAR, which also works. Unfortunately, neither is an option moving forward.

So I am wondering what I can do. Is there a way to configure MyBatis to use a specific version of Ehcache? Alternatively, I could configure my ehcaches through MyBatis, but I am worried I won't have access to the full range of Ehcache properties, especially the terracotta element. Here is my ehcache.xml



Could I write my own class that wraps org.mybatis.caches.ehcache.EhcacheCache and somehow loads the correct Ehcache library or at least config file?

Or should I cut my losses and try to use a different caching solution?

Any ideas appreciated.

Cheers
Kato
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!