|
|
|
jGofio
|
I have a simple BPEL that uses just one DataBase BC to insert/update records, it purpouse is just testing rollbacks inside a BPEL. The BPEL first make an insertion and after that tries to update a record, then finishes.
I need the BPEL's to rollback the inserted records in my real application if an error occurs, so I make this project to test and I produce an error intentionally in the update sql to see if the inserted record is rollbacked. SCENARIO ---------- GlassFishESB v2.1 DataBase: MySQL 5.1 JDBC lib: mysql-connector-java-5.1.7-bin.jar Pool definition in glasshFish: Datasource Classname: com.mysql.jdbc.jdbc2.optional.MysqlXADataSource Resource Type: javax.sql.XADataSource Database BC: all 'Transation' properties to XATransaction The BPEL has the property atomic = 'true' PROBLEM --------- I execute a test, then the BPEL invokes the DB BC and inserts the record. Then the BPEL invokes the update (I put an error in the sql to make it fail) and fails, BUT THE INSERTED RECORD IS NOT ROLLBACKED and after the BPEL ends is still in the database!! Is there any way to rollback the DB BC operations if something produces an error inside the BPEL?? Any ideas will be appreciated!! Thanks in advance!! BTW, I attach some files of my project, maybe it helps (I can upload full project if necessary): --------------- The BEPEL FILE: --------------- <?xml version="1.0" encoding="UTF-8"?> <process name="textRollBack" targetNamespace="http://enterprise.netbeans.org/bpel/textRollBack/textRollBack" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sxt="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Trace" xmlns:sxed="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Editor" xmlns:sxat="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Attachment" xmlns:sxeh="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/ErrorHandling" xmlns:tns="http://enterprise.netbeans.org/bpel/textRollBack/textRollBack" xmlns:sxed2="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Editor2" xmlns:ns0="http://j2ee.netbeans.org/xsd/tableSchema" xmlns:sxtx="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Transaction" sxtx:atomic="yes"> <import namespace="http://j2ee.netbeans.org/wsdl/textRollBack/textRollBack" location="textRollBack.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> <import namespace="http://j2ee.netbeans.org/wsdl/text" location="text.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> <partnerLinks> <partnerLink name="PartnerLink1" xmlns:tns="http://j2ee.netbeans.org/wsdl/text" partnerLinkType="tns:jdbcpartner" partnerRole="jdbcPortTypeRole"/> <partnerLink name="rollback" xmlns:tns="http://j2ee.netbeans.org/wsdl/textRollBack/textRollBack" partnerLinkType="tns:textRollBack" myRole="textRollBackPortTypeRole"/> </partnerLinks> <variables> <variable name="InsertOut" xmlns:tns="http://j2ee.netbeans.org/wsdl/text" messageType="tns:insertRetMsg"/> <variable name="InsertIn" xmlns:tns="http://j2ee.netbeans.org/wsdl/text" messageType="tns:inputMsg"/> <variable name="TextRollBackOperationOut" xmlns:tns="http://j2ee.netbeans.org/wsdl/textRollBack/textRollBack" messageType="tns:textRollBackOperationResponse"/> <variable name="TextRollBackOperationIn" xmlns:tns="http://j2ee.netbeans.org/wsdl/textRollBack/textRollBack" messageType="tns:textRollBackOperationRequest"/> </variables> <sequence> <receive name="Receive1" createInstance="yes" partnerLink="rollback" operation="textRollBackOperation" xmlns:tns="http://j2ee.netbeans.org/wsdl/textRollBack/textRollBack" portType="tns:textRollBackPortType" variable="TextRollBackOperationIn"/> <assign name="Assign1"> <copy> <from variable="TextRollBackOperationIn" part="id"/> <to>$InsertIn.part/ns0:text_Record/ns0:id</to> </copy> <copy> <from variable="TextRollBackOperationIn" part="dato"/> <to>$InsertIn.part/ns0:text_Record/ns0:texto</to> </copy> <copy> <from variable="TextRollBackOperationIn" part="dato"/> <to variable="TextRollBackOperationOut" part="part1"/> </copy> </assign> <invoke name="Invoke1" partnerLink="PartnerLink1" operation="insert" xmlns:tns="http://j2ee.netbeans.org/wsdl/text" portType="tns:jdbcPortType" inputVariable="InsertIn" outputVariable="InsertOut"/> <invoke name="Invoke2" partnerLink="PartnerLink1" operation="update" xmlns:tns="http://j2ee.netbeans.org/wsdl/text" portType="tns:jdbcPortType" inputVariable="InsertIn"/> <reply name="Reply1" partnerLink="rollback" operation="textRollBackOperation" xmlns:tns="http://j2ee.netbeans.org/wsdl/textRollBack/textRollBack" portType="tns:textRollBackPortType" variable="TextRollBackOperationOut"/> </sequence> </process> -------------- The DB BC File -------------- <?xml version="1.0" encoding="UTF-8"?> <definitions name="text" targetNamespace="http://j2ee.netbeans.org/wsdl/text" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://j2ee.netbeans.org/xsd/tableSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://j2ee.netbeans.org/wsdl/text" xmlns:plink="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:jdbc="http://schemas.sun.com/jbi/wsdl-extensions/jdbc/"> <types> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.sun.com/jbi/wsdl-extensions/jdbc/"> <xsd:import namespace="http://j2ee.netbeans.org/xsd/tableSchema" schemaLocation="text.xsd"/> </xsd:schema> </types> <message name="insertRetMsg"> <part name="part" type="xsd:int"/> </message> <message name="inputMsg"> <part name="part" element="ns:text"/> </message> <message name="outputMsg"> <part name="part" element="ns:text"/> </message> <portType name="jdbcPortType"> <operation name="insert"> <input name="inputInsert" message="tns:inputMsg"/> <output name="outputInsert" message="tns:insertRetMsg"/> </operation> <operation name="update"> <input name="inputUpdate" message="tns:inputMsg"/> </operation> <operation name="delete"> <input name="inputDelete" message="tns:inputMsg"/> </operation> </portType> <binding name="binding" type="tns:jdbcPortType"> <jdbc:binding xmlns:jdbc="http://schemas.sun.com/jbi/wsdl-extensions/jdbc/"/> <operation name="insert"> <jdbc:operation xmlns:jdbc="http://schemas.sun.com/jbi/wsdl-extensions/jdbc/"/> <input name="inputInsert"> <jdbc:input xmlns:jdbc="http://schemas.sun.com/jbi/wsdl-extensions/jdbc/" MarkColumnName="" MoveRowToTableName="" PKName="id" PollMilliSeconds="36000000" TableName="text" Transaction="XATransaction" numberOfRecords="" operationType="insert" paramOrder="id,texto" sql="insert into text (id,texto) values (?,?)"/> </input> <output name="outputInsert"> <jdbc:output xmlns:jdbc="http://schemas.sun.com/jbi/wsdl-extensions/jdbc/" returnPartName="part"/> </output> </operation> <operation name="update"> <jdbc:operation xmlns:jdbc="http://schemas.sun.com/jbi/wsdl-extensions/jdbc/"/> <input name="inputUpdate"> <jdbc:input xmlns:jdbc="http://schemas.sun.com/jbi/wsdl-extensions/jdbc/" MarkColumnName="" MarkColumnValue="" MoveRowToTableName="" PKName="id" PollMilliSeconds="36000000" TableName="text" Transaction="XATransaction" numberOfRecords="" operationType="update" paramOrder="id,texto" sql="update text set id = ?,texto2 = ?"/> </input> </operation> <operation name="delete"> <jdbc:operation xmlns:jdbc="http://schemas.sun.com/jbi/wsdl-extensions/jdbc/"/> <input name="inputDelete"> <jdbc:input xmlns:jdbc="http://schemas.sun.com/jbi/wsdl-extensions/jdbc/" MarkColumnName="" MarkColumnValue="" MoveRowToTableName="" PKName="id" PollMilliSeconds="36000000" TableName="text" Transaction="XATransaction" numberOfRecords="" operationType="delete" paramOrder="" sql="delete from text"/> </input> </operation> </binding> <service name="service"> <port name="port" binding="tns:binding"> <jdbc:address xmlns:jdbc="http://schemas.sun.com/jbi/wsdl-extensions/jdbc/" jndiName="jdbc/snacks"/> </port> </service> <plink:partnerLinkType xmlns:plink="http://docs.oasis-open.org/wsbpel/2.0/plnktype" name="jdbcpartner"> <plink:role name="jdbcPortTypeRole" portType="tns:jdbcPortType"/> </plink:partnerLinkType> </definitions> -------------- TABLE in MySql -------------- CREATE TABLE `text` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `texto` varchar(45) NOT NULL, PRIMARY KEY (`id`) ) |
||||||||||||||||
|
jGofio
|
Hi,
No body has this problem?? I'm using jdk1.6.0_14 I had attached this image (the BPEL), maybe it can help: ![]()
|
||||||||||||||||
|
anoseda
|
In reply to this post
by jGofio
Same thing here, with Oracle database.
Since september, have you found something, or have you gone the compensation way, adding a delete to your bpel ?
|
||||
|
jGofio
|
Hi anoseda,
Welcome to the club :( I'm sorry, but we have still no answer. There are also other threads with the same problem without solution. It is a pity, but such a simple and important scenario is still a mistery... no tutorial, no examples, no answer from the expert in the community... you have to compensate 'by hand' or use other tool where the transactions are clear.
|
||||||||||||||||
|
shivam
|
In reply to this post
by anoseda
Hi Anoseda,
What version of oracle u tried with? It is working with Oracle 10 g with some exceptions. Also go thru this post http://n2.nabble.com/Transaction-rollback-td3736777.html#a3736777
|
||||||||||||||||
|
anoseda
|
Some javascript/style in this post has been disabled (why?)
I'm using Oracle 9i. I was not aware of the unatomic proxy solution. I will try this today. Thanks for the link. |
|||||||||||||||
|
alexndr
|
In reply to this post
by jGofio
Are you aware of the fact that BPEL does not start an XA-transaction itself? How do you hand the message to the BPEL? Try using a JMS queue to get an XA transaction to work with..
/A |
||||||||||||||||
|
fozon
|
In reply to this post
by jGofio
Hello everybody,
I am facing the same problem. I created an "atomic" BPEL that performs two inserts in a database. It inserts twice the same value for the key. The second time the database engine raises an exception so the first insertion should be undone. But instead, the result is that the first insertion keeps in the database. If I consult the table in the database through an external program after performing the first insertion, the data is already there. It doesn't wait until the transaction ends. I am using postgreSQL 8.4. I attach my test project. The structure is as follows: There is a trigger BPEL with "atomic=no" that calls twice to a second BPEL. The second BPEL has the "atomic=yes" property and calls twice to a insert operation in the data base. The test case inserts the values 1,2,3 and 3 for the key in the data base, so the fourth time it should fail and roll back the rest of the insertions, but it doesn't. I hope you can help me and give me advise if you have solved the problem. ![]() ![]() The table structure in the database is the following one: -- Table: t_1 -- DROP TABLE t_1; CREATE TABLE t_1 ( t_1_index character varying NOT NULL, data character varying, CONSTRAINT t_1_pk PRIMARY KEY (t_1_index) ) WITH ( OIDS=FALSE ); ALTER TABLE t_1 OWNER TO postgres; I attach the project so that you can test it. transactionalPostgreSQL_example_18-11-2009.zip I would appreciate any help. Thanks, Gabriel
|
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |