Could not parse mapping document from input stream hibernate配置异常

十二月 18, 2016 4:24:29 下午 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1486)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:589)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4992)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5490)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1247)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1898)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:4009)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXmlQueue(Configuration.java:3998)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3986)
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1398)
    at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1375)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:720)
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483)
    ... 26 more
Caused by: org.hibernate.PropertyNotFoundException: field [id] not found on cn.xx.shop.user.vo.User
    at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:182)
    at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:174)
    at org.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:197)
    at org.hibernate.util.ReflectHelper.getter(ReflectHelper.java:241)
    at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:229)
    at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:316)
    at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:454)
    at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:387)
    at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:326)
    at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:177)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:4006)
    ... 34 more

实体类跟表的映射文件ID列不匹配。

实体类 映射文件 数据库表字段。没有匹配,检查名字是否一样。

时间: 2024-10-09 06:56:32

Could not parse mapping document from input stream hibernate配置异常的相关文章

Could not parse mapping document from input stream

无法从输入流解析映射文档 1.定义的类名或属性名不对,如:*.hbm.xml文件中属性name对应的实体类name不一致.2.xml头文件中"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">改为:     "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"  (一般没关系)

org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/domain/book.hbm.xml 联网跑一跑

org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/domain/book.hbm.xml at org.hibernate.cfg.Configuration.addResource(Configuration.java:586) at org.hibernate.cfg.Configuration.addClass(Configuration.java:633) a

Could not parse mapping document from file

java.lang.ExceptionInInitializerError at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccesso

Could not parse mapping document from resource cn/spt/model/Student.hbm.xml

初始hibernate, 写第一个程序 helloworld的错误: Exception in thread "main" org.hibernate.InvalidMappingException: Could not parse mapping document from resource cn/spt/model/Student.hbm.xml at org.hibernate.cfg.Configuration.addResource(Configuration.java:61

hibernate报错:could not parse mapping document from resource

昨晚在自己电脑上搭建的ssh环境运行好好的,搭建成功的时候我还小兴奋了下,然后今天放到公司的电脑上去,直接给我报了个could not parse mapping document from resource,当时我那小心肝直接碎了,并且这个错误还让我改了几个小时,最后在http://blog.csdn.net/mydeman/article/details/6134820 发现了答案,*.hbm.xml中引用了错误的DTD文件路径“http://www.hibernate.org/dtd/hi

hibernate 出现Could not parse mapping document from resource 报错

<!-- 映射文件的根节点 --> <hibernate-mapping > <!-- 对象关系映射的开始:class元素表示类和数据库中的表的映射关系. name属性指定持久化类(或者接口)的Java全限定名: table属性指定要映射的对应的数据库表名,如果省略,则以name作为表名 --> <class name="com.hibernate.customer.customer" table="customer">

org.hibernate.InvalidMappingException: Could not parse mapping document from无法创建sessionFactory

把 "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" 改为 "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 原文地址:https://www.cnblogs.com/zhaocundang/p/9922005.html

hadoop Unexpected end of input stream 错误

线上一个job出错,报错信息如下: Diagnostic Messages for this Task: Error :  java.io.IOException: java.io.EOFException: Unexpected end of input stream         at org.apache.hadoop.hive.io.HiveIOExceptionHandlerChain.handleRecordReaderNextException(HiveIOExceptionHa

Xcode8出现AQDefaultDevice (173): skipping input stream 0 0 0x0

一直不想升级Xcode,但是没办法项目进度只能升级Xcode8,果然不出所料出现了不少bug, Xcode7运行一直没有问题,但是在Xcode8上一直输出AQDefaultDevice (173): skipping input stream 网上查到解决办法 1.选择 Product -->Scheme-->Edit Scheme 2.选择 Arguments 3.在Environment Variables添加一个环境变量 OS_ACTIVITY_MODE 设置值为"disabl