开发者

Ehcache element <cache/> does not allow attribute "transactionalMode"?

According to the Ehcache documentation, starting with version 2.0, an Ehcache cache may participate in a JTA transaction based on the value of attribute transactionalMode on element <cache/>.

If this is true, then why does Ehcache, when it encounters this attribute in my Ehcache configuration file, throw the following exception and complain that "Element does not allow attribute "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开发者_StackOverflow社区-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]]>

Here is a sample cache definition from my ehcache.xml file in which I've set transactionalMode to "xa":

<cache
    name="com.db.spgit.abstrack.model.Security"
    maxElementsInMemory="500"
    eternal="false"
    timeToIdleSeconds="300"
    timeToLiveSeconds="86400"
    overflowToDisk="false"
    transactionalMode="xa" />


Turns out that Maven had also included Ehcache 1.2.3 in my project EAR file because Hibernate Ehcache Integration 3.3.2.GA requires Ehcache 1.2.3.


that means that you need to remove the transitive dependency ehcache 1.2.3.jar and leave include 2.X version . need to see if that has no problem working with hibernate 3.2.X though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜