Exception in update API call
Hi to everyone,
it's the first time I try Cloudinary and I would to upload an image and get url, using JAVA library.
Unfortunately I receive this Exception:
Exception in thread "main" java.lang.AbstractMethodError: com.cloudinary.strategies.AbstractUploaderStrategy.callApi(Ljava/lang/String;Ljava/util/Map;Ljava/util/Map;Ljava/lang/Object;Lcom/cloudinary/ProgressCallback;)Ljava/util/Map;
at com.cloudinary.Uploader.callApi(Uploader.java:34)
at com.cloudinary.Uploader.upload(Uploader.java:76)
at com.cloudinary.Uploader.upload(Uploader.java:68)
Had someone this issue? How I can resolve it?
Thanks to everyone in advance, Marco.
-
Hi I have the same problem
I follow the start guide so this is what I have done:
Pom file:
Code:
So I'm doing the connection and try to send a sample image to cloud
Error:
java.lang.AbstractMethodError: com.cloudinary.strategies.AbstractUploaderStrategy.callApi(Ljava/lang/String;Ljava/util/Map;Ljava/util/Map;Ljava/lang/Object;Lcom/cloudinary/ProgressCallback;)Ljava/util/Map;
Conclusion with this error I can't get the url but the upload it's allright.
Thanks to everyone in advance, Pedro.
-
Hi Pedro,
I see you are using different versions for taglib and http4 jars. We recommend using the same version for both the dependencies.
<dependency> <groupId>com.cloudinary</groupId> <artifactId>cloudinary-taglib</artifactId> <version>1.17.0</version> </dependency> <dependency> <groupId>com.cloudinary</groupId> <artifactId>cloudinary-http44</artifactId> <version>1.17.0</version> </dependency>
Here is a working upload image example. Please try it and let us know if it's working for you?
import java.io.File; import java.io.IOException; import java.util.Arrays; import java.util.Map; import com.cloudinary.Cloudinary; import com.cloudinary.Transformation; import com.cloudinary.utils.ObjectUtils; public class UploadTest { public static void main(String[] args) throws IOException { Cloudinary cloudinary = new Cloudinary("cloudinary://<apikey>:<secret>@<cloudname>"); File toUpload = new File("/Users/Desktop/sample.jpg"); Map uploadResult = cloudinary.uploader().upload(toUpload, ObjectUtils.emptyMap()); System.out.println("uploadResult: "+uploadResult); } }
Please sign in to leave a comment.
Comments
4 comments