编程语言
首页 > 编程语言> > cloudinary java无法上传图片

cloudinary java无法上传图片

作者:互联网

我的代码在下面.我尝试通过java将图像上传到cloudinary而不上传它显示以下错误

Exception in thread “main” java.lang.UnknownError: Can’t find
Cloudinary platform adapter
[com.cloudinary.android.UploaderStrategy,com.cloudinary.http42.UploaderStrategy,com.cloudinary.http43.UploaderStrategy]
at com.cloudinary.Cloudinary.loadStrategies(Cloudinary.java:76) at
com.cloudinary.Cloudinary.(Cloudinary.java:91) at
ImageUpload.main(ImageUpload.java:16)

我的代码如下

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import com.cloudinary.Cloudinary;
import com.cloudinary.utils.ObjectUtils;

public class ImageUpload {
    public static void main(String arg[])throws Exception{

        Map config = ObjectUtils.asMap(
                  "cloud_name", "dq8rshzka",
                  "api_key", "484362882976754",
                  "api_secret", "1zwPe6-VfVjj3rueX6zSsfyNyro");
                Cloudinary cloudinary = new Cloudinary(config);
                Map result = cloudinary.api().resource("sample", ObjectUtils.emptyMap());
    }

}

解决方法:

请打开支持票,Cloudinary的支持团队将很乐意为您提供帮助.无论如何,请注意,您的帐户的api_secret绝不应透露.您应该转到帐户的设置页面,并生成一对新的api密钥和密钥.

标签:java,cloudinary
来源: https://codeday.me/bug/20190528/1169072.html