10 Replies Latest reply on Dec 14, 2013 7:12 PM by Jeremy Pruitt

    testing API with REST Client and got bulkCreate error

      Share This:

      I using REST api client to test provisioning server. For login and ServiceOffering/search, I can call API without the problem but when i try to call bulkCreate, i got the error as the following. What is this problem mean?

       

      [{

        "cloudClass" : "com.bmc.cloud.model.beans.Task",

        "className" : "com.bmc.cloud.model.beans.ServiceOfferingInstance",

        "errors" : [ {

          "cloudClass" : "com.bmc.cloud.model.beans.TaskError",

          "errorAction" : "Please contact System Administrator.",

          "errorCause" : "Error occurred while creating task CloudClass#bulkCreate : Cannot invoke com.bmc.cloud.model.beans.argumentbeans.ServiceOfferingInstanceArguments$BulkCreate.setServiceOfferingID on bean class 'class com.bmc.cloud.model.beans.argumentbeans.ServiceOfferingInstanceArguments$BulkCreate' - java.lang.ClassCastException@1817bcb1 - had objects of type \"java.lang.String\" but expected signature \"com.bmc.cloud.model.beans.ServiceOffering\"",

          "errorID" : "BMC-CLMT-11100035",

          "errorTrace" : "java.lang.IllegalArgumentException: Cannot invoke com.bmc.cloud.model.beans.argumentbeans.ServiceOfferingInstanceArguments$BulkCreate.setServiceOfferingID on bean class 'class com.bmc.cloud.model.beans.argumentbeans.ServiceOfferingInstanceArguments$BulkCreate' - java.lang.ClassCastException@1817bcb1 - had objects of type \"java.lang.String\" but expected signature \"com.bmc.cloud.model.beans.ServiceOffering\"\n\tat org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2235)\n\tat org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2151)\n\tat org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1957)\n\tat org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:2064)\n\tat org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1017)\n\tat org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:456)\n\tat com.bmc.cloud.fsm.impl.ArgumentsBeanHelper.createArgumentsBean(ArgumentsBeanHelper.java:75)\n\tat com.bmc.cloud.taskmanager.impl.TaskManagerImpl.createCloudTask(TaskManagerImpl.java:573)\n\tat com.bmc.cloud.provider.base.BaseProviderInstance.createFSM(BaseProviderInstance.java:769)\n\tat com.bmc.cloud.provider.base.BaseProviderInstance.handleRequest(BaseProviderInstance.java:698)\n\tat com.bmc.cloud.provider.registry.internal.ProviderRegistryImpl.forwardURI(ProviderRegistryImpl.java:1229)\n\tat com.bmc.cloud.provider.csmprovider.internal.CSMProviderInstanceImpl.handleRequest(CSMProviderInstanceImpl.java:124)\n\tat com.bmc.cloud.provider.registry.internal.ProviderRegistryImpl.forwardURI(ProviderRegistryImpl.java:904)\n\tat com.bmc.cloud.manager.service.CloudManagerService.handleRequest(CloudManagerService.java:1460)\n\tat com.bmc.cloud.manager.service.CloudManagerService.invokeOperation(CloudManagerService.java:962)\n\tat com.bmc.cloud.manager.service.CloudManagerService.invokeStaticOperation(CloudManagerService.java:1649)\n\tat sun.reflect.GeneratedMethodAccessor1461.invoke(Unknown Source)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\n\tat java.lang.reflect.Method.invoke(Method.java:597)\n\tat org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:174)\n\tat org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:421)\n\tat org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409)\n\tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)\n\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)\n\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)\n\tat org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:710)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:803)\n\tat org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)\n\tat org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)\n\tat com.bmc.cloud.manager.service.internal.AuthenticationFilter.doFilter(AuthenticationFilter.java:189)\n\tat org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)\n\tat org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)\n\tat org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)\n\tat org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)\n\tat org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)\n\tat org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)\n\tat org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)\n\tat org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)\n\tat org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)\n\tat org.mortbay.jetty.Server.handle(Server.java:324)\n\tat org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)\n\tat org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)\n\tat org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)\n\tat org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)\n\tat org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)\n\tat org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)\n\tat org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)\nCaused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@1817bcb1\n\tat sun.reflect.GeneratedMethodAccessor2029.invoke(Unknown Source)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\n\tat java.lang.reflect.Method.invoke(Method.java:597)\n\tat org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2170)\n\t... 47 more\n",

          "guid" : "083d9c63-bdec-4808-9f4f-2fee127f59f8",

          "hostname" : "192.168.0.14",

          "severity" : "CRITICAL",

          "transactionID" : "ac3acfa9-9e6d-4076-a1fa-73ea829aa19a"

        } ],

        "guid" : "149e5aeb-4150-444b-aee6-733a1c8e4651",

        "isError" : true,

        "isSuccess" : false,

        "taskState" : "FAILED"

      }]


      Here below is my Request Body;

       

      {

      "operationParams" : [

      {

      "name" : "serviceOfferingID",

      "value" : {

        "guid" : "35e3f7b9-7a32-40d8-8919-6b3e63e0a609",

        "reconciliationID" : "OI-7958e29d152040a4b640d92bcc6525b3",

        "cloudClass" : "com.bmc.cloud.model.beans.ServiceOffering"

        },

      "type" : "com.bmc.cloud.model.beans.ServiceOffering",

      "multiplicity" : "1"

      },

      {

      "name" : "quantity",

      "value" : 1,

      "type":"java.lang.Integer",

      "multiplicity" : "1"

      },

      {

      "name" : "name",

      "value" : "DEMO0",

      "type" : "java.lang.String",

      "multiplicity" : "0..1"}

      ],

      "timeout":0,

      "preCallout" : "",

      "postCallout" : ""

      }

        • 1. Re: testing API with REST Client and got bulkCreate error
          Abhishek Rai

          Hi Suwajchai,

           

          Tenant section is missing from request body which can trigger this error.

           

          try following json and modify it as per your requirement. Let me know if it helps:

           

          {

            "operationParams" : [ {

              "name" : "serviceOfferingID",

              "value" : {

                "cloudClass" : "com.bmc.cloud.model.beans.ServiceOffering",

                "guid" : "35e3f7b9-7a32-40d8-8919-6b3e63e0a609",

                "reconciliationID" : "OI-74039510ACF711E2AA0D005056901629"

              },

              "type" : "com.bmc.cloud.model.beans.ServiceOffering",

              "multiplicity" : "1"

            }, {

              "name" : "contractLineID",

              "value" : [ "" ],

              "type" : "java.lang.String",

              "multiplicity" : "1..*"

            }, {

          "name" : "quantity",

              "value" : 1,

              "type" : "java.lang.Integer",

              "multiplicity" : "1"

            }, {

              "name" : "selectedOptionID",

              "value" : [ "" ],

              "type" : "java.lang.String",

              "multiplicity" : "0..*"

            },

          {

              "name" : "hostnamePrefix",

              "value" : "api",

              "type" : "java.lang.String",

              "multiplicity" : "0..1"

            }, {

              "name" : "tenant",

              "value" : "ROSE(CloudProvider)",

              "type" : "java.lang.String",

              "multiplicity" : "0..1"

            },

          {

          "name" : "name",

              "value" : "APIS",

              "type" : "java.lang.String",

              "multiplicity" : "0..1"

            },

                {

                  "name": "username",

                  "type": "java.lang.String",

                  "multiplicity": "1",

                  "value": "admin"

              },{

                  "name": "password",

                  "type": "java.lang.String",

                  "multiplicity": "1",

                  "value": "plaintext:pasword"

               }

            ],

            "timeout" : 0,

            "alreadyTraversedGlobalRegistry" : false,

            "alreadyTraversedLocalRegistry" : false,

            "preCallout" : "",

            "postCallout" : "",

            "callbackURL" : ""

          }

          • 2. Re: testing API with REST Client and got bulkCreate error

            Thank you Rai, No luck, I try to use your reference request body and modify as the following but still the same error.

             

            {

              "operationParams" : [ {

                "name" : "serviceOfferingID",

                "value" : {

                  "cloudClass" : "com.bmc.cloud.model.beans.ServiceOffering",

                  "guid" : "35e3f7b9-7a32-40d8-8919-6b3e63e0a609",

                 "reconciliationID" : "OI-7958e29d152040a4b640d92bcc6525b3"

                },

                "type" : "com.bmc.cloud.model.beans.ServiceOffering",

                "multiplicity" : "1"

              }, {

                "name" : "contractLineID",

                "value" : [ "" ],

                "type" : "java.lang.String",

                "multiplicity" : "1..*"

              }, {

            "name" : "quantity",

                "value" : 1,

                "type" : "java.lang.Integer",

                "multiplicity" : "1"

              }, {

                "name" : "selectedOptionID",

                "value" : [ "" ],

                "type" : "java.lang.String",

                "multiplicity" : "0..*"

              },

            {

                "name" : "hostnamePrefix",

                "value" : "api",

                "type" : "java.lang.String",

                "multiplicity" : "0..1"

              }, {

                "name" : "tenant",

                "value" : "Calbro Service",

                "type" : "java.lang.String",

                "multiplicity" : "0..1"

              },

            {

            "name" : "name",

                "value" : "APIS",

                "type" : "java.lang.String",

                "multiplicity" : "0..1"

              }

              ],

              "timeout" : 0,

              "alreadyTraversedGlobalRegistry" : false,

              "alreadyTraversedLocalRegistry" : false,

              "preCallout" : "",

              "postCallout" : "",

              "callbackURL" : ""

            }

            • 3. Re: testing API with REST Client and got bulkCreate error
              Abhishek Rai

              Did you get the same error? I am going to use the same Json will let you know the result.

              • 5. Re: testing API with REST Client and got bulkCreate error
                Abhishek Rai

                Hi Suwajchai,

                 

                Thank you for information.

                 

                I just modified my JSON and were able to successfully provisioned a VM using API. Here is the that JSON:

                 

                {

                  "timeout" : 0,

                  "preCallout" : "",

                  "postCallout" : "",

                  "callbackURL" : "",

                    "operationParams" :

                  [

                  {"name" : "serviceOfferingID",

                  "value" : {

                  "cloudClass" : "com.bmc.cloud.model.beans.ServiceOffering",

                  "guid" : "e3e412ab-c6b2-4a8b-bfd8-1a47a82443db",

                  "reconciliationID" : "OI-bb4536a7220d4a6bad0effd719510590"

                  },

                  "type" : "com.bmc.cloud.model.beans.ServiceOffering",

                  "multiplicity" : "1"

                  },

                  {"name" : "contractLineID",

                   "value" : [ "REGAA5V0F1LKHAM2UYKVCYL4OBGKPF" ],

                   "type" : "java.lang.String",

                   "multiplicity" : "1..*"

                  },

                  {"name" : "quantity","value" : 1,"type" : "java.lang.Integer","multiplicity" : "1"},

                  {"name" : "selectedOptionID",

                   "value" : [ "8AE2E217-B16E-5771-627F-294F6B12030A", "1F92E613-2271-7477-AD73-296E901B0D69", "CA82F42C-182A-81B0-068B-35FD112FE2C4", "8CCE54E4-6C7C-41DD-59EB-3AADC9EB2204", "520EDE6C-F8E2-7522-E997-1AC124053AD9", "9824302E-61CB-96B9-608B-820485FE437C" ],

                   "type" : "java.lang.String",

                   "multiplicity" : "0..*"

                  },

                  {"name" : "password","value" : "plaintext:bmcAdm1n","type" : "java.lang.String","multiplicity" : "0..1"},

                  {"name" : "username","value" : "Admin","type" : "java.lang.String","multiplicity" : "0..1"},

                  {"name" : "hostnamePrefix","value" : "aaAPI","type" : "java.lang.String","multiplicity" : "0..1"},

                  {"name" : "tenant","value" : "ROSE(CloudProvider)","type" : "java.lang.String","multiplicity" : "0..1"},

                  {"name" : "name","value" : "aaAPI","type" : "java.lang.String","multiplicity" : "0..1"}

                    ]

                }

                 

                Note: Modify the Service offering recon id, tenant name and option choices recon id's and let me know if it helps.

                1 of 1 people found this helpful
                • 6. Re: testing API with REST Client and got bulkCreate error
                  Abhishek Rai

                  Just remove the contractline section before using this JSON.

                   

                  {"name" : "contractLineID",

                     "value" : [ "REGAA5V0F1LKHAM2UYKVCYL4OBGKPF" ],

                     "type" : "java.lang.String",

                     "multiplicity" : "1..*"

                    },

                  • 7. Re: testing API with REST Client and got bulkCreate error

                    Thank you Rai,

                     

                    I already fixed this problem. The problem is not my webservice syntax. I found that the problem is on Network. I use CLM Demo kit which get from BMC. The demo kit is setup using CLM31 network which is private network (192.168.0.x) and use NAT to NAT external IP to 192.168.0.x network (Port Forward). I can fix this problem by using 1:1 NAT to map external IP with 192.168.0.x.

                     

                    Thank you for your kindly answer

                    • 8. Re: testing API with REST Client and got bulkCreate error

                      I am getting the same issue, I think, but I don't think there are any NAT issues or odd networks or anything like that around my CLM env. I can authenticate, and I can search for things, but I can't instantiate a service offering. Here is the error I get:

                       

                          had objects of type \"java.lang.String\" but expected signature \"com.bmc.cloud.model.beans.ServiceOffering\"", "errorID"=>"BMC-CLMT-11100035"

                       

                      Which seems to be a java type error where it expects an object but instead gets a string. Here is the request I am sending:

                       

                      {

                        "timeout": -1,

                        "preCallout": "",

                        "postCallout": "",

                        "operationParams": [

                          {

                            "name": "name",

                            "type": "java.lang.String",

                            "multiplicity": "1",

                            "value": "ENG_POC_Centos63_64"

                          },

                          {

                            "name": "description",

                            "type": "java.lang.String",

                            "multiplicity": "1",

                            "value": "Provision by CLM API from ruby script"

                          },

                          {

                            "name": "hostnamePrefix",

                            "type": "java.lang.String",

                            "multiplicity": "1",

                            "value": "jp-clm-apitest"

                          },

                          {

                            "name": "password",

                            "type": "java.lang.String",

                            "multiplicity": "1",

                            "value": "plaintext:_REMOVED_"

                          },

                          {

                            "name": "serviceOfferingID",

                            "type": "com.bmc.cloud.model.beans.ServiceOffering",

                            "multiplicity": "1",

                            "value": {

                              "cloudClass": "com.bmc.cloud.model.beans.ServiceOffering",

                              "reconciliationID": "OI-af69d2c81c0547d4b9677cecead2830c"

                            }

                          },

                          {

                            "name": "selectedOptionID",

                            "type": "java.lang.String",

                            "multiplicity": "1",

                            "value": [

                       

                            ]

                          },

                          {

                            "name": "tenant",

                            "type": "java.lang.String",

                            "multiplicity": "1",

                            "value": "Juniper"

                          },

                          {

                            "name": "username",

                            "type": "java.lang.String",

                            "multiplicity": "1",

                            "value": "jpruitt"

                          },

                          {

                            "name": "provisionDate",

                            "type": "java.util.Date",

                            "multiplicity": "1",

                            "value": 1387011874000

                          },

                          {

                            "name": "quantity",

                            "type": "java.lang.Integer",

                            "multiplicity": "1",

                            "value": 1

                          }

                        ]

                      }

                       

                      I am using a slightly modified version of this ruby script I found here on the communities site:

                       

                          https://communities.bmc.com/docs/DOC-21268

                       

                      Thanks for any insight you can provide. I am doing this to automate the instantation and decommission of a service request a few times a day to ensure that the environment is able to do so, and raise an error alert if it can not.

                       

                      - Jeremy

                      • 9. Re: testing API with REST Client and got bulkCreate error

                        Jeremy,

                         

                        Please use all lowercase "bulkcreate" in the API URL. That should fix this.


                        Thanks,

                        - Nitin

                        • 10. Re: testing API with REST Client and got bulkCreate error

                          Thanks so much! That was exactly the issue! Provisioning happily now