Druid 使用的版本是1.0.7
数据库框架使用ibatis
配置如下:
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password -->
<property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:orcl" />
<property name="username" value="abcd" />
<property name="password" value="abcd" />
<!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="10" />
<property name="minIdle" value="5" />
<property name="maxActive" value="20" />
<!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="60000" />
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="60000" />
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="300000" />
<property name="validationQuery" value="SELECT 'x'" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" />
<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
<property name="poolPreparedStatements" value="true" />
<property name="maxPoolPreparedStatementPerConnectionSize" value="20" />
<!-- 配置监控统计拦截的filters -->
<property name="filters" value="stat" />
</bean>
错误信息如下:
101600 ERROR [http-8080-exec-2] [2014-07-04 11:13:01,585] com.alibaba.druid.pool.DruidDataSource.recycle[1206]- recyle error
java.lang.NullPointerException
at oracle.jdbc.driver.PhysicalConnection.cacheBuffer(PhysicalConnection.java:6808)
at oracle.jdbc.driver.OraclePreparedStatement.releaseBuffers(OraclePreparedStatement.java:3012)
at oracle.jdbc.driver.T4CPreparedStatement.releaseBuffers(T4CPreparedStatement.java:241)
at oracle.jdbc.driver.OraclePreparedStatement.enterImplicitCache(OraclePreparedStatement.java:3094)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.enterImplicitCache(OraclePreparedStatementWrapper.java:1588)
at com.alibaba.druid.util.OracleUtils.enterImplicitCache(OracleUtils.java:65)
at com.alibaba.druid.pool.PreparedStatementPool.put(PreparedStatementPool.java:83)
at com.alibaba.druid.pool.DruidPooledConnection.closePoolableStatement(DruidPooledConnection.java:163)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.close(DruidPooledPreparedStatement.java:201)
at com.alibaba.druid.pool.DruidConnectionHolder.reset(DruidConnectionHolder.java:233)
at com.alibaba.druid.pool.DruidDataSource.recycle(DruidDataSource.java:1162)
at com.alibaba.druid.pool.DruidPooledConnection.recycle(DruidPooledConnection.java:285)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_recycle(FilterChainImpl.java:4534)
at com.alibaba.druid.filter.stat.StatFilter.dataSource_releaseConnection(StatFilter.java:646)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_recycle(FilterChainImpl.java:4530)
at com.alibaba.druid.pool.DruidPooledConnection.close(DruidPooledConnection.java:233)
at org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:286)
at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:161)
at $Proxy90.close(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.ibatis.common.jdbc.logging.ConnectionLogProxy.invoke(ConnectionLogProxy.java:68)
at $Proxy91.close(Unknown Source)
at com.ibatis.sqlmap.engine.transaction.external.ExternalTransaction.close(ExternalTransaction.java:82)
at com.ibatis.sqlmap.engine.transaction.TransactionManager.end(TransactionManager.java:93)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:734)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:176)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:153)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:835)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:574)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:122)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:98)
at com.besttone.rws.dao.rp.RpSelfHouseDaoImpl.selectOrderReceYear(RpSelfHouseDaoImpl.java:779)
at com.besttone.rws.service.rp.RpSelfHouseServiceImpl.selectOrderReceYear(RpSelfHouseServiceImpl.java:2184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
at $Proxy42.selectOrderReceYear(Unknown Source)
at com.besttone.rws.action.sys.ApprovalProcessAction.loadHasApprovedOrder(ApprovalProcessAction.java:839)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:124)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.besttone.rws.filter.UserSessionFilter.doFilter(UserSessionFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.besttone.rws.filter.CSRFFilter.doFilter(CSRFFilter.java:40)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at cn.sh.ideal.product.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:34)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:886)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:721)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2256)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
相关推荐
在SpringBoot3中,开发者可能会遇到使用Druid数据源时出现的问题,比如启动报错以及配置不生效。本文将深入探讨这些问题的成因,并提供解决方案。 首先,了解Druid。Druid是一个由阿里巴巴开发的高性能数据库连接池...
将 client-adapter.es7x-1.1.5-jar-with-dependencies.jar 替换plugin下的jar可以解决druid报错问题,注意版本1.1.5,不是这个版本不一定能解决
这是一个基于Spring 2.0,基于Mysql8.0,Springboot2.0,Druid 1.1,Jpa demo搭建的,本资源对应的博客链接https://blog.csdn.net/qq_37925580/article/details/88398066
然而,当Mycat与MySQL 8.0及以上版本配合使用时,可能会遇到一些兼容性问题,其中“query_cache_size”报错就是典型的例子。 在MySQL 8.0中,查询缓存功能被默认禁用,并且在某些版本中被完全移除。这是由于MySQL...
在默认情况下,Flowable可能使用的是其他数据库驱动,例如H2或Oracle等。但根据标题和描述,我们需要将Flowable的数据库驱动更换为MySQL,并且使用Druid作为数据连接池。这个过程涉及到几个关键知识点,下面将逐一...
2. **SQL解析**:Druid提供了SQL解析功能,可以对执行的SQL语句进行统计分析,帮助开发者了解系统的SQL执行情况,优化数据库查询性能。 3. **监控与日志**:Druid内置了强大的监控统计功能,包括连接池状态、SQL...
报错异常: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassCastException: com.alibaba.druid.pool.DruidDataSource cannot be cast to com.alibaba.druid.pool.DruidDataSource 可用...
NULL 博文链接:https://jian1120java.iteye.com/blog/1974813
然而,在实际应用中,使用Springboot、Mybatisplus和Druid进行数据访问时,出现了部分功能正常,部分功能报错的“Access deny”问题。这通常是因为权限配置不完整或者某些特定操作未被授权。 解决这个问题的关键...
项目基于jdk1.8整合了springboot+mvc+mybatis(通用mapper)+druid+jsp+bootstrap等技术,springboot+Listener(监听器),Filter(过滤器),Interceptor(拦截器),Servlet,springmvc静态资源,文件上传下载,多数据源切换,缓存...
-- 如果不加入这个依赖项,配置监控统计拦截的filters时,这个会报错 --> <groupId>log4j <artifactId>log4j <version>1.2.17 <groupId>org.springframework.boot <artifactId>spring-boot-starter-web ...
稳定,解决class com.alibaba.druid.pool.DruidDataSource cannot be cast to class com.alibaba.druid.pool.DruidDataSource 报错问题
博客系统已经上线的编辑器使用markdown如果不会docker有非docker的部署方式,默认的是非docker部署的maven构建
数据源使用阿里巴巴的温少开发的Druid, 使用Junit4进行单元测试, 使用Log4j管理日志 本例仅为示例,结构简单,不包含Ajax 测试url http://localhost:8080/ssmm_demo/userController/showUser.do?id=1 ...
标题中的“Tomcat报错:JDBC unregister 解决办法”是指在使用Apache Tomcat服务器时,遇到的一个常见问题,即Web应用程序在启动时成功注册了JDBC驱动,但在关闭时未能正确注销,导致Tomcat在防止内存泄漏的机制下...
解决canal同步es报错: java.lang.ClassCastException: com.alibaba.druid.pool.DruidDataSource cannot be cast to com.alibaba.druid.pool.DruidDataSource
"springmvc_mybatis_多数据源"这个项目就是针对这种情况提供的一种解决方案。 首先,我们来看SpringMVC如何处理多数据源。在SpringMVC中,我们可以利用Spring的DataSourceTransactionManager和...
描述中的“elasticsearch-sql-6.3.2 需要先编译,否则会报错”指出在未提供预编译版本的情况下,用户通常需要下载源代码并执行编译步骤,这可能会遇到错误,特别是对于不熟悉构建工具和依赖管理的用户来说,这可能是...
其中druid组件不要调用超过1.0.16版本的,会报错。。 elasticsearch 6.3.0的好像调用了x-pack组件会报错,所以暂时没提供支持。 目前支持 elasticsearch 6.2.4 elasticsearch-sql 6.2.4 驱动的名字继续沿用elastic...
js+jquery+ajax的前端页面,Spring IOC的对象管理,Spring MVC的业务控制,MyBaties的持久层处理,Druid的连接池,Shiro的认证及权限管理,Spring AOP方式的日志管理,Jackson返回数据