标签:postgresql java jboss linux 数据库
在JAVA中JDK版本与JDBC版本的一致性十分重要,开发都们常常会忽略了这一点导致很多不必要的错误。昨天给客户排查了一个关于EDB在JBoss中使用时关于这方面的问题,希望给大家一点启发。
系统环境:
Red Hat Enterpirse Linux 6
JBoss Enterprise Application Server 6
EnterpriseDB Postgres Plus Advanced Server 9
Oracle JDK 1.6
问题症状:
在JBoss日志中间歇性地出现以下错误
java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/jdbc/DSZY101----Caused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/jdbc/DSZY101-- at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:390)-- at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)-- at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)-- at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:159)-- at jp.co.toyota.perz060.servlet.CCERZ060.getConnection(CCERZ060.java:489)-- at jp.co.toyota.perz060.servlet.CCERZ060.doPost(CCERZ060.java:118)-- at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)-- at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at jp.co.toyota.pzy1352.util.CIZY1392.doFilter(CIZY1392.java:362)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at jp.co.toyota.pzy1900.util.CIZY1947.doFilter(CIZY1947.java:99)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)-- at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)-- at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)-- at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)-- 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:368)-- at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505)-- at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:452)-- at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)-- at java.lang.Thread.run(Thread.java:662)----Caused by: javax.resource.ResourceException: IJ000658: Unexpected throwable while trying to create a connection: null-- at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:371)-- at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)-- at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)-- at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)-- at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)-- at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)-- at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:159)-- at jp.co.toyota.perz060.servlet.CCERZ060.getConnection(CCERZ060.java:489)-- at jp.co.toyota.perz060.servlet.CCERZ060.doPost(CCERZ060.java:118)-- at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)-- at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at jp.co.toyota.pzy1352.util.CIZY1392.doFilter(CIZY1392.java:362)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at jp.co.toyota.pzy1900.util.CIZY1947.doFilter(CIZY1947.java:99)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)-- at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)-- at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)-- at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)-- 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:368)-- at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505)-- at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:452)-- at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)-- at java.lang.Thread.run(Thread.java:662)----Caused by: javax.resource.ResourceException: Could not create connection-- at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:277)-- at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:235)-- at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:761)-- at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)-- at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)-- at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)-- at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)-- at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)-- at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)-- at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:159)-- at jp.co.toyota.perz060.servlet.CCERZ060.getConnection(CCERZ060.java:489)-- at jp.co.toyota.perz060.servlet.CCERZ060.doPost(CCERZ060.java:118)-- at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)-- at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at jp.co.toyota.pzy1352.util.CIZY1392.doFilter(CIZY1392.java:362)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at jp.co.toyota.pzy1900.util.CIZY1947.doFilter(CIZY1947.java:99)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)-- at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)-- at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)-- at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)-- 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:368)-- at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505)-- at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:452)-- at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)-- at java.lang.Thread.run(Thread.java:662)----Caused by: com.edb.util.PSQLException: The connection attempt failed.-- at com.edb.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:189)-- at com.edb.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)-- at com.edb.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:161)-- at com.edb.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)-- at com.edb.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:23)-- at com.edb.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)-- at com.edb.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:25)-- at com.edb.Driver.makeConnection(Driver.java:391)-- at com.edb.Driver.connect(Driver.java:266)-- at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:249)-- at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:235)-- at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:761)-- at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)-- at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)-- at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)-- at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)-- at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)-- at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)-- at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:159)-- at jp.co.toyota.perz060.servlet.CCERZ060.getConnection(CCERZ060.java:489)-- at jp.co.toyota.perz060.servlet.CCERZ060.doPost(CCERZ060.java:118)-- at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)-- at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at jp.co.toyota.pzy1352.util.CIZY1392.doFilter(CIZY1392.java:362)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at jp.co.toyota.pzy1900.util.CIZY1947.doFilter(CIZY1947.java:99)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)-- at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)-- at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)-- at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)-- 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:368)-- at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505)-- at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:452)-- at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)-- at java.lang.Thread.run(Thread.java:662)----Caused by: java.net.SocketException: Too many open files-- at java.net.Socket.createImpl(Socket.java:397)-- at java.net.Socket.<init>(Socket.java:371)-- at java.net.Socket.<init>(Socket.java:189)-- at com.edb.core.PGStream.<init>(PGStream.java:70)-- at com.edb.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:115)-- at com.edb.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)-- at com.edb.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:161)-- at com.edb.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)-- at com.edb.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:23)-- at com.edb.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)-- at com.edb.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:25)-- at com.edb.Driver.makeConnection(Driver.java:391)-- at com.edb.Driver.connect(Driver.java:266)-- at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:249)-- at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:235)-- at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:761)-- at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)-- at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)-- at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)-- at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)-- at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)-- at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)-- at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:159)-- at jp.co.toyota.perz060.servlet.CCERZ060.getConnection(CCERZ060.java:489)-- at jp.co.toyota.perz060.servlet.CCERZ060.doPost(CCERZ060.java:118)-- at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)-- at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at jp.co.toyota.pzy1352.util.CIZY1392.doFilter(CIZY1392.java:362)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at jp.co.toyota.pzy1900.util.CIZY1947.doFilter(CIZY1947.java:99)-- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)-- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)-- at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)-- at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)-- at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)-- at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)-- 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:368)-- at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505)-- at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:452)-- at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)-- at java.lang.Thread.run(Thread.java:662)--
E 2014-06-15 20:27:44.272 XML - 0 - -
问题分析:
<
module
xmlns
=
"urn:jboss:module:1.0"
name
=
"com.edb"
>
<
resources
>
<
resource-root
path
=
"edb-jdbc16.jar"
/>
</
resources
>
<
dependencies
><
module
name
=
"javax.api"
/></
dependencies
>
</
module
>
分析图解:
解决方案:
解决结果【未进行】:
当前以上所暴露的问题只是一个推断,由于客户当前是一个生产系统,无法现场进行测试及修复。【未完待续】
jdbc14 及 jdbc16 共存所带来的问题【未完待续】,布布扣,bubuko.com
jdbc14 及 jdbc16 共存所带来的问题【未完待续】
标签:postgresql java jboss linux 数据库
原文地址:http://blog.csdn.net/scottsiu/article/details/31751511