有的说解决方法就是下最新的hibernate-annotations.jar的包~,这确实能够解决问题,但却不是最根本的解决方法,这个问题其实很奇怪,关键就在于Junit中测试没问题,就是发布到项目中的时候,会出现这样的问题~也就是MyEclipse在发布项目文件时的问题~
于是到MyEclipse的安装目录中搜索hibernate-annotations.jar的包,发现在其中有四个hibernate-annotations.jar的包(MyEclipse6.0的版本下,5.x的不知道,可能只有三个),对比了一下他们的目录分别是:
1.MyEclipseeclipsepluginscom.genuitec.org.hibernate.eclipse_......libannotations --[352k]
2.MyEclipseeclipsepluginscom.genuitec.eclipse.springframework_......data.0libhibernate --[257k]
3.MyEclipseeclipsepluginscom.genuitec.org.hibernate.eclipse_......myeclipse-data.2libentitymanager --[257k]
4.MyEclipseeclipsepluginscom.genuitec.eclipse.springframework_......data.2libdependencieshibernate --[128k]
而出错的就是第四个目录下的hibernate-annotations.jar的包,一共128k大小
观察四个包的文件大小后很明显这个问题的原因出在Spring的版本上,由于spring2.0的版本比较新,所以更新的hinbernate包也比较新,而spirng1.2的版本中,虽然包含了hibernate3.x的版本,但是却由于没有及时更新其中的hibernate包,所以导致出现了这个异常bug,也不知道是因为MyEclipse没有及时更新spring的补丁版本,还是因为spring的工程师忽略了这个问题~,犯下了这种小错误,哈哈,不过说起来也是,人无完人嘛~~
分析了问题发生的原因,最后剩下的就是这个问题的彻底解决办法,很简单
把搜索到的第二或者第三个文件夹中的hibernate-annotations.jar包复制到项目的lib目录中覆盖即可,当然如果以后不想再发生这样的问题的话那就把这个文件直接覆盖搜索到的第四个目录中hibernate-annotations.jar吧,这样以后MyEclipse就再也不会发生同样的问题了~
分享到:
相关推荐
hadoop自带的Container-executor在配置yarn-kerberos时存在问题,以及在配置cgroup时需要把container-executor.cfg的上级目录拥有者均改为root,带来不便。 所以需要重新编译Container-executor,这边提供重新编译好...
hibernate cfg xmlhibernate cfg xmlhibernate cfg xmlhibernate cfg xmlhibernate cfg xmlhibernate cfg xml
hibernate.cfg.xml hibernate框架的配置文件
http://www.chinadsl.net/forum.php?mod=viewthread&tid=150974&highlight;=
hadoop自带的Container-executor在配置yarn-kerberos时存在问题,这边给出编译后的Container-executor,默认加载配置文件路径/etc/container-executor.cfg,大家不用再重新编译了
Hibernate配置文件hibernate.cfg.xml中配置信息详解!
高级Hibernate4开发技术:ORM思想,hibernate介绍,hibernate.cfg.xml配置,hbm.xml映射文件详解,主键生成策略使用,PO对象状态及状态的转换分析、一级缓存,Hibernate数据检索技术,Hibernate高级映射技术,...
hibernate配置文件hibernate.cfg.xml的详细解释
这是Hibernate的配置文件,hibernate.cfg.xml的具体写法,共友友们参考~~谢谢~
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property> <!--数据库方言(数据库类型)--> <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <!--...
高级Hibernate4开发技术:ORM思想,hibernate介绍,hibernate.cfg.xml配置,hbm.xml映射文件详解,主键生成策略使用,PO对象状态及状态的转换分析、一级缓存,Hibernate数据检索技术,Hibernate高级映射技术,...
由于spring对hibernate配置文件hibernate.cfg.xml的集成相当好,可以在项目中放弃hibernate.cfg.xml文件,介绍mappingLocations、mappingDirectoryLocations与mappingJarLocations的用法和区别
import org.hibernate.cfg.Configuration; import org.junit.Test; import cc.tukai.entity.Student; public class testHibernate { @Test public void testSave() { Student student = new Student(); ...
JavaEE spring和Hibernate整合(有hibernate.cfg.xml)
hibernate.cfg.xml文件详细解释收集的一个比较好的hibernate.cfg.xml文件解释
Hibernate.cfg.xml配置总结
import org.hibernate.cfg.Configuration; /** * Configures and provides access to Hibernate sessions, tied to the * current thread of execution. Follows the Thread Local Session * pattern, see {@...