vCenter

 View Only
  • 1.  error generating report via API

    Posted May 10, 2011 08:00 PM

    Hi to all you vChargeback users out there!  I'm trying to get some reports generated using the Chargeback API, but I'm having some difficulty.  I'd like to create a usage report for a simple hierarchy, and export it to XML, however, when I send my request to the server, I get "an error has occured".  I turned on trace-level logging in vChargeback, and it returned the helpful Java Excpetion that you can see below.  It appears that there is a missing enumeration?  I am using the values listed in the chargeback API 1.5.0 documentation.    Any assistance would be much appreciated!

    I will list the response first, and then the request XML that I am sending in:

    <Response xmlns="http://www.vmware.com/vcenter/chargeback/1.5.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" status="failure">
      <Error majorErrorCode="500" minorErrorCode="0" message="An error has occurred. Please contact the system administrator or try again later." />
      <ErrorStackTrace>java.lang.IllegalArgumentException: No enum const class com.vmware.vim.vcenter.chargeback.utils.ReportType.USAGE_REPORT
            at java.lang.Enum.valueOf(Enum.java:196)
            at com.vmware.vim.vcenter.chargeback.utils.ReportType.valueOf(ReportType.java:9)
            at com.vmware.vim.vcenter.chargeback.reporting.rest.RestReportingRequestHandler.validateXMLPayloadForCreateReport(RestReportingRequestHandler.java:260)
            at com.vmware.vim.vcenter.chargeback.reporting.rest.AbstractRestReportingRequestHandler.constructReport(AbstractRestReportingRequestHandler.java:81)
            at com.vmware.vim.vcenter.chargeback.reporting.rest.RestReportingManager.generateReport(RestReportingManager.java:137)
            at com.vmware.vim.vcenter.chargeback.reporting.rest.RestReportingManager$$FastClassByCGLIB$$44e0949e.invoke(&lt;generated&gt;)
            at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
            at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
            at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
            at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
            at com.vmware.vim.vcenter.chargeback.reporting.rest.RestReportingManager$$EnhancerByCGLIB$$a8cf4aee.generateReport(&lt;generated&gt;)
            at com.vmware.vim.vcenter.chargeback.rest.facade.CBMImpl.RestReportingManagergenerateReport(CBMImpl.java:8960)
            at sun.reflect.GeneratedMethodAccessor1573.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:136)
            at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
            at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:109)
            at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:63)
            at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
            at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
            at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
            at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
            at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
            at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
            at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:283)
            at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:128)
            at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:174)
            at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:152)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:227)
            at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
            at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:427)
            at org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:384)
            at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
            at java.lang.Thread.run(Thread.java:619)
    </ErrorStackTrace>
    </Response>

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Request xmlns="http://www.vmware.com/vcenter/chargeback/1.5.0">
        <Reports>
            <Report>
                <MetaData>
                    <Name>api_test</Name>
                    <Description>api test</Description>
                    <ReportType>USAGE_REPORT</ReportType>
                    <ReportPeriod>
                        <From>1304222400000</From>
                        <To>1306814400000</To>
                    </ReportPeriod>
                    <CreatedBy>0</CreatedBy>
                    <OwnedByName>nchu</OwnedByName>
                    <Hierarchies>
                        <Hierarchy id="3997">
                            <Entities>
                                <Entity costModelId="4033" id="3998" />
                            </Entities>
                        </Hierarchy>
                    </Hierarchies>
                    <ComputingResources>
                        <ComputingResource id="1" />
                        <ComputingResource id="5" />
                        <ComputingResource id="9" />
                        <ComputingResource id="10" />
                    </ComputingResources>
                </MetaData>
            </Report>
        </Reports>
    </Request>



  • 2.  RE: error generating report via API
    Best Answer

    Posted May 11, 2011 09:18 AM

    Hello,

       The valid value for <ReportType> element in the input should be UTILIZATION_REPORT.

    Looks like there is an error in the API documentation,  We will get it corrected, sorry for the

    inconvenience caused.

    Thanks & Regards

    Diwakar



  • 3.  RE: error generating report via API

    Posted May 11, 2011 01:28 PM

    ahhh, excellent!  thanks very much!



  • 4.  RE: error generating report via API

    Posted Nov 23, 2011 02:54 PM

    I have just had the same problem as the API documentation has still not been updated :-(