本文介绍了无法从连接池获取/创建连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在带有primefaces 3.1的glassfish 3上运行

I am running on glassfish 3 with primefaces 3.1

知道为什么我会收到此异常吗?当我第一次创建数据源并运行它时,它运行良好,但是一段时间后,此错误开始出现.

Any idea why I am getting this exception? When I first create datasource and run it is running fine but after sometime this error starts appearing.

WARNING: RAR5117 : Failed to obtain/create connection from connection pool [ Oracle_TSH1_Pool ]. Reason : com.sun.appserv.connectors.internal.api.PoolingException
WARNING: RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: null]
SEVERE: java.sql.SQLException: Error in allocating a connection. Cause: null
    at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:120)
    at MYDataSource.getConnection(DatabaseConnection.java:65)
    at ScheduleDAO.loadSchedules(ScheduleDAO.java:48)
    at SchedulesBean.getSchedules(SchedulesBean.java:42)
    at SchedulesBean.<init>(SchedulesBean.java:28)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at java.lang.Class.newInstance0(Class.java:372)
    at java.lang.Class.newInstance(Class.java:325)
    at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:188)
    at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:102)
    at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409)
    at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)
    at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244)
    at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116)
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
    at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:99)
    at com.sun.el.parser.AstValue.getTarget(AstValue.java:127)
    at com.sun.el.parser.AstValue.getType(AstValue.java:76)
    at com.sun.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:195)
    at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98)
    at org.primefaces.component.datatable.DataTable.isLazy(DataTable.java:922)
    at org.primefaces.component.datatable.DataTableRenderer.encodeMarkup(DataTableRenderer.java:177)
    at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:103)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1763)
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1756)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)

我的glassfish-resource.xml

My glassfish-resource.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Resource Definitions //EN" "http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd">
<resources>
    <jdbc-resource enabled="true" jndi-name="jdbc/myDS"
        object-type="user" pool-name="Oracle_Pool" />

    <jdbc-connection-pool allow-non-component-callers="false"
        associate-with-thread="false" connection-creation-retry-attempts="0"
        connection-creation-retry-interval-in-seconds="10"
        connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0"
        connection-validation-method="auto-commit" datasource-classname="oracle.jdbc.pool.OracleDataSource"
        fail-all-connections="false" idle-timeout-in-seconds="300"
        is-connection-validation-required="false"
        is-isolation-level-guaranteed="true" lazy-connection-association="false"
        lazy-connection-enlistment="false" match-connections="false"
        max-connection-usage-count="0" max-pool-size="32"
        max-wait-time-in-millis="60000" name="Oracle_Pool"
        non-transactional-connections="false" pool-resize-quantity="2"
        res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1"
        steady-pool-size="8" validate-atmost-once-period-in-seconds="0"
        wrap-jdbc-objects="false">

        <property name="serverName" value="server" />

        <property name="PortNumber" value="1521" />

        <property name="DatabaseName" value="mydb" />

        <property name="User" value="user" />


        <property name="URL" value="jdbc:oracle:thin:@server:1521:mydb" />

        <property name="driverClass" value="oracle.jdbc.OracleDriver" />

    </jdbc-connection-pool>
</resources>

推荐答案

我已解决了问题,方法是将 ojdbc14.jar 复制到 glassfish \ domains \ domain1 \ lib \ ext

I resolved issue by copying ojdbc14.jar to glassfish\domains\domain1\lib\ext

这篇关于无法从连接池获取/创建连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 18:42