cancel
Showing results for 
Search instead for 
Did you mean: 

JTA Prepared Statement not working

Former Member
0 Kudos

Hi,

I have a Problem with the MII JTA Custom Actions and wonder if anyone can point me to the right direction. I am working on an MII 12.1.6. System and the "basic" JTA actions blocks ("JTA Basic Query", "JTA Command") are working.

Now I want to use a prepared statement. I used this document http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/900ca908-078e-2b10-5d94-9c6e38e95... and created an even simpler version for my test.

If I execute it, I get the following output:

  • [ERROR] [JTA_Execute_Prepared_Stmt_0]Error invoking Transaction Execute Prepared Statement action: JTAExecutePreparedStatement - while trying to invoke the method com.sap.mii.custom.actions.jta.JTAAccompaniamentData.mustRollback() of an object loaded from field com.sap.mii.custom.actions.jta.JTAPrepCmdAccompData.startAccompData of an object loaded from local variable 'this'
  • [ERROR] Error found trying to execute action 'JTA_Execute_Prepared_Stmt_0' Exception: [Error invoking Transaction Execute Prepared Statement action: JTAExecutePreparedStatement - while trying to invoke the method com.sap.mii.custom.actions.jta.JTAAccompaniamentData.mustRollback() of an object loaded from field com.sap.mii.custom.actions.jta.JTAPrepCmdAccompData.startAccompData of an object loaded from local variable 'this']
  • [ERROR] [JTA_Execute_Prepared_Stmt_0] Action: Runtime threw an exception. Exception: [java.lang.Exception: Error invoking Transaction Execute Prepared Statement action: JTAExecutePreparedStatement - while trying to invoke the method com.sap.mii.custom.actions.jta.JTAAccompaniamentData.mustRollback() of an object loaded from field com.sap.mii.custom.actions.jta.JTAPrepCmdAccompData.startAccompData of an object loaded from local variable 'this']
  • [INFO] Statistics [Load = 31 ms msec, Parse = 47 ms, Execution = 15 ms, Total = 78 ms]

In the NetWeaver log:

I already tried:

- defining the list as a local property and linking it directly instead of using the append(emptylist...) --> same error

- use the JTA Batch statement instead --> same error

Every help is greatly appreciated.

Thanks and best regards,

Gernot

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The problem was solved by deploying a new version of the custom action provided by Salvatore Castro.

Thanks for your help!

Answers (1)

Answers (1)

0 Kudos

Gernot,

Send me an email it's just my [Removed by Moderator] and I will send you the updated version of the actions.

The reason why this version of the JTA actions breaks is due to a change in the interface to the Security API for retrieving the credentials from the credential store of MII.  There are other minor changes and adjustments to the updated version and I should point out that this functionality has been rolled into standard product as of the MII 14.0 release.


Sam

Former Member
0 Kudos

Hi Salvatore,

thanks again for the updated custom action JAR. Unfortunately, it did not solve my problem. If I execute my simple test transaction in the workbench, then I get the exact same error messages as described in my initial posting. The only difference I noticed is that with the new version, no error messages are written to the NetWeaver log. I only get an error some minutes later about a transaction time out.

I would greatly appreciate if you (or of course anyone else reading this thread) has some idea about what I could do to get this functionality up and running.

Thanks and best regards,

Gernot

0 Kudos

Gernot,

Which database are you using and does the insert command work using the standard query template interface?  I just created the same scenario locally and it works without issue against my database.

Also...

  1. What do you have linked into the JTA_Start action?
  2. If you add in the "Catch" action block with a rollback and "Terminate Transaction" action (with the catch message linked to the termination message) does this change the error in the logs?

Regards,

Sam

PS: The Commit/Rollback functionality was added to the standard MII 14.0 release and the SQL actions already use store procedures when you are using the "Typed" query parameters.

Former Member
0 Kudos

Hi Sam,

I am using an MS SQL Server 2008 database.

The insert works with the standard actions as well as with the JTA Command action. I also tried the Prepared Statement action with a simple update query (without the questionmarks): this also works (which is an improvement to the old JTA Version where this did not work).

But as soon as I add an questionmark into the prepared Statement and link the value list to the Execute Prepared Statement action, the error is thrown.

In the JTA_Start action I only linked the "DataSourceNames" to a list with my datasource.

Unfortunately, I cannot add a Catch action block, because it is not available on my system. As far as I now the Catch action was introduced in version 12.2, but this system is running on 12.1.

Thanks and best regards,

Gernot

0 Kudos

Ok, thanks...what happens if you set "Trace" equal to true in the JTA Start and also the JTA Prep Stmt actions?  You will get much more granular logs in the Workbench execution logger and also in the NetWeaver when you test this transaction.

Sam

Message was edited by: Salvatore Castro

Former Member
0 Kudos

Hi Sam,

thanks for your help. I set the trace options, but unfortunately the output did not change (workbench and NW log). Do I have to change the log level also somewhere globally for it to take effect?

Best regards,

Gernot

0 Kudos

If you run the transaction from the workbench using Ctrl + F5 you should see a lot of details in the Execution Log.  Can you copy and paste the results into your next post?

Thanks,
Sam

PS: You can also run the transaction via Runner with the &LogType=Advanced parameter set and it will give you the XML version of the execution trace log.

Former Member
0 Kudos

Hello Sam,

thanks for the help and for the hint with the Runner; it may come in handy.

Here is the requested output. I only want to set one field, so the "Values Length: 1" seems correct to me:

  • [INFO] Started Execution: '10/23/2013 12:09:38'
  • [DEBUG] [Sequence]: Started sequence execution
  • [DEBUG] [JTA_Start_0]: Started action execution
  • [DEBUG] Action parameter creating time [ <1 ms]
  • [DEBUG] Entering action 'JTA_Start_0' implementation.
  • [INFO] [JTA_Start_0]JNDI DataSource Names: [[string:jta_xpi]]
  • [INFO] [JTA_Start_0]Transaction Name: JTA_Start_0
  • [INFO] [JTA_Start_0]Number of Connections: 1
  • [INFO] [JTA_Start_0]Conn[0]: jta_xpi looked for jdbc/jta_xpi
  • [INFO] [JTA_Start_0]Is Connection null: false
  • [INFO] [JTA_Start_0]Class type: class com.sap.engine.services.dbpool.cci.ConnectionFactoryImpl
  • [INFO] [JTA_Start_0]Transaction Codes - NONE: 0 READ_COMM: 2 READ_UNCOMM: 1 REPEAT_READ: 4 SERIALIZABLE: 8
  • [INFO] [JTA_Start_0]Transaction Isolation: 2
  • [DEBUG] Exiting action 'JTA_Start_0' implementation
  • [DEBUG] [JTA_Start_0]: Finished[ <1 ms] Succeeded: true
  • [DEBUG] [Sequence_0]: Started sequence execution
  • [DEBUG] [JTA_Create_Prepared_Stmt_0]: Started action execution
  • [DEBUG] Action parameter creating time [ <1 ms]
  • [DEBUG] Entering action 'JTA_Create_Prepared_Stmt_0' implementation.
  • [INFO] [JTA_Start_0]Connection: jta_xpi Prepared Commmand: INSERT INTO JTA(name) VALUES(?)
  • [INFO] [JTA_Start_0]Connection Table: {jta_xpi=com.sap.engine.services.dbpool.cci.DirectConnectionHandle@6fa6fb05}
  • [INFO] [JTA_Start_0]Get connection for command - false
  • [DEBUG] Exiting action 'JTA_Create_Prepared_Stmt_0' implementation
  • [DEBUG] [JTA_Create_Prepared_Stmt_0]: Finished[ <1 ms] Succeeded: true
  • [DEBUG] [Sequence_1]: Started sequence execution
  • [DEBUG] [JTA_Execute_Prepared_Stmt_0]: Started action execution
  • [DEBUG] Action parameter creating time [ <1 ms]
  • [DEBUG] Entering action 'JTA_Execute_Prepared_Stmt_0' implementation.
  • [INFO] [JTA_Create_Prepared_Stmt_0]Values Length: 1
  • [ERROR] [JTA_Execute_Prepared_Stmt_0]Error invoking Transaction Execute Prepared Statement action: JTAExecutePreparedStatement - while trying to invoke the method com.sap.mii.custom.actions.jta.JTAAccompaniamentData.mustRollback() of an object loaded from field com.sap.mii.custom.actions.jta.JTAPrepCmdAccompData.startAccompData of an object loaded from local variable 'this'
  • [DEBUG] Exiting action 'JTA_Execute_Prepared_Stmt_0' implementation
  • [ERROR] Error found trying to execute action 'JTA_Execute_Prepared_Stmt_0' Exception: [Error invoking Transaction Execute Prepared Statement action: JTAExecutePreparedStatement - while trying to invoke the method com.sap.mii.custom.actions.jta.JTAAccompaniamentData.mustRollback() of an object loaded from field com.sap.mii.custom.actions.jta.JTAPrepCmdAccompData.startAccompData of an object loaded from local variable 'this']
  • [WARN] [JTA_Execute_Prepared_Stmt_0] Skipping execution of output links due to action failure.
  • [ERROR] [JTA_Execute_Prepared_Stmt_0] Action: Runtime threw an exception. Exception: [java.lang.Exception: Error invoking Transaction Execute Prepared Statement action: JTAExecutePreparedStatement - while trying to invoke the method com.sap.mii.custom.actions.jta.JTAAccompaniamentData.mustRollback() of an object loaded from field com.sap.mii.custom.actions.jta.JTAPrepCmdAccompData.startAccompData of an object loaded from local variable 'this']
  • [DEBUG] [JTA_Execute_Prepared_Stmt_0]: Finished[ <1 ms] Succeeded: false
  • [DEBUG] [Sequence_2]: Started sequence execution
  • [DEBUG] [JTA_Commit_0]: Started action execution
  • [DEBUG] Action parameter creating time [ <1 ms]
  • [DEBUG] Entering action 'JTA_Commit_0' implementation.
  • [INFO] [JTA_Start_0]Committing connection - jta_xpi
  • [DEBUG] Exiting action 'JTA_Commit_0' implementation
  • [DEBUG] [JTA_Commit_0]: Finished[ <1 ms] Succeeded: true
  • [DEBUG] [Sequence_3]: Started sequence execution
  • [DEBUG] [JTA_End_0]: Started action execution
  • [DEBUG] Action parameter creating time [ <1 ms]
  • [DEBUG] Entering action 'JTA_End_0' implementation.
  • [INFO] [JTA_Start_0]Rolling back connection - jta_xpi
  • [INFO] [JTA_Start_0]Closing connection - jta_xpi
  • [DEBUG] Exiting action 'JTA_End_0' implementation
  • [DEBUG] [JTA_End_0]: Finished[ <1 ms] Succeeded: true
  • [DEBUG] [Sequence_3]: Finished[ <1 ms]
  • [DEBUG] [Sequence_2]: Finished[ <1 MS]
  • [DEBUG] [Sequence_1]: Finished[ <1 ms]
  • [DEBUG] [Sequence_0]: Finished[ <1 ms]
  • [DEBUG] [Sequence]: Finished[ <1 ms]
  • [INFO] Transaction Completed '10/23/2013 12:09:38'
  • [INFO] Statistics [Load = 31 ms msec, Parse = 15 ms, Execution =  <1 ms, Total = 47 ms]

Best regards,

Gernot

0 Kudos

Are you using JDBC 1.0 or 2.0 in your JDBC Datasource...in short can you post your configuration so that I can replicate your settings and test locally?

Thanks,
Sam