删除连接到Oracle DB的连接后,已连续打印PooledConnection

时间:2016-05-17 06:57:20

标签: wso2esb

我已经安装了wso2esb-4.9.0,主数据源配置为oracle DB。当由于网络连接问题而导致与Oracle数据库的连接断开时,即使连接再次返回,也会不断打印以下错误。只有在重新启动后,异常才会停止。

TID:[ - 1234] [] [2016-05-16 00:53:21,457] ERROR {org.wso2.carbon.registry.core.utils.RegistryUtils} - 无法构造connectionId。 {} org.wso2.carbon.registry.core.utils.RegistryUtils java.sql.SQLRecoverableException:已关闭的连接     at oracle.jdbc.driver.PhysicalConnection.getMetaData(PhysicalConnection.java:3131)     at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:606)     在org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)     at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)     at org.wso2.carbon.ndatasource.rdbms.ConnectionRollbackOnReturnInterceptor.invoke(ConnectionRollbackOnReturnInterceptor.java:51)     at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)     at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:71)     at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)     at org.apache.tomcat.jdbc.pool.interceptor.ConnectionState.invoke(ConnectionState.java:153)     at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)     at org.apache.tomcat.jdbc.pool.TrapException.invoke(TrapException.java:41)     at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)     at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:80)     在com.sun.proxy。$ Proxy14.getMetaData(未知来源)     at org.wso2.carbon.registry.core.utils.RegistryUtils.getConnectionId(RegistryUtils.java:194)     at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCDatabaseTransaction $ ManagedRegistryConnection.getConnectionId(JDBCDatabaseTransaction.java:1133)     at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCDatabaseTransaction $ ManagedRegistryConnection.rollback(JDBCDatabaseTransaction.java:1288)     at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCTransactionManager.rollbackTransaction(JDBCTransactionManager.java:120)     at org.wso2.carbon.registry.core.jdbc.dao.JDBCLogsDAO.rollbackTransaction(JDBCLogsDAO.java:335)     at org.wso2.carbon.registry.core.jdbc.dao.JDBCLogsDAO.getLogList(JDBCLogsDAO.java:306)     在org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.getLogs(EmbeddedRegistry.java:2332)     在org.wso2.carbon.registry.core.caching.CacheBackedRegistry.getLogs(CacheBackedRegistry.java:402)     在org.wso2.carbon.registry.core.session.UserRegistry.getLogsInternal(UserRegistry.java:1806)     在org.wso2.carbon.registry.core.session.UserRegistry.access $ 3600(UserRegistry.java:60)     在org.wso2.carbon.registry.core.session.UserRegistry $ 37.run(UserRegistry.java:1777)     在org.wso2.carbon.registry.core.session.UserRegistry $ 37.run(UserRegistry.java:1774)     at java.security.AccessController.doPrivileged(Native Method)     在org.wso2.carbon.registry.core.session.UserRegistry.getLogs(UserRegistry.java:1774)     在org.wso2.carbon.registry.indexing.ResourceSubmitter.submitResource(ResourceSubmitter.java:119)     在org.wso2.carbon.registry.indexing.ResourceSubmitter.run(ResourceSubmitter.java:76)     at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:471)     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)     at java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.access $ 301(ScheduledThreadPoolExecutor.java:178)     at java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)     在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)     at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)     在java.lang.Thread.run(Thread.java:745)

主datasources.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?><datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">

<providers>
    <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
</providers>

<datasources>

    <datasource>
        <name>WSO2_CARBON_DB</name>
        <description>The datasource used for registry and user manager</description>
        <jndiConfig>
            <name>jdbc/WSO2CarbonDB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:oracle:thin:@xxx.xx.x.xxx:1528/dvdb</url>
        <username>esbuser</username>
                <password svns:secretAlias="Datasources.WSO2_CARBON_DB.Configuration.Password">password</password>
                <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
                <maxActive>80</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
    </datasource>
<datasource>
        <name>WSO2_REG_DB</name>
        <description>The datasource used for registry and user manager</description>
        <jndiConfig>
            <name>jdbc/WSO2REG</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:oracle:thin:@xxx.xx.x.xxx:1528/dvdb</url>
                <username>reguser</username>
                <password svns:secretAlias="Datasources.WSO2_REG_DB.Configuration.Password">password</password>
                <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                <testWhileIdle>true</testWhileIdle>
        <timeBetweenEvictionRunsMillis>1800000</timeBetweenEvictionRunsMillis>
        <numTestsPerEvictionRun>5</numTestsPerEvictionRun>
        <minEvictableIdleTimeMillis>3600000</minEvictableIdleTimeMillis>
            </configuration>
        </definition>
    </datasource>
    <!-- For an explanation of the properties, see: http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html -->
    <!--datasource>
        <name>SAMPLE_DATA_SOURCE</name>
        <jndiConfig>
            <name></name>
            <environment>
                <property name="java.naming.factory.initial"></property>
                <property name="java.naming.provider.url"></property>
            </environment>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>

                <defaultAutoCommit></defaultAutoCommit>
                <defaultReadOnly></defaultReadOnly>
                <defaultTransactionIsolation>NONE|READ_COMMITTED|READ_UNCOMMITTED|REPEATABLE_READ|SERIALIZABLE</defaultTransactionIsolation>
                <defaultCatalog></defaultCatalog>
                <username></username>
                <password svns:secretAlias="WSO2.DB.Password"></password>
                <maxActive></maxActive>
                <maxIdle></maxIdle>
                <initialSize></initialSize>
                <maxWait></maxWait>

                <dataSourceClassName>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</dataSourceClassName>
                <dataSourceProps>
                    <property name="url">jdbc:mysql://localhost:3306/Test1</property>
                    <property name="user">root</property>
                    <property name="password">123</property>
                </dataSourceProps>

            </configuration>
        </definition>
    </datasource-->

</datasources>

库/ CONF / registry.xml

<currentDBConfig>wso2registry</currentDBConfig>
<readOnly>false</readOnly>
<enableCache>true</enableCache>
<registryRoot>/</registryRoot>

<dbConfig name="wso2registry">
    <dataSource>jdbc/WSO2CarbonDB</dataSource>
</dbConfig>

<dbConfig name="remoteRegistry">
    <dataSource>jdbc/WSO2REG</dataSource>
</dbConfig>

<remoteInstance url="https://registryhost:9453/registry">
    <id>9453</id>
    <dbConfig>remoteRegistry</dbConfig>
    <readOnly>false</readOnly>
    <registryRoot>/</registryRoot>
</remoteInstance>

<mount path="/_system/config" overwrite="false">
    <instanceId>9453</instanceId>
    <targetPath>/_system/nodes</targetPath>
</mount>

<mount path="/_system/governance" overwrite="false">
    <instanceId>9453</instanceId>
    <targetPath>/_system/governance</targetPath>
</mount>

2 个答案:

答案 0 :(得分:0)

在我的情况下,问题是由文件存储库/ config / registry.xml中删除的错误行引起的。

我已删除此代码:

<dbConfig name="wso2registry">
    <dataSource>jdbc/WSO2CarbonDB</dataSource>
</dbConfig>

而不是添加另一个dbConfig标记。

对我来说,修正是重新添加标签。像这样:

<wso2registry>

<!-- These are used to define the DB configuration and the basic parameters to be used for the registry -->

<currentDBConfig>wso2registry</currentDBConfig>
<readOnly>false</readOnly>
<enableCache>true</enableCache>
<registryRoot>/</registryRoot>

<!-- This defines the default database and its configuration of the registry -->

<dbConfig name="wso2registry">
    <dataSource>jdbc/WSO2CarbonDB</dataSource>
</dbConfig>

<dbConfig name="sharedregistry">
    <dataSource>jdbc/WSO2RegistryDB</dataSource>
</dbConfig>
...
...
</wso2registry>

希望这篇文章可以帮助你...

答案 1 :(得分:0)

我遇到了同样的问题。

在master-datasources.xml中 1-设置与jndiConfig名称相同的数据源名称 2-设置2个不同的数据源,具有不同的名称,用于注册表和用户管理。 这是我的master-datasources.xml

<datasource>
        <name>WSO2REG_DB</name>
        <description>The datasource used for registry</description>
        <jndiConfig>
            <name>jdbc/WSO2REG_DB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:mysql://localhost:3306/registry?autoReconnect=true&amp;relaxAutoCommit=true&amp;</url>
                <username>apiuser</username>
                <password>apimanager</password>
                <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
    </datasource>

    <datasource>
        <name>WSO2UM_DB</name>
        <description>The datasource used for user management</description>
        <jndiConfig>
            <name>jdbc/WSO2UM_DB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:mysql://localhost:3306/userstore?autoReconnect=true&amp;relaxAutoCommit=true&amp;
                </url>
                <username>apiuser</username>
                <password>apimanager</password>
                <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
    </datasource>

在registry.xml中 1-使用用户管理数据源设置wso2registry dbConfig 2-设置govregistry dbConfig和注册表数据源

这是我的registry.xml

<dbConfig name="wso2registry">
    <dataSource>jdbc/WSO2UM_DB</dataSource>
</dbConfig>

<dbConfig name="govregistry">
    <dataSource>jdbc/WSO2REG_DB</dataSource>
</dbConfig>

它对我有用,我的IS-Server可以正常启动。当问题尚未解决时,希望它也适合你。