This Is A FineDay

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  93 随笔 :: 0 文章 :: 69 评论 :: 0 Trackbacks

java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass

Problem with Spring 1.2.6 and Hibernate 3.1 : HbmBinder$SecondPass


Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-hibernate.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass
java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass( :620)
at at .java:260)
at$100(URLClassLoader. java:56)
at$ 195)
at Method)
at ava:188)
at java.lang.ClassLoader.loadClass( 06)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche
at java.lang.ClassLoader.loadClass( 51)
at java.lang.ClassLoader.loadClassInternal(ClassLoade
at org.hibernate.cfg.Configuration.add(Configuration. java:385)
at org.hibernate.cfg.Configuration.addInputStream(Con
at org.springframework.orm.hibernate3.LocalSessionFac toryBean.afterPropertiesSet(LocalSessionFactoryBea
at AutowireCapableBeanFactory.invokeInitMethods(Abstr
at AutowireCapableBeanFactory.createBean(AbstractAuto
at BeanFactory.getBean(
at BeanFactory.getBean(
at istableBeanFactory.preInstantiateSingletons(Defaul
at ationContext.refresh(AbstractApplicationContext.ja va:320)
at plicationContext.<init>(ClassPathXmlApplicationCon
at plicationContext.<init>(ClassPathXmlApplicationCon
at in(
reason is:It seems that org\hibernate\cfg\HbmBinder$SecondPass.class no longer exists in hibernate3.jar.
Specifically, the hibernate3.jar that ships with Spring 1.2.7 appears to be Hibernate v3.0.5. This version of the jar does indeed include the org/hibernate/cfg/HbmBinder$SecondPass class. When I remove this version of hibernate3.jar and replace it with the latest and greatest hibernate3.jar this problem arises. The latest version of Hibernate (hibernate3.jar) is v3.1.3.

By simply inspecting the contents of the hibernate3.jar files you will see this problem.

This leads me to believe that we must use the hibernate3.jar that ships with Spring v.1.2.7 (or whatever version people are using with respect to 1.2.x).

My immediate concern is that itermixing Hibernate 3.1.3 support/dependency jars with a v3.0.5 hibernate3.jar may cause issues. I suppose I will need to download and use Hibernate 3.0.5 to be safe but I'd like very much to use Hibernate 3.1.3 w/o concern.

Any ideas on whether a patch/update will be made available to get around this issue.

See if there's been any issue raised on this topic. I know this topic has been discussed several times but always the solution was using the proper jars (and eliminating old ones which were used as dependencies as already noted in this thread).
I've used spring with HB 3.1.3 and 3.0.5 without problems and by looking at the stacktrace, the problem is with hibernate (which actually calls the missing class) and not with Spring.
posted on 2006-08-10 09:23 Peter Pan 阅读(6979) 评论(8)  编辑  收藏 所属分类: SSH


# re: java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass 2006-12-30 21:18 qiuxi
太谢谢了,我也是遇到这个问题,弄了两天没有结果,没办法,就把所报错的内容,一个个的google,搜到了这里,删掉hibernate-annotations果然又用了,真是郁闷,spring+Hibernate就是问题多,没办法,有点想投奔EJB去  回复  更多评论

# re: java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass 2008-09-12 17:18 袁建华
是啊,我也是遇到这个问题,我把我自己的项目都删了,以为是我的项目问题,郁闷,现在可以了,唉,太谢谢了  回复  更多评论

# re: java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass 2008-10-27 15:27 yac
多谢,多谢,问题已经解决.  回复  更多评论

# re: java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass 2008-12-02 22:18 ruan
我快被这个问题整疯了,删掉这个包,一切ok了。谢谢!  回复  更多评论

# re: java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass[未登录] 2008-12-03 17:05 哈哈
太感谢了 我也快被这个问题整疯了   回复  更多评论

# re: java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass 2008-12-03 20:38 ys
3q  回复  更多评论

# re: java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass 2009-02-20 22:45 hufengjiao
可是那两个是匹配的呢,我找了好多总是不对啊,郁闷中  回复  更多评论

# re: java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass 2009-09-30 13:32 范德萨的
在我这删除那个包不能解决问题啊h----怎么办?  回复  更多评论