0 Replies Latest reply on May 22, 2003 6:00 AM by tyon

    Problem with OracleXADataSource

    tyon Newbie

      Hi,all,
      on JBoss3.2.1, I config a OracleXADataSource,

      <xa-datasource>
      <jndi-name>XASMSDS</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.168.19.57:1521:smsdatabase</xa-datasource-property>
      <xa-datasource-property name="User">sms</xa-datasource-property>
      <xa-datasource-property name="Password">sms</xa-datasource-property>
      <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
      </xa-datasource>

      and try to use the XADS in a SessionBean,
      public void aaa() {
      try {
      //get naming context
      Context ctx = getInitContex();

      javax.sql.DataSource ref1 = (javax.sql.DataSource)ctx.lookup("java:/XASMSDS");
      java.sql.Connection conn = ref1.getConnection();
      java.sql.Statement stat = conn.createStatement();

      conn.close();
      }
      catch(Exception e) {
      e.printStackTrace();
      }
      }

      private Context getInitContex() throws Exception{
      String url = "jnp://localhost:1099";
      Properties pros = null;
      try{
      pros = new Properties();
      pros.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      pros.put(Context.PROVIDER_URL,url);
      return new InitialContext(pros);
      }
      catch(Exception e){
      e.printStackTrace();
      }
      return null;
      }
      but a Exception occured when the method aaa() called "ref1.getConnection()":

      16:24:48,419 ERROR [STDERR] java.sql.SQLException: ORA-06550: row 1 , col 13 :

      PLS-00201: must declare flag 'JAVA_XA.XA_START_NEW'
      ORA-06550: row 1 , col 7:
      PL/SQL: Statement ignored
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
      at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
      at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
      at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
      at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
      at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
      at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
      at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:407)
      at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:171)
      at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.start(XAManagedConnection.java:133)
      at org.jboss.tm.TransactionImpl.startResource(TransactionImpl.java:1137)
      at org.jboss.tm.TransactionImpl.enlistResource(TransactionImpl.java:624)
      at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:460)
      at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:358)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:490)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:798)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)
      at tt.session.wooBean.aaa(wooBean.java:38)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:629)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:322)
      at org.jboss.ejb.Container.invoke(Container.java:674)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:359)
      at java.lang.reflect.Method.invoke(Native Method)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:236)
      at sun.rmi.transport.Transport$1.run(Transport.java:147)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:143)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:479)