Could not parse mapping document from resource Duplicate collection role mapping
来源:互联网 发布:淘宝卖什么单体利润大 编辑:程序博客网 时间:2024/06/08 19:25
(转自http://blog.knowsky.com/189409.htm)
昨天弄hibernate碰到这个重复映射的错误 花了半天才解决 方法如下
hibernate出现这个错误时 会报很多次同样的错误 让人完全摸不着头脑
一开始做这个项目时 我配过一个简单的hibernate 还配上了proxool连接池 一切正常运行
后来就把其他实体类都加上了 话说用myeclipse的DB工具自己生成配置文件还真实方便阿
当然生成配置文件后 还得自己把外键什么的弄弄好
这期间换过一次数据库 改过端口 结果测试的时候因为端口写错花了我好大功夫 orz。。
成功连上数据库后 就开始解决hibernate的错误了
google上搜了很久 也找到很多解决方案
一、.hbm.xml里属性重复定义了——仔细检查后排除这个可能
二、mapping file 里写了引用后 同时又在hibernate类里用代码引用了.hbm.xml文件——我把mapping file里的引用都删掉之后出现找不到类了 所以排除这个可能
三、mapping file 里多次引用同一个配置文件——更不可能了
四、由于包改过名字 原来自动复制过去的一个配置文件还存在 造成读取了两次配置文件的情况 clean就行了——clean试过 重建项目试过 无效
纠结了半天 就是没找出原因来 改了很多地方 后来竟然还出现了DBPool(proxool)重复定义的错误 这说明是整个mapping file被多次读取 问题不在mapping file里 但读取mapping file是myeclipse自己生成的 不该出这问题
晚上断网后 自己又对着代码琢磨了一会儿 终于让我发现问题所在了
确实是重复定义了 不过出现重复定义的配置文件不是报错的那个!!
问题出在另一个.hbm.xml配置文件上 改正之后终于能跑通了
还是很奇怪为什么一个配置文件除了错误 却在另一个里面报一大堆重复定义
一个可能大概是hibernate在遇到错误后的处理做得还不够好 出现反复读取文件 所以才出现大量的重复定义错误
- Could not parse mapping document from resource Duplicate collection role mapping
- Hibernate 4出现的Could not parse mapping document from resource,Duplicate class/entity mapping
- hibernate: Duplicate class/entity; Could not parse mapping document from resource
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource
- Hibernate提示 Could not parse mapping document from resource...
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource
- Hibernate:Could not parse mapping document from invalid mapping Could not parse mapping document
- Could not parse mapping document from invalid mapping
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource 处理办法
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource 处理办法
- 学习hibernate遇到问题之Could not parse mapping document from resource
- Hibernate下出现Could not parse mapping document from resource xx.hbm.xml
- 解决InvalidMappingException: Could not parse mapping document from resource问题的办法。
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource cn/ljt/hiberna
- hibernate 出现Could not parse mapping document from resource 报错
- PM工单结算规则处理方法
- C语言实现打印1000以内素数的三种基本方法
- WEB页面调用OCX控件
- 转载mars01-20 XML SAX解析
- 获取 iphone 手机的总内存和可用的内存大小
- Could not parse mapping document from resource Duplicate collection role mapping
- WinForm 界面布局
- 深入了解java虚拟机(JVM),老外的文章翻译而来
- SQL中的事务以及批量更新
- 关于数据挖掘(协同过滤、关联推荐、聚类分类)一些资料
- vim 格式化文本,调整缩进,
- android dp dip px sp的区别
- Bash Shell中的> 、>> 、 1> 、 2> 、 2>>和 < 、 <<
- 替换开机画面:initlogo.rle被