全世界的屋顶

posts(3) comments(34) trackbacks(0)
  • BlogJava
  • 联系
  • RSS 2.0 Feed 聚合
  • 管理

常用链接

  • 我的随笔
  • 我的文章
  • 我的评论
  • 我的参与
  • 最新评论

留言簿

  • 给我留言
  • 查看公开留言
  • 查看私人留言

随笔分类(3)

  •  DB2
  •  vig(3)

文章分类(37)

  •  Ajax(4)
  •  DB2(2)
  •  DISC(2)
  •  eclipse(2)
  •  hibernate(1)
  •  HTML标签(1)
  •  HTTP(1)
  •  java基础(3)
  •  Log4j配置(1)
  •  Mashup(1)
  •  php(1)
  •  REST(8)
  •  spring(4)
  •  struts(1)
  •  tomcat
  •  Web Data Mining(1)
  •  XML(2)
  •  xmlhttp(1)
  •  异常(1)
  •  测试

文章档案(35)

  • 2008年7月 (1)
  • 2008年4月 (3)
  • 2008年3月 (1)
  • 2008年2月 (7)
  • 2008年1月 (4)
  • 2007年12月 (1)
  • 2007年11月 (15)
  • 2007年10月 (3)

相册

  • Ajax Web应用程序模型
  • Juris Hartmanis
  • REST
  • Spring
  • 成长辛路

收藏夹(7)

  •  Java(1)
  •  php(4)
  •  web2.0(2)

搜索

  •  

最新评论

  • 1. re: HTTP请求(GET与POST区别)和响应
  • mlkmk
  • --gs
  • 2. re: HTTP请求(GET与POST区别)和响应
  • <script>alert("sdf")</script>
  • --lcyang
  • 3. re: HTTP请求(GET与POST区别)和响应
  • 不错
  • --elesos
  • 4. re: HTTP请求(GET与POST区别)和响应
  • 何静静
  • --ssss
  • 5. re: HTTP请求(GET与POST区别)和响应[未登录]
  • !@#¥%……&
  • --a

阅读排行榜

评论排行榜

View Post

Struts配置连接池错误解决问题及实例

我用的是tomcat5.5,配置了日志之后打印出下列信息:
       ERROR main org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.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
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
    at java.lang.Class.getConstructor0(Class.java:2640)
    at java.lang.Class.getDeclaredConstructor(Class.java:1953)
    ……


    从日志信息看问题已经很明显了,是applicationContext.xml的dataSource问题。
解决方法:
1  将<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    改为<bean id="dataSource"class="org.springframework.jdbc.datasource.DriverManagerDataSource">之后问题得到解决。(org.springframework.jdbc.datasource.DriverManagerDataSource 不可以使用连接池。)
2 org.apache.commons.dbcp.BasicDataSource作为注入的DataSource源,为了使用 DBCP的功能,必须要将commons-dbcp.jar加入CLASSPATH中,另外还需要commons-pool.jar和commons- collections.jar,这些都可以在Spring的lib目录下找到。
org.springframework.jdbc.datasource.DriverManagerDataSource并没有提供连接池的功能,只能作作简单的单机连接测试。使用org.apache.commons.dbcp.BasicDataSource时缺少commons-pool.jar所以会出现如题的问题。 
    从日志信息看问题已经很明显了,是applicationContext.xml的dataSource问题。
解决方法:
1  将<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    改为<bean id="dataSource"class="org.springframework.jdbc.datasource.DriverManagerDataSource">之后问题得到解决。(org.springframework.jdbc.datasource.DriverManagerDataSource 不可以使用连接池。)
2 org.apache.commons.dbcp.BasicDataSource作为注入的DataSource源,为了使用 DBCP的功能,必须要将commons-dbcp.jar加入CLASSPATH中,另外还需要commons-pool.jar和commons- collections.jar,这些都可以在Spring的lib目录下找到。
org.springframework.jdbc.datasource.DriverManagerDataSource并没有提供连接池的功能,只能作作简单的单机连接测试。使用org.apache.commons.dbcp.BasicDataSource时缺少commons-pool.jar所以会出现如题的问题。

posted on 2007-11-26 23:37 sun 阅读(1300) 评论(1)  编辑  收藏 所属分类: spring 、hibernate 、struts

View Comments

# re: Struts配置连接池错误解决问题及实例  回复  更多评论   
fvf
2008-05-13 14:51 | f
新用户注册  刷新评论列表  

只有注册用户登录后才能发表评论。


网站导航:
博客园   IT新闻   Chat2DB   C++博客   博问   管理
相关文章:
  • Struts配置连接池错误解决问题及实例
  • Spring事务管理
  • Spring Bean 封装机制——Spring学习笔记(2)
  • 控制反转(IOC)与依赖注入(DI)——spring学习笔记(1)
 
 
Powered by:
BlogJava
Copyright © sun