最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

SSH2+proxool出现Nosuitabledriverfoundforproxool.mysqlP

来源:动视网 责编:小采 时间:2020-11-09 07:45:51
文档

SSH2+proxool出现Nosuitabledriverfoundforproxool.mysqlP

SSH2+proxool出现Nosuitabledriverfoundforproxool.mysqlP:首先我们要明确使用的是SSH2框架,然而Struts2是基于filter实现的那么在启动proxool的时候就不能够在用servlet来启动了! 于是我们就想到在初始化web容器的时候怎么让他一开始就加载呢? 我们查看tomcat的启动信息: Starting Servlet En
推荐度:
导读SSH2+proxool出现Nosuitabledriverfoundforproxool.mysqlP:首先我们要明确使用的是SSH2框架,然而Struts2是基于filter实现的那么在启动proxool的时候就不能够在用servlet来启动了! 于是我们就想到在初始化web容器的时候怎么让他一开始就加载呢? 我们查看tomcat的启动信息: Starting Servlet En


首先我们要明确使用的是SSH2框架,然而Struts2是基于filter实现的那么在启动proxool的时候就不能够在用servlet来启动了! 于是我们就想到在初始化web容器的时候怎么让他一开始就加载呢? 我们查看tomcat的启动信息: Starting Servlet Engine: Apache Tomcat

首先我们要明确使用的是SSH2框架,然而Struts2是基于filter实现的那么在启动proxool的时候就不能够在用servlet来启动了!

于是我们就想到在初始化web容器的时候怎么让他一开始就加载呢?

我们查看tomcat的启动信息:

Starting Servlet Engine: Apache Tomcat/6.0.13
2012-6-10 15:31:41 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2012-6-10 15:31:41 org.springframework.web.context.ContextLoader initWebApplicationContext
信息: Root WebApplicationContext: initialization started

最先启动的是spring容器,那么这样我们就可以将proxool的配置写在spring的配置文件中让它最先加载

如下:

	 
	
	
	
	
	
	
	
	
	 -->
 	

这样只需要在sessionFactory加上dataSource的引用即可如下:

 	
 	
 	
 	
 	
 

这样就不在需要配置proxool的servlet启动了,例如:

  
 ServletConfigurator 
  
 org.logicalcobwebs.proxool.configuration.ServletConfigurator 
  
  
 xmlFile 
 WEB-INF/classes/proxool.xml 
  
 1 
 
 
以上的配置就不在需要在web.xml中进行配置。
而在hibernate.cfg.xml中也不在需要proxool的配置只是配置一些hibernate的信息例如:
	true
	org.hibernate.dialect.MySQLDialect
和一些实体类的映射文件:
 
以上就将SSH2+PROXOOL的环境搭建好了。
 
但是在搭建好之后如果我们配置
 
 
又会提示如下错误:
Invalid property 'houseKeepingSleepTime' of bean class [org.logicalcobwebs.proxool.ProxoolDataSource]: Bean property 'houseKeepingSleepTime' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
大概意思是说'houseKeepingSleepTime'属性是不能够写的或者没有合适的setter方法。在他的参数setter和getter的返回结果类型不一致所导致的。
这个我想也正是他的bug吧。
那么具体解决如下:
在proxool-0.9.1.jar(我用的proxool架包)中找到org.logicalcobwebs.proxool.ProxoolDataSource将其源码修改如下:
 
源码是:
1./** 
2. * @see ConnectionPoolDefinitionIF#getHouseKeepingSleepTime 
3. */ 
4. public long getHouseKeepingSleepTime() { 
5. return houseKeepingSleepTime; 
6. } 
7. 
8. /** 
9. * @see ConnectionPoolDefinitionIF#getHouseKeepingSleepTime 
10. */ 
11. public void setHouseKeepingSleepTime(int houseKeepingSleepTime) { 
12. this.houseKeepingSleepTime = houseKeepingSleepTime; 
13. } 
 
修改为:
  1. /**
  2. * @see ConnectionPoolDefinitionIF#getHouseKeepingSleepTime
  3. */
  4. public long getHouseKeepingSleepTime() {
  5. return houseKeepingSleepTime;
  6. }
  7. /**
  8. * @see ConnectionPoolDefinitionIF#getHouseKeepingSleepTime
  9. *此处将int类型改为long类型
  10. */
  11. public void setHouseKeepingSleepTime(long houseKeepingSleepTime) {
  12. this.houseKeepingSleepTime = houseKeepingSleepTime;
  13. }
这样所有问题都解决!
以上所有步骤都是通过本人在网上查资料,自己手动配置而成。验证通过!
 
 
 

文档

SSH2+proxool出现Nosuitabledriverfoundforproxool.mysqlP

SSH2+proxool出现Nosuitabledriverfoundforproxool.mysqlP:首先我们要明确使用的是SSH2框架,然而Struts2是基于filter实现的那么在启动proxool的时候就不能够在用servlet来启动了! 于是我们就想到在初始化web容器的时候怎么让他一开始就加载呢? 我们查看tomcat的启动信息: Starting Servlet En
推荐度:
标签: 出现 mysql driver
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top