Element <defaultCache> does not allow attribute 异常
博客专区 > 澜柯 的博客 > 博客详情
Element <defaultCache> does not allow attribute 异常
澜柯 发表于2年前
Element <defaultCache> does not allow attribute 异常
  • 发表于 2年前
  • 阅读 87
  • 收藏 0
  • 点赞 1
  • 评论 0

腾讯云 新注册用户 域名抢购1元起>>>   

摘要: jpa整合ehcache异常

Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.spi.CacheImplementor]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:261)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:273)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
    ... 37 more
Caused by: org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Error configuring from file:/D:/Workspace/IdeaProjects/idea/target/classes/cache/ehcache-hibernate-local.xml. Initial cause was Error configuring from input stream. Initial cause was null:9: Element <defaultCache> does not allow attribute "maxEntriesLocalHeap".
    at org.hibernate.cache.ehcache.EhCacheRegionFactory.start(EhCacheRegionFactory.java:107)
    at org.hibernate.internal.CacheImpl.<init>(CacheImpl.java:70)
    at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:40)
    at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:35)
    at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:91)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251)
    ... 50 more
Caused by: net.sf.ehcache.CacheException: Error configuring from file:/D:/Workspace/IdeaProjects/idea/target/classes/cache/ehcache-hibernate-local.xml. Initial cause was Error configuring from input stream. Initial cause was null:9: Element <defaultCache> does not allow attribute "maxEntriesLocalHeap".
    at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:103)
    at org.hibernate.cache.ehcache.internal.util.HibernateEhcacheUtils.loadAndCorrectConfiguration(HibernateEhcacheUtils.java:70)
    at org.hibernate.cache.ehcache.EhCacheRegionFactory.start(EhCacheRegionFactory.java:90)
    ... 55 more
Caused by: net.sf.ehcache.CacheException: Error configuring from input stream. Initial cause was null:9: Element <defaultCache> does not allow attribute "maxEntriesLocalHeap".
    at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:157)
    at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:101)
    ... 57 more
Caused by: org.xml.sax.SAXException: null:9: Element <defaultCache> does not allow attribute "maxEntriesLocalHeap".
    at net.sf.ehcache.config.BeanHandler.setAttribute(BeanHandler.java:282)
    at net.sf.ehcache.config.BeanHandler.startElement(BeanHandler.java:113)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:332)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
    at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:155)
    ... 58 more


http://stackoverflow.com/questions/28903763/element-cache-does-not-allow-attribute-maxbyteslocaldisk

是ehcache版本过低导致,需要在maven中单独引入,不能用hibernate默认的版本

标签: 异常
共有 人打赏支持
粉丝 3
博文 4
码字总数 678
×
澜柯
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: