I'm very new to Uploadcare. I am trying to retrieve a file UUID from Uploadcare, then use that UUID to copy the image to my S3 storage bucket. I am using the Uploadcare API available on git-hub:here.
The code is super easy to implement. Here's what I have:
package javaapplication2;
import com.uploadcare.api.Client;
import com.uploadcare.data.CopyFileData;
public class UploadAPITest {
public static void main(String[] args) {
Client client = new Client("mypublicKey", "myprivateKey");
CopyFileData copyFile = client.copyFile("d5e97aca-f6d9-47ea-8c76-1fe36d093b2d", "messagePicUploadCenter");
System.out.println("result: " + copyFile.result);
}
This code compiles with no problem. Yet when I run it, this is the error I see:
enterException in thread "main"
com.uploadcare.exceptions.UploadcareNetworkException: Network failure!
at com.uploadcare.api.RequestHelper.executeQuery(RequestHelper.java:108)
at com.uploadcare.api.Client.copyFile(Client.java:221)
at javaapplication2.UploadAPITest.main(UploadAPITest.java:25)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [simple type, class com.uploadcare.data.FileData] from String value; no single-String constructor/factory method (through reference chain: com.uploadcare.data.CopyFileData["result"])
at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator._createFromStringFallbacks(StdValueInstantiator.java:422)
at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromString(StdValueInstantiator.java:298)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromString(BeanDeserializer.java:424)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:129)
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:375)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:107)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:308)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:121)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2796)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1942)
at com.uploadcare.api.RequestHelper.executeQuery(RequestHelper.java:106)
... 2 more
Java Result: 1
Has anyone else had this issue, or have some advice for me? I would really appreciate it. I love this service, and I think the issue has more to do with the com.faster.jackson.databind library. Here's a picture of the libraries I'm using in this simple project: http://ift.tt/1ASHxHF
Aucun commentaire:
Enregistrer un commentaire