web3j-openapi icon indicating copy to clipboard operation
web3j-openapi copied to clipboard

Cannot initialise deploy parameters field (no delegate- or property-based Creator)

Open rach-id opened this issue 5 years ago • 0 comments

radish34/Registrar : Problem with initializing the address while deploying:

DeployParameters:
data class RegistrarDeployParameters(
  val ERC1820RegistryAddress: String
)
Error:
{
  "title": "Cannot construct instance of `com.gen.app.core.registrar.model.RegistrarDeployParameters` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 2]",
  "responseStatus": 400,
  "requestMethod": "POST",
  "requestUrl": "http://localhost:9090/testApp/contracts/registrar",
  "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"
}
How to make it work ?

Add another field to the data class and everything works fine:

data class RegistrarDeployParameters(
  val ERC1820RegistryAddress: String,
  val something: Int
)

In forums, they say to add default constructor, but that doesn't work as the value being sent in the request gets omitted. Another suggestion is adding the jackson-module-kotlin dependency. However, we already have that.

Edit: The following contracts too: EnumerableMapMock

rach-id avatar Jul 06 '20 15:07 rach-id