代码之家  ›  专栏  ›  技术社区  ›  Derek Mahar

Ehcache元素<cache/>不允许属性“transactionalMode”?

  •  2
  • Derek Mahar  · 技术社区  · 16 年前

    Ehcache documentation ,从版本2.0开始,Ehcache缓存可以参与 JTA 基于属性值的事务 transactionalMode <cache/>

    如果这是真的,那么当Ehcache在我的Ehcache配置文件中遇到此属性时,为什么会抛出以下异常并抱怨“Element不允许属性”transactionalMode“

    Caused by: net.sf.ehcache.CacheException: Error configuring from zip:C:/Program Files/Oracle/Middleware/user_projects/domains/abstrack1/servers/AdminServer/tmp/_WL_user/_appsdir_middleware-ear-1.0-SNAPSHOT_ear/n8rga7/middleware-ejb-1.0-SNAPSHOT.jar!/ehcache.xml. Initial cause was Error configuring from input stream. Initial cause was null:35: Element <cache> does not allow attribute "transactionalMode".
        at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:95)
        at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:131)
        at net.sf.ehcache.CacheManager.parseConfiguration(CacheManager.java:241)
        at net.sf.ehcache.CacheManager.init(CacheManager.java:190)
        at net.sf.ehcache.CacheManager.<init>(CacheManager.java:183)
        at net.sf.ehcache.hibernate.EhCacheProvider.start(EhCacheProvider.java:128)
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:183)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1291)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
        ... 76 more]]>
    

    下面是我的 ehcache.xml 事务模式 至“xa”:

    <cache
        name="com.db.spgit.abstrack.model.Security"
        maxElementsInMemory="500"
        eternal="false"
        timeToIdleSeconds="300"
        timeToLiveSeconds="86400"
        overflowToDisk="false"
        transactionalMode="xa" />
    
    2 回复  |  直到 16 年前
        1
  •  3
  •   Derek Mahar    16 年前

    原来Maven还包括 Ehcache 1.2.3 在我的项目EAR文件中,因为 Hibernate Ehcache Integration 3.3.2.GA

        2
  •  0
  •   Ross Bu    14 年前

    推荐文章