cvc-complex-type.2.4.a: 发现了以元素 'one-to-many' 开头的无效内容。应以 '{"http://java.sun.com/x

lerywi001 2015-08-28 11:08:29
ERROR org.hibernate.internal.util.xml.ErrorLogger -
HHH000196: Error parsing XML (2) : cvc-complex-type.3.1: 在元素 'entity-mappings' 中, 属性 'version' 的值 '2.0' 与相应的属性用法不匹配。属性 'version' 具有固定值 '1.0'。
ERROR org.hibernate.internal.util.xml.ErrorLogger -
Error parsing XML (2) : cvc-complex-type.2.4.a: 发现了以元素 'one-to-many' 开头的无效内容。应以 '{"http://java.sun.com/xml/ns/persistence/orm":one-to-one, "http://java.sun.com/xml/ns/persistence/orm":many-to-many, "http://java.sun.com/xml/ns/persistence/orm":embedded, "http://java.sun.com/xml/ns/persistence/orm":transient}' 之一开头。
WARN o.s.web.context.support.XmlWebApplicationContext -
Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in class path resource [dao/applicationContext-jpa.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [dao/applicationContext-jpa.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Unable to read XML
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [dao/applicationContext-jpa.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Unable to read XML
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:441) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:277) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:139) ~[spring-tx-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:79) ~[spring-tx-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:71) ~[spring-tx-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:84) ~[spring-tx-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1534) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1502) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
... 20 common frames omitted
Caused by: org.hibernate.InvalidMappingException: Unable to read XML
at org.hibernate.internal.util.xml.MappingReader.readMappingDocument(MappingReader.java:109) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.ejb.Ejb3Configuration.addXMLEntities(Ejb3Configuration.java:744) ~[hibernate-entitymanager-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:613) ~[hibernate-entitymanager-4.2.2.Final.jar:4.2.2.Final]
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:75) ~[hibernate-entitymanager-4.2.2.Final.jar:4.2.2.Final]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:290) ~[spring-orm-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310) ~[spring-orm-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511) ~[spring-beans-3.2.12.RELEASE.jar:3.2.12.RELEASE]
... 35 common frames omitted
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: 发现了以元素 'one-to-many' 开头的无效内容。应以 '{"http://java.sun.com/xml/ns/persistence/orm":one-to-one, "http://java.sun.com/xml/ns/persistence/orm":many-to-many, "http://java.sun.com/xml/ns/persistence/orm":element-collection, "http://java.sun.com/xml/ns/persistence/orm":embedded, "http://java.sun.com/xml/ns/persistence/orm":transient}' 之一开头。
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:458) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3237) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1796) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:746) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:379) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) ~[na:1.8.0_45]
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649) ~[na:1.8.0_45]
at org.dom4j.io.SAXReader.read(SAXReader.java:465) ~[dom4j-1.6.1.jar:1.6.1]
at org.hibernate.internal.util.xml.MappingReader.readMappingDocument(MappingReader.java:78) ~[hibernate-core-4.2.2.Final.jar:4.2.2.Final]
... 42 common frames omitted
求大神给予 解答啊
...全文
579 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
@VEEDO 2017-08-24
时隔一年半还能回复,我在做解析xml。验证的时候遇到这个问题。。。
回复
时隔一年,还能回复!虽然我也遇到了此问题,但是我用的却是hibernate3
回复
lerywi001 2016-06-28
hibernate4.0以后hbm配置文件中的各个属性是存在先后顺序的问题,我调整了一下顺序就好了。
回复
开心度过 2016-06-16
大神,你是怎么解决的
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2015-08-28 11:08
社区公告
暂无公告