Corda 4.0 transaction serialization issue - corda

Having recently upgraded to Corda 4.0 we are now seeing a serialization exception when trying to create transactions:
[ERROR] 10:09:49,500 [Mock network] amqp.SerializationOutput. -
Serialization failed direction="Serialize",
type="net.corda.core.transactions.TraversableTransaction",
msg="Defined getter for parameter commands returns type
java.util.List> yet underlying
type is java.util.List>",
ClassChain="net.corda.core.transactions.TraversableTransaction"
{actor_id=Only For Testing, actor_owning_identity=O=Supplier 1,
L=London, C=GB, actor_store_id=TEST, fiber-id=10000001,
flow-id=e61b7da7-6826-4410-9414-1c03bebbc3fe,
invocation_id=58c5f5ff-09f8-4bfa-bbe5-cf6b0ef47d06,
invocation_timestamp=2019-03-28T10:09:46.205Z, origin=Only For
Testing, session_id=58c5f5ff-09f8-4bfa-bbe5-cf6b0ef47d06,
session_timestamp=2019-03-28T10:09:46.205Z, thread-id=400}
Any ideas what causes this?

Anytime you see an error message of this form on Corda 4:
Defined getter for parameter [parameter name] returns type [type] yet
underlying type is [exactly the same type]
It's caused by a bug in certain versions of Guava.
Corda 4 uses Guava version 25.1-jre. However, if your node loads another version of Guava (e.g. 21.0) that overrides Corda's version of Java, you will see this error.
A fix is planned for Corda 4.1.

I faced this issue as well after upgrade to 4.0. My flows returned transaction as output and I've got TraversableTransaction serialization exception. I didn't solved it. I've created flow response DTO with all appropriated data, trxId etc...
Example:
SignedTransaction signedTransaction = subFlow(new FinalityFlow(signedTx, session));
response.setTrxId(signedTransaction.getId().toString());
return response;

Related

setAckOnError() method for Spring kafka 2.7.8

while upgrading our spring kafka to 2.7.8, we are getting error in the setAckOnError(false) method as it has been deprecated now. Is there any way now to set the acknowledgement for the errors to false? Any other methods that can help me to set it as false for errors acknowledgement?
P.S: I am new to Kafka, any help appreciated!
That property was found to have a (very small) timing hole in that a record could be ack'd before the error handler handles it; if the app dies at that time, the record could be "lost".
It was replaced by a new feature in the error handlers ackAfterHandle; which is true by default - i.e. the record's offset is only committed if the error handler "handles" the error.
Records are now never ack'd if the error handler (such as the SeekToCurrentErrorHandler) throws an exception (after it repositions the partitions).
There is no extra configuration needed any more.
See Spring Kafka AckOnError for more details.

How to offset spring kafka to next in error handler?

I am using spring data 1.5.8 and manual ack mode of kafka. There is only a simple ErrorHandler interface, the handle method has parameter exception and consumerRecord, but how can I set the offset to next if exception threw when json can not be deserialized? I need omit the message or else the consumer will stuck there
spring data 2.0 introduce ConsumerAwareErrorHandler, the only way is update spring version?
Yes. You need to upgrade. The current version is 2 4.0 or 2.3.4.

Method not found in tokens selection module

Corda: OS 4.3-RC01
Tokens: 1.1-RC01
Accounts: 1.0-RC-04
I have the following scenario:
1. Create AccountInfo using CreateAccount flow.
2. Request new key using RequestKeyFlow.
3. Wrap the key with AnonymousParty.
4. Create EvolvableTokenType.
5. Issue a certain amount of that token to a node.
6. Move the amount from the node to the account (which is hosted on a different node).
When I run the flow test for step #6, I get the following error:
java.lang.NoSuchMethodError: com.r3.corda.lib.tokens.selection.database.selector.DatabaseTokenSelection.generateMove(Ljava/util/UUID;Ljava/util/List;Lnet/corda/core/identity/AbstractParty;Lcom/r3/corda/lib/tokens/selection/TokenQueryBy;)Lkotlin/Pair;
at com.r3.corda.lib.tokens.workflows.flows.move.MoveTokensUtilitiesKt.addMoveFungibleTokens(MoveTokensUtilities.kt:102) ~[tokens-workflows-1.1-RC01.jar:?]
I've added this to my MockNetwork:
TestCordapp.findCordapp("com.r3.corda.lib.tokens.selection")
And inside my flow (that calls MoveFungibleToken flow):
PartyAndAmount partyAndAmount = new PartyAndAmount(newKey, amount);
SignedTransaction moveTx = subFlow(new MoveFungibleTokens(Collections.singletonList(partyAndAmount)));
Verify token SDK dependencies in your modules refer to the same version. If they do, try clearing your gradle cache. If i'm not mistaken, RC versions do not guarantee reproducible builds, i.e. multiple releases might be using the same version (think snapshots)
Issue has been resolved after clearing Gradle cash.

Corda 4 client rpc LinearStateQueryCriteria serialization problem

Trying to invoke:
QueryCriteria linearStateCriteria = new QueryCriteria.LinearStateQueryCriteria(null,null,Arrays.asList(externalId),Vault.StateStatus.UNCONSUMED);
connection.getProxy().vaultQueryByCriteria(linearStateCriteria,SomeState.class);
getting exception:
Serialization failed direction="Serialize", type="net.corda.core.node.services.vault.QueryCriteria$LinearStateQueryCriteria", msg="Defined getter for parameter contractStateTypes returns type java.util.Set<java.lang.Class<? extends net.corda.core.contracts.ContractState>> yet underlying type is java.util.Set<java.lang.Class<? extends net.corda.core.contracts.ContractState>>", ClassChain="java.util.List<*> -> net.corda.core.node.services.vault.QueryCriteria$LinearStateQueryCriteria"
Looks like bug in serialization in client rpc. If somebody faced this issue or this is a known bug please advice.
Thanks.
As mention in this question: Corda 4.0 transaction serialization issue
It is not necessarily a serialization issue, rather it is the java.util.Set class not get properly picked up.
It's caused by a bug in certain versions of Guava. As stated in the other question, it is fixed by the later releases.

Using Standard WF activities to access a web service - how to set 'expected namespace'?

I am attempting to connect to a .Net 1.0 web service using standard activities in WF 4.0.
I am using the SendandReceiveReplyFactory - the send portion seems to be working - however the ReceiveReplyForSend is for some reason expecting a tempuri.org namespace response rather than the www.thermo.com/informatics/xmlns/limswebservice namespace.
Could anyone instruct me on how I can cause the activity to expect the correct NS.
Thanks in advance for your help.
All the best,
DJ
Error Message:
Workflow Console: Starting Workflow... Send Done Workflow
3fdc4d67-dcac-4092-b34b-9c347acdfe22 Terminated. Exception:
System.ServiceModel.CommunicationException Error in deserializing body
of reply message for operation 'Process'. OperationFormatter
encountered an invalid Message body. Expected to find node type
'Element' with name 'ProcessResponse' and namespace
'http://tempuri.org/'. Found node type 'Element' with name
'ProcessResponse' and namespace
'http://www.thermo.com/informatics/xmlns/limswebservice' Workflow
Console: Workflow Completed
The answer is to specify the namespace in the ServiceContractName Property of the 'Send' Activity using the following syntax '{http://someserver.org/test/}FileService ' in my case '{http://www.thermo.com/informatics/xmlns/limswebservice}LIMSSoap' . The syntax was sensitive to the trailing slash so a little trial and error was needed.
Many thanks to the contributors to WF4 - How to consume external web service? for the answer.

Resources