2014-02-13 19 views
0

我試圖通過java api和命令行參數爲現有彈性beanstalk應用程序創建應用程序版本的過程自動化。使用java api爲Amazon Elastic Beanstalk現有應用程序創建新的應用程序版本

同時實現AWSElasticBeanstalkClient的createApplicationVersion()我得到下面的代碼snipplet的錯誤。 注意:我將AWSElasticBeanstalkClient的端點作爲US East-1(N.Virginia)或現有應用程序的環境URL傳遞。

ArrayList<String> s3SourceBundleList = AmazonS3BucketUploadApp.doBucketUploadFromLocal(sourceLocation); 
    String bucketName = s3SourceBundleList.get(0); 
    String keyName = java.net.URLEncoder.encode(s3SourceBundleList.get(1), "UTF-8"); 
    //String keyName = s3SourceBundleList.get(1); 
    S3Location s3SourceBundle = new S3Location(); 
    s3SourceBundle.setS3Bucket(bucketName); 
    s3SourceBundle.setS3Key(keyName); 
    createApplicationVersionRequest.setSourceBundle(s3SourceBundle); 
    createApplicationVersionRequest.setDescription("New version"); 

    appVersionResultObject = awsBeanstalkclient.createApplicationVersion(createApplicationVersionRequest); 

錯誤:

com.amazonaws.AmazonClientException: Unable to unmarshall response (ParseError at [row,col]:[6,1] 

和一個更多的錯誤是

AWS service: AmazonElasticBeanstalk AWS Request ID: null AWS service unavailable. 

請提出這方面的任何解決方案。

回答

0

你如何初始化客戶端(檢查日誌輸出 - 啓用記錄器org.apache.http.wire TRACE可以幫助)?

如果你想一個想法,這個源偷看:

https://github.com/jenkinsci/awseb-deployment-plugin/blob/master/src/main/java/br/com/ingenieux/jenkins/plugins/awsebdeployment/Deployer.java

它包含了所有你需要建立和部署到AWS EB :)

+0

感謝您的建議。我現在正在爲我的獨立Java應用程序獲取連接拒絕錯誤,以自動創建應用程序版本以用於beanstalk。 AWSElasticBeanStalkClient由下面的代碼初始化。 AWSElasticBeanstalkClient awsBeanstalkclient = CommandlineApp \t \t \t \t .getAmazonElasticBeanstalkClient(awsconfig,accessKeyID,secretAccessKey); \t \t awsBeanstalkclient.setEndpoint(property.getProperty(「ebsEndPoint」));請幫忙。 – maali

+0

閱讀: http://docs.aws.amazon.com/AWSSdkDocsJava/latest/DeveloperGuide/java-dg-logging.html 然後啓用電線調試,如上所述。審查,放棄密鑰,並粘貼到Git好嗎? – aldrinleal

相關問題