oracle Websphere 应用程序服务器数据源
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1677722/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Websphere Application Server Data Source
提问by Rutvij Shah
We are facing a strange problem with Websphere Application Server Data Source.
我们正面临 Websphere Application Server 数据源的一个奇怪问题。
Environment:
环境:
- Websphere Application Server (6.1)
- Linux
- Liferay Portal (5.2)
- Oracle 9i
- Hibernate 3.0
- Websphere 应用程序服务器 (6.1)
- Linux
- Liferay 门户 (5.2)
- 甲骨文 9i
- 休眠 3.0
We have datasource deployed in Application server referencing ODBC14.jar
我们在应用程序服务器引用中部署了数据源 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
引起:java.sql.SQLException:DSRA8101E:DataSource 类不能用作一个阶段:ClassCastException:oracle.jdbc.pool.OracleConnectionPoolDataSource 与 com.ibm.ws.rsadapter.AdapterUtil.toSQLException 处的 javax.sql.ConnectionPoolDataSource 不兼容( AdapterUtil.java:1375) 在 com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:462) 在 com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.javaorg:418) 在.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69) 在 org.hibernate.jdbc.ConnectionManager.openConnection
We've tried the following workaround Came to know classes12.jar was there in WEB-INF/libWhich has ORACLE Driver which can cause Class Loading conflict with Shared/apps/lib ODBC14.jar
我们已经尝试了以下解决方法 开始知道WEB-INF/lib 中有 classes12.jar其具有 ORACLE 驱动程序,这会导致类加载与 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?
所以从 Web 应用程序 Lib 中删除 classes12.jar 并重新部署应用程序并重新启动,但再次出现相同的错误。关于如何解决这个问题的任何想法?
回答by Binil Thomas
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.
DSRA8101E:DataSource 类不能用作单阶段:ClassCastException:{0} 说明:如果 DataSource 类实现 ConnectionPoolDataSource,则只能将“enable2Phase”属性设置为 false。用户响应:将 XADataSource 的“enable2Phase”设置为 true,将 ConnectionPoolDataSource 设置为 false。
Did you try setting the enable2Phase to false?
您是否尝试将 enable2Phase 设置为 false?
回答by jacob
I had same issue in websphere 7 when I trying to use classes12.jar connect to old oracle database.
当我尝试使用 classes12.jar 连接到旧的 oracle 数据库时,我在 websphere 7 中遇到了同样的问题。
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.
我的解决方案是为 websphere 应用程序 V4 数据源创建一个新的用户定义的 jdbc 提供程序(新类型的数据源将导致不兼容的问题),它将指向旧的 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!)
并使用isolate选项来隔离新的oracle数据源(如果你有的话)以防止类加载器冲突(这很重要!)
The old websphere v4 datasource don't have this option.
旧的 websphere v4 数据源没有这个选项。
回答by user3653909
In the JDBC Provider section just Checking the checkbox "Isolate this resource provider" worked for me.
在 JDBC Provider 部分,只检查复选框“隔离此资源提供程序”对我有用。