You need to sign in to do that
Don't have an account?
Ritesh__
Unable to install Amazon developer Toolkit
I installed Amazon toolkit in salesforce developer org and I created an object of type AWS credentials. Then in EC2ConsoleController, I specified the name of the AWS credential object after that when I try to open EC2 Console tab but it is giving me error
Too many script statements: 200001 Error is in expression '{!constructor}' in component <apex:page> in page ec2console
Why am I facing this error and how to get rid of this? Please help
code of ec2console page is
<apex:page controller="EC2ConsoleController" sidebar="true" action="{!constructor}"> <!-- <apex:messages /> --> <apex:pageMessages /> <apex:form > <apex:pageBlock title="Amazon EC2 Console"> <apex:pageBlockButtons > <apex:commandButton action="{!refreshInstances}" value="Refresh" rerender="instancesTable" status="instancesStatus" /> <apex:actionStatus id="instancesStatus" startText="Please wait ..."></apex:actionStatus> </apex:pageBlockButtons> <apex:pageblockSection title="Instances"> <apex:pageBlockTable value="{!instances}" var="ins" id="instancesTable"> <apex:column value="{!ins.instanceId}"> <apex:facet name="header">Id</apex:facet> </apex:column> <apex:column value="{!ins.imageId}"> <apex:facet name="header">Image Id</apex:facet> </apex:column> <apex:column value="{!ins.instanceStateName}"> <apex:facet name="header">State</apex:facet> </apex:column> <apex:column value="{!ins.privateDNSName}"> <apex:facet name="header">Private DNS</apex:facet> </apex:column> <apex:column value="{!ins.dnsName}"> <apex:facet name="header">Public DNS</apex:facet> </apex:column> <apex:column value="{!ins.amiLaunchIndex}"> <apex:facet name="header">Launch Index</apex:facet> </apex:column> <apex:column value="{!ins.launchTime}"> <apex:facet name="header">Launch Time</apex:facet> </apex:column> <apex:column value="{!ins.availabilityZone}"> <apex:facet name="header">Zone</apex:facet> </apex:column> <apex:column > <apex:commandLink action="{!TerminateInstances}" rendered="{!ins.instanceStateName == 'running'}" status="instancesStatus"> <apex:param name="instanceId" value="{!ins.instanceId}"></apex:param> <apex:image url="{!$Resource.EC2Console_ShutdownImage}" width="24" height="24" title="Shutdown Instance" /> </apex:commandLink> </apex:column> <apex:column > <apex:commandLink action="{!RebootInstances}" rendered="{!ins.instanceStateName == 'running'}" status="instancesStatus"> <apex:param name="instanceId" value="{!ins.instanceId}"></apex:param> <apex:image url="{!$Resource.EC2Console_RebootImage}" width="24" height="24" title="Reboot Instance" /> </apex:commandLink> </apex:column> </apex:pageBlockTable> </apex:pageblockSection> </apex:pageBlock> </apex:form> </apex:page>
and EC2ConsoleController
public class EC2ConsoleController { EC2Connection ec2; private String AWSCredentialName = 'amazon'; //Modify this string variable to be the name of the AWS Credential record that contains the proper AWS keys and secret public List<EC2Connection.EC2Image> images {get;set;} public List<EC2Connection.EC2Instance> instances {get;set;} public String owner {get;set;} public EC2ConsoleController() { //ec2 = new EC2Connection(AWSCredentialName); //this.owner = 'amazon'; //default owner //try { // getdescribeImages(); // getdescribeInstances(); // } catch( exception ee ) {} } /* This method is called when the AWS_S3_Examples Visualforce page is loaded. It verifies that the AWS Keys can be found in the AWSKeys__c custom object by the specified name, as set in the string variable AWSCredentialsName. Any errors are added to the ApexPage and displayed in the Visualforce page. */ public PageReference constructor(){ try{ AWSKeys credentials = new AWSKeys(AWSCredentialName); ec2 = new EC2Connection(AWSCredentialName); this.owner = 'amazon'; //default owner try { getdescribeImages(); getdescribeInstances(); } catch( exception ee ) {} }catch(AWSKeys.AWSKeysException AWSEx){ System.debug('Caught exception in AWS_S3_ExampleController: ' + AWSEx); ApexPages.Message errorMsg = new ApexPages.Message(ApexPages.Severity.FATAL, AWSEx.getMessage()); ApexPages.addMessage(errorMsg); //throw new AWSKeys.AWSKeysException(AWSEx); //ApexPages.addMessage(AWSEx); } return null; } //get public AMI images descriptions public void getdescribeImages() { this.images = ec2.DescribeImages(owner); } //get running instances public void getdescribeInstances() { this.instances = ec2.DescribeInstances(); } //start up an EC2 image public void RunInstances() { String imageId = System.currentPageReference().getParameters().get('imageId'); ec2.RunInstances(imageId); refreshInstances(); } //terminate an EC2 image public void TerminateInstances() { String instanceId = System.currentPageReference().getParameters().get('instanceId'); ec2.TerminateInstances(instanceId); refreshInstances(); } //reboot an EC2 image public void RebootInstances() { String instanceId = System.currentPageReference().getParameters().get('instanceId'); ec2.RebootInstances(instanceId); refreshInstances(); } //reload Instances public void refreshInstances() { getdescribeInstances(); } //reload images public void refreshImages() { //System.debug('Owner : '+owner); this.images = ec2.DescribeImages(owner); } //for the owner selectlist public List<SelectOption> getOwners() { List<SelectOption> options = new List<SelectOption>(); options.add(new SelectOption('amazon','Amazon')); options.add(new SelectOption('self','My Images')); return options; } private String createTestCredentials(){ AWSKey__c testKey = new AWSKey__c(name='test keys',key__c='key',secret__c='secret'); insert testKey; return testKey.name; } // EC2ConsoleController.t1(); public static testmethod void t1() { EC2ConsoleController ecc = new EC2ConsoleController(); String credName = ecc.createTestCredentials(); ecc.AWSCredentialName = credName; ecc.constructor(); ecc.getdescribeInstances(); } public static testmethod void t2() { try{ EC2ConsoleController ecc = new EC2ConsoleController(); ecc.getdescribeImages(); }catch(Exception ex){ } } public static testmethod void t3() { try{ EC2ConsoleController ecc = new EC2ConsoleController(); ecc.refreshImages(); }catch(Exception ex){ } } public static testmethod void t4() { try{ EC2ConsoleController ecc = new EC2ConsoleController(); ecc.RebootInstances(); }catch(Exception ex){ } } public static testmethod void t5() { try{ EC2ConsoleController ecc = new EC2ConsoleController(); ecc.getOwners(); ecc.TerminateInstances(); }catch(Exception ex){ } } public static testmethod void t6() { try{ EC2ConsoleController ecc = new EC2ConsoleController(); ecc.RunInstances(); }catch(Exception ex){ } } }
and i am getting this error on first line of ec2console page
<apex:page controller="EC2ConsoleController" sidebar="true" action="{!constructor}">
now please help how to get rid of this error
Did you find a solution to this? I am faced with this error too and SFDC Premier Support is being difficult.