私は EHCache を初めて使用し、キャッシュ サーバーとして使用しようとしました。始めようとしてコードを書きました:
public class CacheMap {
private static CacheManager cacheManager=new CacheManager("ehcache.xml");
private static Cache cache=cacheManager.getCache("firstCache");
}
クラスパスには、terracotta-toolkit-1.6-5.2.0.jar、terracotta-toolkit-1.6-runtime-5.0.0、slf4j-api-1.6.6、slf4j-jdk14-1.6.6、ehcache-2.7 を含めました。 0 および ehcache-ee-2.7.0
そして、ルート ディレクトリに ehcache.xml があります。
ただし、コードの最初の行で次のエラーが発生しました。
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: net.sf.ehcache.CacheException: Could not create ClusteredInstanceFactory due to missing class. Please verify that terracotta-toolkit is in your classpath.
at net.sf.ehcache.terracotta.TerracottaClusteredInstanceHelper.newClusteredInstanceFactory(TerracottaClusteredInstanceHelper.java:187)
at net.sf.ehcache.terracotta.TerracottaClient.createNewClusteredInstanceFactory(TerracottaClient.java:169)
at net.sf.ehcache.terracotta.TerracottaClient.createClusteredInstanceFactory(TerracottaClient.java:126)
at net.sf.ehcache.CacheManager.doInit(CacheManager.java:442)
at net.sf.ehcache.CacheManager.init(CacheManager.java:392)
at net.sf.ehcache.CacheManager.<init>(CacheManager.java:291)
at CacheMap.<clinit>(CacheMap.java:7)
テラコッタを機能させる方法はありますか?