amazon web services - Unable to load AWS Ivona Properties File Java -


i'm using ivona speachcloud sdk (create speech sample): https://github.com/ivonasoftware/ivona-speechcloud-sdk-java/blob/master/src/samples/ivonaspeechcloudcreatespeech/sampleivonaspeechcloudcreatespeech.java

using code setting class path

private static ivonaspeechcloudclient speechcloud;  private static void init() {     speechcloud = new ivonaspeechcloudclient(             new classpathpropertiesfilecredentialsprovider("ivonacredentials.properties"));     speechcloud.setendpoint("https://tts.eu-west-1.ivonacloud.com"); } 

below format ivona.properties file. file located in base directory. required credentials i've got in speechcloud account

accesskey = mykey  secretkey = mysecretkey 

below exception getting

exception in thread "main" com.amazonaws.amazonclientexception: unable load aws credentials /resources/ivona.properties file on classpath @ com.amazonaws.auth.classpathpropertiesfilecredentialsprovider.getcredentials(classpathpropertiesfilecredentialsprovider.java:81) @ com.ivona.services.tts.ivonaspeechcloudclient.preparerequest(ivonaspeechcloudclient.java:279) @ com.ivona.services.tts.ivonaspeechcloudclient.preparerequest(ivonaspeechcloudclient.java:272) @ com.ivona.services.tts.ivonaspeechcloudclient.invoke(ivonaspeechcloudclient.java:259) @ com.ivona.services.tts.ivonaspeechcloudclient.createspeech(ivonaspeechcloudclient.java:148) @ sampleivonaspeechcloudcreatespeech.main(sampleivonaspeechcloudcreatespeech.java:45 

how can solve exception or how can make class around , manually enter accesskey , secretkey string. thanks.

okay figured out after few hours of messing around in source files. can make own provider class can pass credentials in string parameters.

this custom credential class "ivonacredentials"

import com.amazonaws.auth.awscredentials; import com.amazonaws.auth.awscredentialsprovider;  public class ivonacredentials implements awscredentialsprovider{  public ivonacredentials(string msecretkey, string maccesskey) {     super();     this.msecretkey = msecretkey;     this.maccesskey = maccesskey; }  private string msecretkey; private string maccesskey;  @override public awscredentials getcredentials() {     awscredentials awscredentials = new awscredentials() {          @override         public string getawssecretkey() {             // todo auto-generated method stub             return msecretkey;         }          @override         public string getawsaccesskeyid() {             // todo auto-generated method stub             return maccesskey;         };     };     return awscredentials; }  @override public void refresh() {     // todo auto-generated method stub  }    } 

this how call class

private static void init() {     speechcloud = new ivonaspeechcloudclient(new ivonacredentials("secretkey", "accesskey"));     speechcloud.setendpoint("https://tts.eu-west-1.ivonacloud.com"); } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -