Oracle, Jboss, Java

keti
Дата: 01.06.2006 18:17:59
Hi
I have some problem.
I am working with JBoss4 , Oracle10g , java.

I need to create XADataSource in JBoss, so that my transaction able to support 2 phases submission.

Below is my code in oracle-ds.xml

<datasources>
<xa-datasource>
<jndi-name>XAOracleDS</jndi-name>
<track-connection-by-tx>true</track-connection-by-tx>
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
<xa-datasource-property name="URL">jdbc:oracle:thin:@192.9.200.177:1521:devnbtwo</xa-datasource-property>
<xa-datasource-property name="User">b1</xa-datasource-property>
<xa-datasource-property name="Password">b2</xa-datasource-property>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter </exception-sorter-class-name>
<no-tx-separate-pools/>
</xa-datasource>
<type-mapping>Oracle10g</type-mapping>

<!--<mbean code="org.jboss.resource.adapter.jdbc.xa.oracle.OracleXAExceptionFormatter" name="jboss.jca:service=OracleXAExceptionFormatter"> -->
<depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager </depends>
<!--</mbean>-->
</datasources>

and there is java Code :

XADataSource dataSource = (XADataSource)context.lookup("java:/XAOracleDS");

but this dosn't work, throws

EJBException: Error initializing context:javax.ejb.EJBException: java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.WrapperDataSource




May I know anybody can give me some suggestion of this code? May I know anything else should I do in my java code?

Thanks