jetty and Oracle Connection Pooling

孤者浪人 提交于 2019-12-12 05:42:03

问题


I am currently moving my Oracle Datasource pool creation from my Spring config to a jetty config, but I am getting the error below

[WARNING] Config error at

My Datasource config in Spring looks like

@Bean
public DataSource dataSource() throws IllegalStateException, SQLException {
    PoolDataSource dataSource = PoolDataSourceFactory.getPoolDataSource();

    dataSource.setConnectionFactoryClassName(env.getRequiredProperty(DB_CONNECTION_FACTORY_CLASS_NAME));
    dataSource.setURL(env.getRequiredProperty(DATABASE_URL));
    dataSource.setUser(env.getRequiredProperty(DATABASE_USERNAME));
    dataSource.setPassword(env.getRequiredProperty(DATABASE_PASSWORD));
    dataSource.setMinPoolSize(Integer.parseInt(env.getRequiredProperty(DATABASE_CONNECTION_MIN_POOL_SIZE)));
    dataSource.setMaxPoolSize(Integer.parseInt(env.getRequiredProperty(DATABASE_CONNECTION_MAX_POOL_SIZE)));
    dataSource.setInitialPoolSize(Integer.parseInt(env.getRequiredProperty(DATABASE_CONNECTION_INITIAL_POOL_SIZE)));

    return dataSource;
} 

In the jetty config, it looks like

   <New id="pds_datasource_pool" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg><Ref refid="wac"/></Arg>
<Arg>jdbc/pdsds</Arg>
<Arg>
  <New class="oracle.ucp.jdbc.PoolDataSource">
    <Set name="uRL">jdbc:oracle:thin:xxx</Set>
    <Set name="user">user</Set>
    <Set name="password">user_dev_01</Set>
    <Set name="minPoolSize">2</Set>
    <Set name="maxPoolSize">10</Set>
    <Set name="initialPoolSize">2</Set>
    <Set name="connectionFactoryClassName">oracle.jdbc.replay.OracleDataSourceImpl</Set>
  </New>
</Arg>

The logs only show the error mentioned above and I am not too sure what the problem is. I also included the 2 Oracle jars as dependencies but does not seem to work.

Ay help is appreciated.

Cheers

Kris


回答1:


Answering my own post here. Here are the settings to configure pooling in Jetty

   <New id="pDatasourcePool" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg><Ref refid="wac"/></Arg>
<Arg>jdbc/projectds</Arg>
<Arg>
  <Call class="oracle.ucp.jdbc.PoolDataSourceFactory" name="getPoolDataSource" >
    <Set name="URL">jdbc:oracle:thin:xxx</Set>
    <Set name="user">user</Set>
    <Set name="password">ser_dev1</Set>
    <Set name="minPoolSize">2</Set>
    <Set name="maxPoolSize">10</Set>
    <Set name="initialPoolSize">2</Set>
    <Set name="connectionFactoryClassName">oracle.jdbc.replay.OracleDataSourceImpl</Set>
  </Call>
</Arg>



来源:https://stackoverflow.com/questions/44625185/jetty-and-oracle-connection-pooling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!