5 Replies Latest reply on Feb 20, 2015 2:51 PM by rkamal

    java sdk vCD 5.5 - get all vapp templates just stops no errors

    msaxbury Novice


      We are writing a java program to extract Org, Catalog, and vApp Template information from vCD 5.5 using the SDK and VM information using the Query service.


      Initially, we use the sdk to login at the Organization level not admin. It gets the Org name and desc, we only care about 1 org right now and know its name. For each VDC in the Org, it creates a collection of vapp templates in the VDC, if the vapp template is associated with a catalog that is in the Org we care about. Then we get that catalog's info as well. We then start writing that info to a mysql database. Then we use the query service to get vm info for each vapp template we found. 


      We process on average 160 vapp templates and then the program just quits. No exceptions anywhere(vcd, mysql, java, tomcat, etc.). It runs successfully for approximately 5mins(160ish vapp templates) and then just stops cold. We cut the code back to just get only the names of the vapp templates list in the in the system.out log and it still processes the same amount and just quits.


      Is there some sort of limit, or timeout we are missing somewhere? Any ideas on why it would just stop? 

        • 1. Re: java sdk vCD 5.5 - get all vapp templates just stops no errors
          msaxbury Novice

          I received more information, it was being executed for test via jsp page and servlet. It could be apache/tomcat timeout issues for jsp configurations so we will check on those items. We are moving to running it as a stand alone java program since the sample.java code runs successfully and quickly. We are doing some other comparisons prior to writing to db though, so not as simple as the samples and takes longer.

          • 2. Re: java sdk vCD 5.5 - get all vapp templates just stops no errors
            msaxbury Novice

            We ran again as a stand alone java program through Eclipse and have narrowed it down to the while loop below. It loops through the vapp template names and writes them to the system.out. Between 150-180 it just randomly stops.

             

            Collection<ReferenceType> vdcRefs = org.getVdcRefs();

            if(!vdcRefs.isEmpty()){

                for(ReferenceType vdcRef:vdcRefs ){

                    Vdc vdc = Vdc.getVdcByReference(vcloudClient, vdcRef);

                    System.out.println("VDC : "  +vdc.getResource().getName());

                    System.out.println("=================================================================");

             

                    Collection<ReferenceType> vapptRefs = vdc.getVappTemplateRefs();

                    System.out.println(vapptRefs.size());

                    if(vapptRefs.size() > 0){

                        Iterator<ReferenceType> i = vapptRefs.iterator();

             

                        while(i.hasNext()){

                            ReferenceType vapptRef = i.next();

                            VappTemplate vappt = VappTemplate.getVappTemplateByReference(vcloudClient, vapptRef);

                            vapptname = vappt.getResource().getName();

             

                                System.out.println(">>>>"+count+">>>"+vapptname);

                                count++;

                        }

                    }

             

                }

            }

             

            We also added a 5min wait to the sample listInventory code and it also stops abruptly without errors. The code logs in, waits 5 mins, then runs the listInventory code and stops before its complete, with no errors.

             

            It appears to be some sort of timeout being experienced. We are using the default FakeSSLSocketFactory.java, is there a timeout issue with that socketfactory?

            • 3. Re: java sdk vCD 5.5 - get all vapp templates just stops no errors
              rkamal Expert
              VMware Employees

              Hi,

               

              There should be something in the logs. Can you enable the java sdk's client logs and post it as a file attachment.

               

              VcloudClient.setLogLevel(Level.ALL);

               

              Regards,

              Rajesh Kamal.

              • 4. Re: java sdk vCD 5.5 - get all vapp templates just stops no errors
                msaxbury Novice

                com.vmware.vcloud.sdk.RestUtil get

                INFO: Status Code - 500

                Feb 20, 2015 2:29:37 PM com.vmware.vcloud.sdk.RestUtil get

                INFO: Status - Server Error

                Feb 20, 2015 2:29:37 PM com.vmware.vcloud.sdk.RestUtil get

                INFO: Response - <?xml version="1.0" encoding="UTF-8"?>

                <Error xmlns="http://www.vmware.com/vcloud/v1.5" minorErrorCode="INTERNAL_SERVER_ERROR" message="Unable to perform this action. Contact your cloud administrator." majorErrorCode="500" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcore3-us01.oc.vmware.com/api/v1.5/schema/master.xsd"></Error>

                 

                 

                Feb 20, 2015 2:29:37 PM com.vmware.vcloud.sdk.Response isExpected

                INFO: Expected Status Code - 200

                Feb 20, 2015 2:29:37 PM com.vmware.vcloud.sdk.Response isExpected

                INFO: Actual Status Code - 500

                • 5. Re: java sdk vCD 5.5 - get all vapp templates just stops no errors
                  rkamal Expert
                  VMware Employees

                  Hi,

                   

                  More logs will be good. Because this doesn't capture the operation that you tried. It does not have the GET operation URL.

                   

                  I see from the logs that you are logging in as a Org Admin/User. Do you have access to the System Admin login. You can run the same and see what the detailed error is.

                   

                  Regards,

                  Rajesh Kamal.