maheshwarirohit87 / typica

Automatically exported from code.google.com/p/typica
Apache License 2.0
0 stars 0 forks source link

Everytime I call Jec2.requestSpotInstances #101

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call Jec2.requestSpotInatances paaing in a SpotInstanceRequestConfiguration 
and launch Configuration

What is the expected output? What do you see instead?
Expected output should return a list of SpotInstances. Instead an EC2Exception 
is thrown every time. With Client Error. 

What version of the product are you using? On what operating system?
1.7.2 r344

Please provide any additional information below.

This is very urgent.

Original issue reported on code.google.com by David.M.Beer@gmail.com on 1 Aug 2010 at 8:55

GoogleCodeExporter commented 9 years ago
This is the stack trace.

com.xerox.amazonws.ec2.EC2Exception: Client error : The request received was 
invalid.
        at com.xerox.amazonws.ec2.Jec2.makeRequestInt(Jec2.java:2359)
        at com.xerox.amazonws.ec2.Jec2.requestSpotInstances(Jec2.java:2201)

Original comment by David.M.Beer@gmail.com on 1 Aug 2010 at 8:58

GoogleCodeExporter commented 9 years ago
After further debuging the response code is always 400, the url sent is as 
follows:

url = 
https://eu-west-1.ec2.amazonaws.com/?AWSAccessKeyId=**************************=R
equestSpotInstances&InstanceCount=1&LaunchSpecification.AddressingType=public&La
unchSpecification.ImageId=ami-3981aa4d&LaunchSpecification.InstanceType=m1.small
&LaunchSpecification.KernelId=aki-61022915&LaunchSpecification.KeyName=eu1&Launc
hSpecification.RamdiskId=ari-63022917&LaunchSpecification.SecurityGroup.1=defaul
t&SignatureMethod=HmacSHA256&SignatureVersion=2&SpotPrice=0.045&Timestamp=2010-0
8-14T21%3A15%3A00Z&Type=one-time&ValidFrom=java.util.GregorianCalendar%5Btime%3D
1281820474350%2CareFieldsSet%3Dtrue%2CareAllFieldsSet%3Dtrue%2Clenient%3Dtrue%2C
zone%3Dsun.util.calendar.ZoneInfo%5Bid%3D%22Europe%2FBelfast%22%2Coffset%3D0%2Cd
stSavings%3D3600000%2CuseDaylight%3Dtrue%2Ctransitions%3D242%2ClastRule%3Djava.u
til.SimpleTimeZone%5Bid%3DEurope%2FBelfast%2Coffset%3D0%2CdstSavings%3D3600000%2
CuseDaylight%3Dtrue%2CstartYear%3D0%2CstartMode%3D2%2CstartMonth%3D2%2CstartDay%
3D-1%2CstartDayOfWeek%3D1%2CstartTime%3D3600000%2CstartTimeMode%3D2%2CendMode%3D
2%2CendMonth%3D9%2CendDay%3D-1%2CendDayOfWeek%3D1%2CendTime%3D3600000%2CendTimeM
ode%3D2%5D%5D%2CfirstDayOfWeek%3D2%2CminimalDaysInFirstWeek%3D4%2CERA%3D1%2CYEAR
%3D2010%2CMONTH%3D7%2CWEEK_OF_YEAR%3D32%2CWEEK_OF_MONTH%3D2%2CDAY_OF_MONTH%3D14%
2CDAY_OF_YEAR%3D226%2CDAY_OF_WEEK%3D7%2CDAY_OF_WEEK_IN_MONTH%3D2%2CAM_PM%3D1%2CH
OUR%3D10%2CHOUR_OF_DAY%3D22%2CMINUTE%3D14%2CSECOND%3D34%2CMILLISECOND%3D350%2CZO
NE_OFFSET%3D0%2CDST_OFFSET%3D3600000%5D&Version=2010-06-15&Signature=hklsmopy9YP
jOwLLqGIS%2BJE5vPfE0b9pSF4DfruaK2M%3D

According to the query Api I am providing the necessary parameters required.

If I can help any more please let me know.

Original comment by David.M.Beer@gmail.com on 14 Aug 2010 at 9:22

GoogleCodeExporter commented 9 years ago
I had another look at this today and it seems that if you add a Calendar for 
the validFrom and validUntil. The error is thrown.

Do I have to configure the Calendar object in a specific way?

Original comment by David.M.Beer@gmail.com on 15 Aug 2010 at 1:23

GoogleCodeExporter commented 9 years ago
I have solved the problem by converting the calendar object to a http date.

I added the following code after 'sirc.prepareQueryParams(params);' in Jec2 
class in the method 'requestSpotInstances'. 

if (sirc.getValidFrom() != null) {
   String newDate = httpDate(sirc.getValidFrom());
   params.put("ValidFrom", newDate);
}
if (sirc.getValidUntil() != null) {
   String newDate = httpDate(sirc.getValidUntil());
   params.put("ValidUntil", newDate);
}

I hope this helps.

Original comment by David.M.Beer@gmail.com on 15 Aug 2010 at 3:38