views:

827

answers:

2

We are facing a strange problem with Websphere Application Server Data Source.

Environment:

  • Websphere Application Server (6.1)
  • Linux
  • Liferay Portal (5.2)
  • Oracle 9i
  • Hibernate 3.0

We have datasource deployed in Application server referencing ODBC14.jar

Hibernate Configuration for Datasource:

<property name="connection.datasource">jdbc/appDB</property>
<property name="jndi.class">com.ibm.websphere.naming.WsnInitialContextFactory</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="connection.autocommit">false</property>

We are getting following exception:

Caused by: java.sql.SQLException: DSRA8101E: DataSource class cannot be used as one-phase: ClassCastException: oracle.jdbc.pool.OracleConnectionPoolDataSource incompatible with javax.sql.ConnectionPoolDataSource at com.ibm.ws.rsadapter.AdapterUtil.toSQLException(AdapterUtil.java:1375) at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:462) at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:418) at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69) at org.hibernate.jdbc.ConnectionManager.openConnection

We've tried the following workaround Came to know classes12.jar was there in WEB-INF/lib Which has ORACLE Driver which can cause Class Loading conflict with Shared/apps/lib ODBC14.jar

So removed classes12.jar from Web application Lib and redeployed application and restarted, but got same error again. Any idea on how to resolve this?

A: 

DSRA8101E: DataSource class cannot be used as one-phase: ClassCastException: {0} Explanation: The 'enable2Phase' property may only be set to false if the DataSource class implements ConnectionPoolDataSource. User Response: Set 'enable2Phase' to true for XADataSource or false for ConnectionPoolDataSource.

Did you try setting the enable2Phase to false?

binil
A: 

I had same issue in websphere 7 when I trying to use classes12.jar connect to old oracle database.

My solution is create a new user-defined jdbc provider for the websphere application V4 datasource(new type datasource will casuse the incompatible issue) which will point to the old classes12.jar.

And use the isolate option to isolate the new oracle datasource(if you have one) to prevent classloader conflict(This is very important!)

The old websphere v4 datasource don't have this option.

jacob