您的位置:首页 > 运维架构 > Linux

proxool移植到linux上出现的错误(1)

2017-02-28 23:14 176 查看
将本地项目移植到linux平台上出现了如下的bug,项目可以正常启动,当进行数据库查询时报错

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: org.logicalcobwebs.proxool.ProxoolException: Attempt to refer to a unregistered pool by its alias 'Dbblog'
### The error may exist in com/blog/web/mapper/essaysMapper.xml
### The error may involve com.blog.web.show.dao.interfaces.IessaysDao.findByUserId

我的代码: web.xml

<servlet>
<servlet-name>proxoolServletConfigurator</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator</servlet-class>
<init-param>
<param-name>xmlFile</param-name>
<param-value>/WEB-INF/config/proxool.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>applicationContext.xml
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>org.logicalcobwebs.proxool.ProxoolDriver</value>
</property>
<property name="url">
<value>proxool.Dbblog</value>
</property>
</bean>proxool.xml
<?xml version="1.0" encoding="UTF-8"?>
<proxool-config>
<proxool>
<alias>Dbblog</alias>
<driver-url>jdbc:mysql://localhost:3306/myblog?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8</driver-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-properties>
<property name="user" value="root" />
<property name="password" value="root" />
</driver-properties>
<house-keeping-sleep-time>60000</house-keeping-sleep-time>
<maximum-connection-count>20</maximum-connection-count> 
<minimum-connection-count>2</minimum-connection-count>
<prototype-count>0</prototype-count>
<simultaneous-build-throttle>20</simultaneous-build-throttle>
<house-keeping-test-sql>select CURRENT_DATE</house-keeping-test-sql>
<statistics>15s,10m,1d</statistics>
<statistics-log-level>INFO</statistics-log-level>
</proxool>
</proxool-config>

初看这个错误,以为是mysql-connector-java-5.1.10-bin.jar没有引入成功导致的,查询了大量的资料,先后
1.将jar包放入了jdk/jre/lib、jdk/jre/lib/ext、jdk/lib下,并配置了classpath  /usr/local/java/jdk1.7.0_79/lib/mysql-connector-java-5.1.10-bin.jar

然而并没有成功

2.将applicationContext.xml的加载优先级改为2

也没什么卵用

3.因为使用的是spring4×版本,已经取消了ContextLoaderServlet ,所以跳过了使用sevlet代替listener启用spring容器

4.使用了listener优先加载proxool.xml 

也失败了

明天继续与这个bug奋战
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息