`
tianmo2008
  • 浏览: 66944 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

各种异常解决

阅读更多
1:ids for this class must be manually assigned befor数据表里面设置了主键,而Hibernate的.hbm里主键生成方式设置为assigned的时候,
<generator class="assigned"/>

出现了ids for this class must be manually assigned before calling save()异常,在网上找了一下,才发现,hibernate出现这个错误的原因有可能因为,你的表中有个主键。 但是在执行save()的时候却没有给Id设置值,如调用xxx.setId(..)等方法,才会出现。


2:Caused by: java.lang.NoClassDefFoundError:org/apache/commons/pool/impl/GenericObjectPool
//异常:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/base.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool

Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool 
//缺少Apache的commons-pool-1.x.jar,可以在
//http://commons.apache.org/downloads/download_pool.cgi 或
//www.findjar.com上下载对应的jar包


3:
Caused by: java.lang.NoSuchMethodError: org.apache.commons.pool.impl.GenericObjectPool: method <init>()V not found

看见org.apache.commons.pool.impl.GenericObjectPool,一开始以为少了commons-pool这个jar.但后来发现lib里有commons-pool-1.0.1.jar这个jar啊,于是再google一躺,发现是版本问题,换了个commons-pool-1.4.jar就没问题了.

4:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

缺少jakarta-commons的commons-logging.jar
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics