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.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
	at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:202)
	at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:251)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:248)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in class path resource [spring/applicationContext-db.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from file E:\workspace\webworkspace\movetest\WebRoot\WEB-INF\classes\com\itjb\movie\domain\Movie.hbm.xml
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:546)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
	at com.itjb.movie.test.SpringUtils.<clinit>(SpringUtils.java:9)
	... 22 more
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from file E:\workspace\webworkspace\movetest\WebRoot\WEB-INF\classes\com\itjb\movie\domain\Movie.hbm.xml
	at org.hibernate.cfg.Configuration.addFile(Configuration.java:406)
	at org.hibernate.cfg.Configuration.addDirectory(Configuration.java:764)
	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:710)
	at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
	... 34 more
Caused by: org.hibernate.PropertyNotFoundException: field [classify] not found on com.itjb.movie.domain.Movie
	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:301)
	at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2267)
	at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2244)
	at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2134)
	at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:407)
	at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:321)
	at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:172)
	at org.hibernate.cfg.Configuration.add(Configuration.java:771)
	at org.hibernate.cfg.Configuration.addFile(Configuration.java:396)
	... 39 more

  

问题:

持久化类中使用int 没有使用Interger.

持久化类多添加一个属性.

时间: 2024-10-12 09:17:46

Could not parse mapping document from file的相关文章

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 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

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.B

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">

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无法创建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

NHibernate错误:Could not compile the mapping document的解决

用动软代码生成器的NHibernate生成模板,生成一个“XML映射模板”,老是提示Could not compile the mapping document的问题. 各种的找,就是没找到问题. 后来调试的时候,把所有的中断翻出来 发现bool这个类型不认识,再看CodeSmith的模板,里面对MS SQLServer的bit类型是转化为Boolean, 果断地把对应的hbm.xml里的bool类型换成Boolean, 终于搞定.

parse xml document using dom method

the bookstore.xml: <?xml version="1.0" encoding="UTF-8"?><bookstore>    <book id="1">        <bookname>weicheng</bookname>        <author>qianzhongshu</author>    </book>    <