我今天花了一些时间试图在我的spring mvc 3.0应用程序配置中指定一个websphere 6.1 db2 jndi数据源。我已经按照http://www.ibm.com/developerworks/websphere/techjournal/0609_alcott/0609_alcott.html的指南进行了操作。
当我这样做时......
的web.xml
<resource-ref>
<res-ref-name>jdbc/reportingManagerDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref>
<res-ref-name>jdbc/reportingManagerCustDbDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
弹簧文件
<bean id="ePosDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/reportingManagerDataSource"/>
<property name="lookupOnStartup" value="false"/>
<property name="cache" value="true" />
<property name="proxyInterface" value="javax.sql.DataSource" />
</bean>
<jee:jndi-lookup id="ePosDataSource"
jndi-name="jdbc/reportingManagerDataSource"
cache="true"
resource-ref="true"
lookup-on-startup="false"
proxy-interface="javax.sql.DataSource"/>
<bean id="custDbDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/reportingManagerCustDbDataSource"/>
<property name="lookupOnStartup" value="false"/>
<property name="cache" value="true" />
<property name="proxyInterface" value="javax.sql.DataSource" />
</bean>
<jee:jndi-lookup id="custDbDataSource"
jndi-name="jdbc/reportingManagerCustDbDataSource"
cache="true"
resource-ref="true"
lookup-on-startup="false"
proxy-interface="javax.sql.DataSource"/>
我收到了错误......
org.springframework.jdbc.CannotGetJdbcConnectionException:无法获取JDBC连接;嵌套异常是java.sql.SQLException:DSRA8101E:DataSource类不能用作单阶段:ClassCastException:com.ibm.db2.jcc.DB2XADataSource与javax.sql.ConnectionPoolDataSource不兼容
我一直在疯狂地搜索,试图寻找解决方案,但一直没有成功。有人能告诉我成功设置数据源需要什么吗?
感谢