我在 Google App Engine v1.7.0 中以编程方式使用 EHCache 2.6.0(没有 ehcache.xml)。
当我使用以下方法实例化 CacheManager 时:
CacheManager cacheManager = CacheManager.create();
我收到错误:
Caused by: java.lang.RuntimeException: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.<init>(AtomicReferenceFieldUpdater.java:217)
at java.util.concurrent.atomic.AtomicRefe...(length 9029)
我试过了:
CacheManager cacheManager = new CacheManager();
并关闭监控:
Configuration configuration = new Configuration();
configuration.setMonitoring(Configuration.Monitoring.OFF.name());
configuration.setUpdateCheck(false);
CacheManager cacheManager = new CacheManager(configuration);
对于他们两个我都收到以下错误:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.ehcache.util.lang.VicariousThreadLocal
at net.sf.ehcache.TransactionController.<init>(TransactionController.java:43)
at net.sf.ehcache.CacheManager.doInit(CacheManager.java:433)
at net.sf.ehcache.CacheManager.init(CacheManager.java:374)
如何解决这个问题?