2 Replies Latest reply on Apr 21, 2009 1:30 AM by stefano_b

    user defined Datasource issue

      I have a script component to get Datasource and have two datasources defined deployed in two separate xml files one works and other does not.<br />Any idea why?<br />-------------------------------------------------------------<br />adobe-ds.xml<br /><?xml version="1.0" encoding="UTF-8"?><br /><datasources><br />     <local-tx-datasource><br />          <jndi-name>MYDefaultDS</jndi-name><br />          <connection-url>jdbc:oracle:thin:@//dbhost:1521/qa1</connection-url><br />          <driver-class>oracle.jdbc.driver.OracleDriver</driver-class><br />          <user-name>mydbuser</user-name><br />          <password>mydbpass</password><br />                <min-pool-size>1</min-pool-size><br />          <max-pool-size>30</max-pool-size><br />                <exception-sorter-class-name><br />          org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter<br />          </exception-sorter-class-name><br />          <blocking-timeout-millis>20000</blocking-timeout-millis><br />          <idle-timeout-minutes>10</idle-timeout-minutes><br />          <prepared-statement-cache-size>50</prepared-statement-cache-size><br />          <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation><br />     </local-tx-datasource><br /></datasources><br />---------------------------------------------------------------------------------<br />test-only-ds.xml<br /><br /><?xml version="1.0" encoding="UTF-8"?><br /><datasources><br />     <local-tx-datasource><br />          <jndi-name>MYDefaultDS</jndi-name><br />          <connection-url>jdbc:oracle:thin:@//dbhost:1521/qa1</connection-url><br />          <driver-class>oracle.jdbc.driver.OracleDriver</driver-class><br />          <user-name>mydbuser</user-name><br />          <password>mydbpass</password><br />                <min-pool-size>1</min-pool-size><br />          <max-pool-size>30</max-pool-size><br />                <exception-sorter-class-name><br />          org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter<br />          </exception-sorter-class-name><br />          <blocking-timeout-millis>20000</blocking-timeout-millis><br />          <idle-timeout-minutes>10</idle-timeout-minutes><br />          <prepared-statement-cache-size>50</prepared-statement-cache-size><br />          <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation><br />     </local-tx-datasource><br /></datasources><br />---------------------------------------------------------------------------------<br />import javax.naming.InitialContext; <br />import javax.sql.DataSource; <br />import java.sql.*; <br /><br />       PreparedStatement stmt = null; <br />        Connection conn = null; <br />        ResultSet rs = null; <br />        try { <br />            InitialContext ctx = new InitialContext(); <br />         System.out.println( " # # # # # # got InitialContext  " );<br />         // java:IDP_DS works ok<br />            DataSource ds = (DataSource) ctx.lookup("java:IDP_DS"); <br />           // java:MYDefaultDS does NOT works throws error as mentioned below even if both are valid datasources <br />          // DataSource ds = (DataSource) ctx.lookup("java:MYDefaultDS"); <br />         System.out.println( " # # # # # # got DataSource  " );<br />            conn = ds.getConnection(); <br />         System.out.println( " # # # # # #  Got connection  " );<br />            stmt = conn.prepareStatement("select userid  from TEST_USER where USERID=?"); <br />            stmt.setString(1, patExecContext.getProcessDataStringValue("/process_data/@userid")); <br />            rs = stmt.executeQuery(); <br />         System.out.println( " # # # # # # stmt.executeQuery  done " );<br />         if( rs.next()){<br />                 patExecContext.setProcessDataStringValue("/process_data/output", rs.getString(1)); <br />         }<br />        } finally { <br />            try { <br />                rs.close(); <br />            } catch (Exception rse) {} <br />            try { <br />                stmt.close(); <br />            } catch (Exception sse) {} <br />            try { <br />                conn.close(); <br />            } catch (Exception cse) {} <br />        } <br />---------------------------------------------------------------------------------<br />2009-02-18 14:14:19,136 INFO  [STDOUT]  # # # # # # got InitialContext   <br />2009-02-18 14:14:19,136 INFO  [STDOUT]  # # # # # # got DataSource  <br />2009-02-18 14:14:19,198 WARN  [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.l
        • 1. Re: user defined Datasource issue
          Level 1
          error :
          2009-02-18 14:14:19,198 WARN [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] Adding multiple last resources is disallowed. Current resource is org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@fa5fcf2
          2009-02-18 14:14:19,198 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract java.lang.Object com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterLocal.doRequired(c om.adobe.idp.dsc.transaction.TransactionDefinition,com.adobe.idp.dsc.transaction.Transacti onCallback) throws com.adobe.idp.dsc.DSCException, causedBy:
          java.lang.RuntimeException: Sourced file: inline evaluation of: ``import javax.naming.InitialContext; import javax.sql.DataSource; import java.s . . . '' : Method Invocation ds.getConnection : at Line: 16 : in file: inline evaluation of: ``import javax.naming.InitialContext; import javax.sql.DataSource; import java.s . . . '' : ds .getConnection ( )
          Target exception: org.jboss.util.NestedSQLException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: a9f0675:7cc:499c13bf:c0d4 status: ActionStatus.ABORT_ONLY >); - nested throwable: (org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: a9f0675:7cc:499c13bf:c0d4 status: ActionStatus.ABORT_ONLY >))
          • 2. Re: user defined Datasource issue

            hello

             

            i'm having your same problem with my custom component. Did you find a solution  (or the cause ) to your problem ?

            If so could give me any hint please?

            thank you in advance

             

            stefano