I need several nodes to build one transaction. To achieve that I create a TransactionBuilder and pass it to nodes that then add their states to it.
This seems to be a legit practice since the official documentation mentions [TransactionBuilder] is intended to be passed around contracts that may edit it by adding new states/commands.
However when running a unit test the network throws this exception:
Class class net.corda.core.transactions.TransactionBuilder is not on the whitelist or annotated with #CordaSerializable.
java.io.NotSerializableException: Class class net.corda.core.transactions.TransactionBuilder is not on the whitelist or annotated with #CordaSerializable.
I tried white-listing TransactionBuilder, but the it threw this:
net.corda.core.transactions.TransactionBuilder -> outputs(java.util.List<net.corda.core.contracts.TransactionState<net.corda.core.contracts.ContractState>>) -> java.util.List<net.corda.core.contracts.TransactionState<net.corda.core.contracts.ContractState>> -> net.corda.core.contracts.TransactionState<net.corda.core.contracts.ContractState> -> data(net.corda.core.contracts.ContractState) -> state(com.luxoft.poc.mobi.data.state.TransportAgreement$State) -> Class class com.luxoft.poc.mobi.data.state.TransportAgreement$State is not on the whitelist or annotated with #CordaSerializable.
java.io.NotSerializableException: net.corda.core.transactions.TransactionBuilder -> outputs(java.util.List<net.corda.core.contracts.TransactionState<net.corda.core.contracts.ContractState>>) -> java.util.List<net.corda.core.contracts.TransactionState<net.corda.core.contracts.ContractState>> -> net.corda.core.contracts.TransactionState<net.corda.core.contracts.ContractState> -> data(net.corda.core.contracts.ContractState) -> state(com.luxoft.poc.mobi.data.state.TransportAgreement$State) -> Class class com.luxoft.poc.mobi.data.state.TransportAgreement$State is not on the whitelist or annotated with #CordaSerializable.
What am I doing wrong? How do I work around it?
We use Corda 3.3
Based on the error message, you also need to add TransportAgreement.State to the whitelist, as you are sending it as part of the transaction builder.
Related
I am having this error when I am calling my custom flow through my RPCClient.
#PostMapping(value="/flows/issue")
private fun issuance(#RequestBody note : Money){
val matchingParties = proxy.partiesFromName(note.owner, false)
if(matchingParties.size != 1)
throw IllegalArgumentException("Enter a valid Party name")
val recipient = matchingParties.single()
proxy.startFlow(::IssueMoney, note.currency, note.amount, recipient)
}
My custom flow is another class with the classpath net.corda.server.flows . I have annotated it as #CordaSerializable and added the "-parameters" in the java compiler.
The error at the console at my node was
Serialization failed direction="Deserialize", type="java.lang.Class", msg="Could not instantiate net.corda.server.flows.IssueMoney - not on the classpath", corda ClassChain="java.util.List<*> -> net.corda.server.flows.IssueMoney"
The error at my webserver was
java.io.NotSerializableException: net.corda.server.flows.IssueMoney was not found by the node, check the Node containing the CorDapp that implements net.corda.server.flows.IssueMoney is loaded and on the Classpath
CordaSerializable is an annotation that you put on a class that gets sent/received by your flow; for instance you have some custom class MyClass that your initiator sends to the responder; you mark MyClass with #CordaSerializable; this way when your initiator calls send, it gets checkpointed (i.e. all its data is written to disk), part of that data is your MyClass which with that annotation allows Corda to serialize it (when flow is checkpointed) and deserialize (when the flows resumes). So in summary, remove the annotation from the flow.
I assume that the error happened because somewhere in your flow you're using java.util.List (that's what shows in your error message); List is an interface, so Corda won't know how to serialize/deserialize it, instead you have to use an implementation of the List interface like ArrayList or LinkedList.
hi i installed the KnpPaginatorBundle in py project and i flow all the steps in the documentation, the problem is when i open the page i got this exception :
RuntimeException in CheckDefinitionValidityPass.php line 63: The
definition for "knp_paginator" has no class. If you intend to inject
this service dynamically at runtime, please mark it as synthetic=true.
If this is an abstract definition solely used by child definitions,
please add abstract=true, otherwise specify a class to get rid of this
error.
Using Unity, I am trying to register the following interface to a model:
public interface IGenericRepository<T> : IDisposable where T : class
Is this the correct way to register this within Unity's Bootstrapper?
container.RegisterType<IGenericRepository<TypeBasedOverride>, GenericRepository<TypeBasedOverride>>(new HierarchicalLifetimeManager());
I think you want to register that interface for any concrete T.
If so, you need to register the generic types as open generic types (without the type arguments). Check this msdn entry.
In your example:
container.RegisterType(typeof(IGenericRepository<>), typeof(GenericRepository<>), new HierarchicalLifetimeManager());
This way when you request an instance of IGenericRepository<SomeClass>, Unity will provide you with an instance of GenericRepository<SomeClass>, no matter the concrete type of SomeClass.
I am trying to understand how Infolog works within Dynamics AX. I understand that the following code will display the text in the infolog window.
info("Hello World!");
I am aware that info is a static method on the Global class and therefore the method can be called by simply calling the name without actually specifying Global::
While looking into the method info in class Global, I noticed that it invokes infolog.add. Right-clicking on add and selecting the option Lookup Definition takes me to the method add in the class Info.
If the class in which the method add exists is named as Info, how is it being called from within Global::info() with the name Infolog?
The only logical conclusion that I can arrive at is that Infolog is an alias for the class Info. If that is correct, where is this alias defined in the AOT (Application Object Tree)?
I searched the AOT but found multiple references to the term Infolog but I couldn't find anything that would directly relate to an Application or System class.
The response to the same question I posted on Microsoft Dynamics communities forum helped me to understand the code better.
Is Infolog an alias to the class Info? - Response on Microsoft Dynamics Community forum
Below shown code is from the static method Global::info(). I failed to notice that call to method add using the object infolog is actually an instance method and not static.
client server static Exception info(
SysInfoLogStr txt,
URL helpUrl = '',
SysInfoAction _sysInfoAction = null)
{
return infolog.add(Exception::Info,
getPrefix()+txt,
helpUrl,
_sysInfoAction, false);
}
In other words, infolog is an instance of class Info. After looking into the class Info, I found the startup method. I kept a breakpoint to debug the code and found that this method is called whenever the AX client is opened. This method in turn calls another method named initBrowser. Within the initBrowser, the following code seems to initialize the global instance of Infolog using a windows handle.
this.initializeInfolog(this.browser().hWnd());
The above menthod initializeInfolog exists in the System class xInfo, which is the parent class of Info. Since I cannot look into the class xInfo, I assume that this is where the instance of class Info with the name infolog is being created.
I don't think it's an alias. I think it's a global variable defined in the kernel level.
Edit: You answered your question while I was answer it...
I've got a problem with type coercion in a Java/Hibernate/BlazeDS/Flex-Setup.
First of all, my classes look like this:
--- JAVA ---
Interface I
(Abstract) Class A implements I
Class B extends A
--- ActionScript ---
Interface I
Class A implements I
Class B extends A
I got RemoteClass-Meta-Tags in all ActionScript-Classes/Interfaces I, A and B. Package structure and Class/Interface names are exactly the same.
Now here's the problem:
My Java Service successfully retrieves objects of class B from my database via Hibernate. I got another class C which has a member property of interface type I, so it should be possible to assign an object of type B. But for some reason i get the following error message:
TypeError: Error #1034: cannot convert Object#28b44a89 to package.name.I
I checked the Java object type in the service and it is of type B and seems to be totally fine. Why can't the object of type B be assigned to a member variable of type I? This is driving me nuts.
Thanks in advance.
Check the type the objects returned by the service call (inspect the result with a debugger in Flash Builder). Maybe they are not properly converted to type B and an ObjectProxy is created. If it's not the case, please post your code.
I got same strange issue.
My situation like this:
I develop an web application with Flex 4 + Spring
In Java, I have class Message.
In Flex, I have class Message.
When getting remote java object from server and cast to Message type in Flex, this error will occur. The strange thing is that, on the first time, it's OK to cast to Message type in Flex from remote java object and there's no error; but in the second time, it fail and error will be shown.
To solve this, I have one solution: using registerClassAlias() method to register for remote java class.
But I wonder if there's other solution for this issue. Is this a bug of Flex?