启动池时ucp未能创建initialpoolsize连接:java.lang.nullpointerexception-

inb24sb2  于 2021-07-03  发布在  Java
关注(0)|答案(0)|浏览(323)

pooldatasource pds=pooldatasourcefactory.getpooldatasource();

try {

        LOGGER.info("testing  Pool creation  ::::" );

        LOGGER.info("testing  Pool creation  ::::    in test" );
        if (StringUtils.isEmpty(poolname)) {
            throw new UCPConnectionException("Pool name derived from Sys-config was not valid...");
        }
        if (StringUtils.isEmpty(url)|| StringUtils.isEmpty(user) || StringUtils.isEmpty(pswd)) {
            throw new UCPConnectionException(
                    "Invalid Connection Parameters.Terminating the creation of Pool DataSource");
        }
        //String ONS_CONFIG = "nodes=hract21:6200,hract22:6200,hract23:6200";
        //pds.setONSConfiguration ( ONS_CONFIG);
        //pds.setFastConnectionFailoverEnabled( true);
        pds.setConnectionFactoryClassName(factoryName);
        pds.setURL(url);
        pds.setUser(user);
        pds.setPassword(DatabaseConnectionHelper.decryptPassword(pswd));
        pds.setConnectionPoolName(poolname);

        pds.setInitialPoolSize(50);
        // Default is 0. Set the minimum number of connections
        // that is maintained by UCP at runtime.
        pds.setMinPoolSize(50);

        // Default is Integer.MAX_VALUE (2147483647). Set the maximum number of
        // connections allowed on the connection pool.
        pds.setMaxPoolSize(200);

        // Default is 30secs. Set the frequency in seconds to enforce the timeout
        // properties. Applies to inactiveConnectionTimeout(int secs),
        // AbandonedConnectionTimeout(secs)& TimeToLiveConnectionTimeout(int secs).
        // Range of valid values is 0 to Integer.MAX_VALUE. .
        pds.setTimeoutCheckInterval(25);

        // Default is 0. Set the maximum time, in seconds, that a
        // connection remains available in the connection pool.
        pds.setInactiveConnectionTimeout(50);

        // Set the JDBC connection properties after pool has been created
        Properties connProps = new Properties();
        connProps.setProperty("fixedString", "false");
        connProps.setProperty("remarksReporting", "false");
        connProps.setProperty("restrictGetTables", "false");
        connProps.setProperty("includeSynonyms", "false");
        connProps.setProperty("defaultNChar", "false");
        connProps.setProperty("AccumulateBatchResult", "false");

        // JDBC connection properties will be set on the provided
        // connection factory.
        pds.setConnectionProperties(connProps);
        // hardcoded values end
        pds.setValidateConnectionOnBorrow(true);
        // pds.setConnectionProperties(connProps);
        LOGGER.info("Establishing Pool creation ::::::::::::::::::::::::::::::::::::: ::::" + poolname);
        UniversalConnectionPoolManagerImpl.getUniversalConnectionPoolManager()
                .createConnectionPool((UniversalConnectionPoolAdapter) pds);
        LOGGER.info("Starting Pool creation  ::::" + poolname);
        UniversalConnectionPoolManagerImpl.getUniversalConnectionPoolManager().startConnectionPool(poolname);

    } catch (Exception  ue) {
        ue.printStackTrace();
        LOGGER.error("Unable to create/Start the UCP connection pool due to " + ue.getMessage());
        throw new UniversalConnectionPoolException("Exception occured when trying to create the pool ");
    }
    return pds;

============================================
错误| 11月24日,11:00:31]com.oracle.cegbu.microservice.sync.service.db.connection.managedbconnectionpool:121 - 无法创建/启动ucp连接池,原因是oracle.ucp.universalconnectionpoolexception:在以下位置启动池时未能创建initialpoolsize连接:java.lang.nullpointerexceptionoracle.ucp.util.ucperrorhandler.newuniversalconnectionpoolexception(ucperrorhandler。java:336)~[oracle.ucp。jar:19.3.0.0.0]在oracle.ucp.util.ucperrorhandler.throwuniversalconnectionpoolexception(ucperrorhandler。java:59)~[oracle.ucp。jar:19.3.0.0.0]在oracle.ucp.common.core.initialize(core。java:1783)~[oracle.ucp。jar:19.3.0.0.0]在oracle.ucp.common.universalconnectionpoolbase.start(universalconnectionpoolbase。java:705)~[oracle.ucp。jar:19.3.0.0.0]在oracle.ucp.jdbc.oracle.oraclejdbcconnectionpool.start(oraclejdbcconnectionpool。java:129)~[oracle.ucp。jar:19.3.0.0.0]在oracle.ucp.admin.universalconnectionpoolmanagerbase.startconnectionpool(universalconnectionpoolmanagerbase。java:363)~[oracle.ucp。jar:19.3.0.0.0]位于com.oracle.cegbu.microservice.sync.service.db.connection.managedbconnectionpool.createconnectionpool(managedbconnectionpool)。java:118)[同步客户端服务。jar:20.12.0.0]在com.oracle.cegbu.microservice.sync.service.akka.process.syncprocesssingleton.createpools(syncprocesssingleton。java:99)[同步客户端服务。jar:20.12.0.0]在com.oracle.cegbu.microservice.sync.service.akka.process.syncprocesssingleton.pooliitlize(syncprocesssingleton。java:77)[同步客户端服务。jar:20.12.0.0]

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题