Java JDBC 接続プールがデプロイメント時に検証されるのはなぜですか?
Java EE アプリケーション (.ear) のデプロイ中に問題が発生しました。問題は、アプリで使用している JDBC 接続プールに関連しています。アプリケーションをサーバーにデプロイできません。これは私がコンソールで得たものです:
WARNING: RAR5038:Unexpected exception while creating resource for pool oracle_PROD_Pool. Exception : javax.resource.spi.ResourceAllocationException: Connection could not be allocated because: Wyjątek we-wy: The Network Adapter could not establish the connection
WARNING: RAR5117 : Failed to obtain/create connection from connection pool [ oracle_PROD_Pool ]. Reason : com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: Wyjątek we-wy: The Network Adapter could not establish the connection
WARNING: RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: Connection could not be allocated because: Wyjątek we-wy: The Network Adapter could not establish the connection]
SEVERE: Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: Wyjątek we-wy: The Network Adapter could not establish the connection
Error Code: 0...
次に、SQLException スタック トレースを取得し、デプロイに失敗します。
データベース サーバーにアクセスできず、接続を作成できないことが原因であることはわかっていますが、とにかくアプリをデプロイし、「アプリの使用時間」で SQLException を取得したいと考えています。これは私の jdbc 接続プールの定義です。
<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.OracleConnectionPoolDataSource"
fail-all-connections="true"
idle-timeout-in-seconds="300"
is-connection-validation-required="true"
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_PROD_Pool"
non-transactional-connections="false"
pool-resize-quantity="2"
res-type="javax.sql.ConnectionPoolDataSource"
statement-timeout-in-seconds="-1"
steady-pool-size="8"
validate-atmost-once-period-in-seconds="0"
wrap-jdbc-objects="true">
<property name="User" value="user"/>
<property name="DatabaseName" value="PROD"/>
<property name="Password" value="pass"/>
<property name="DataSourceName" value="OracleConnectionPoolDataSource"/>
<property name="ServerName" value="172.27.0.101"/>
<property name="DriverType" value="thin"/>
<property name="ExplicitCachingEnabled" value="false"/>
<property name="MaxStatements" value="0"/>
<property name="NetworkProtocol" value="tcp"/>
<property name="ImplicitCachingEnabled" value="false"/>
<property name="URL" value="jdbc:oracle:thin:@172.27.0.101:1521:PROD"/>
<property name="PortNumber" value="1521"/>
<property name="LoginTimeout" value="0"/>
</jdbc-connection-pool>
および関連する jdbc リソース:
<jdbc-resource enabled="true" jndi-name="jdbc/oraclePROD" object-type="user" pool-name="oracle_PROD_Pool"/>
この問題は、新しいバージョンの GlassFish サーバー 3.1.2.2 に移行した後に発生します。以前はglassFish 3.1.1(ビルド12)を使用していましたが、展開に問題はありませんでした.つまり、展開時に接続プールがチェックされず、データが取り込まれませんでした.アプリケーションがデータベースからデータを取得するコードを実行しようとしたときに発生しました.描かれたjdbc接続プールからの接続を使用しています。
私はそれについて少しイライラしています。デプロイ時に jdbc 接続プールの作成と設定を無効にする方法はありますか? よろしくお願いします。--ヤロスワフ