Search code examples
javaapionedrivecloudrail

Error when uploading file to OneDrive using Cloudrail


I tried following this CloudRail sample.

Here is my code:

OneDrive client = new OneDrive(new LocalReceiver(8082), CLIENT_ID, CLIENT_SECRET, REDIRECT_URI, ""); 
//I'm not sure about the parameter 'state' so I left an empty string here
//The REDIRECT_URI is "https://login.live.com/oauth20_desktop.srf"
InputStream inputStream = new FileInputStream(fileToUpload);
client.upload(fileToUpload.getPath(), inputStream, fileToUpload.length(), false);

I got this error:

java.lang.ClassNotFoundException: com.mashape.unirest.request.HttpRequestWithBody

at the first line.

Please help.


Solution

  • When you integrate the plain .jar file from Github you need to also include the unirest library since it is required within CloudRail SDK. You can download it here: https://github.com/Mashape/unirest-java