Spring异常:Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
Caused by:
net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
 at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
 at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
 at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
 at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:127)
 at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
 at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
 at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
 at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
 at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
 at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:295)
 at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
 at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
 at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
 at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)

 

 

解决方法:包冲突

myeclipse添的spring2.0时自动添加的包cglib-nodep-2.1_3.jar的问题. (它添加的是spring1.2里面的CGLIB)所以不要用它添加的这个jar包,自己导入spring 2.0.4里的cglib-nodep-2.1_3.jar,并且把添加hibernate3.0时自动添加三个包asm.jar,asm-attrs.jar,cglib-2.1.3.jar 删除就可以了.

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值