VMware Cloud Community
bluecloud201110
Contributor
Contributor
Jump to solution

vCD 5.1.1 REST API Error

I am using the RESTClient firefox plugin to do some API testing against my vCD 5.1.1 installation.  I can log in successfully, but then I always get the following error, no matter what REST operation I execute.  I am wondering if there is some stale service/extension registered, but I don't know how to remove it.

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Error xmlns="http://www.vmware.com/vcloud/v1.5" stackTrace="com.vmware.vcloud.api.rest.handlers.exceptions.InternalServerErrorRestApiException: Cannot send message to service with id: bd9bfdf1-0aee-40d9-be1e-243c507234ce. Check your service configuration.
  3.      at com.vmware.vcloud.api.rest.common.handlers.ErrorHandler.getInternalServerErrorRestApiException(ErrorHandler.java:106)
  4.      at com.vmware.vcloud.api.rest.common.handlers.ErrorHandler.errorInternalServer(ErrorHandler.java:63)
  5.      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  6.      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  7.      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  8.      at java.lang.reflect.Method.invoke(Unknown Source)
  9.      at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
  10.      at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
  11.      at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:164)
  12.      at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:91)
  13.      at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
  14.      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
  15.      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
  16.      at java.util.concurrent.FutureTask.run(Unknown Source)
  17.      at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
  18.      at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
  19.      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
  20.      at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
  21.      at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
  22.      at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
  23.      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
  24.      at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
  25.      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
  26.      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112)
  27.      at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
  28.      at com.vmware.vcloud.api.rest.jaxrs.servlet.CxfServlet.service(CxfServlet.java:161)
  29.      at com.vmware.vcloud.api.rest.jaxrs.servlet.JaxRsDispatcherServlet.doService(JaxRsDispatcherServlet.java:97)
  30.      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
  31.      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
  32.      at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
  33.      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
  34.      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
  35.      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
  36.      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
  37.      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:539)
  38.      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
  39.      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
  40.      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
  41.      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
  42.      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
  43.      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
  44.      at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:288)
  45.      at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:115)
  46.      at org.springframework.security.web.firewall.RequestWrapper$FirewalledRequestAwareRequestDispatcher.forward(RequestWrapper.java:132)
  47.      at com.vmware.vcloud.api.framework.web.ExtensibilityFilter.doFilter(ExtensibilityFilter.java:171)
  48.      at sun.reflect.GeneratedMethodAccessor154.invoke(Unknown Source)
  49.      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  50.      at java.lang.reflect.Method.invoke(Unknown Source)
  51.      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
  52.      at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)
  53.      at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)
  54.      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  55.      at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
  56.      at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
  57.      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  58.      at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)
  59.      at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39)
  60.      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  61.      at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)
  62.      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  63.      at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
  64.      at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
  65.      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  66.      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
  67.      at $Proxy733.doFilter(Unknown Source)
  68.      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
  69.      at com.vmware.vcloud.security.filters.ValidityExceptionFilter.doFilterHttp(ValidityExceptionFilter.java:47)
  70.      at com.vmware.vcloud.security.filters.HttpFilterBean.doFilter(HttpFilterBean.java:35)
  71.      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
  72.      at com.vmware.vcloud.security.web.AuthenticationFilter.doFilter(AuthenticationFilter.java:155)
  73.      at com.vmware.vcloud.api.rest.diagnostics.RestApiDiagnosticsInterceptor.doFilter(RestApiDiagnosticsInterceptor.java:129)
  74.      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
  75.      at com.vmware.vcloud.api.rest.versioning.AcceptHeaderFilter.doFilter(AcceptHeaderFilter.java:108)
  76.      at com.vmware.vcloud.api.rest.diagnostics.RestApiDiagnosticsInterceptor.doFilter(RestApiDiagnosticsInterceptor.java:129)
  77.      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
  78.      at com.vmware.vcloud.security.web.ConversationFilter$1.run(ConversationFilter.java:39)
  79.      at com.vmware.vcloud.security.web.ConversationFilter$1.run(ConversationFilter.java:37)
  80.      at com.vmware.vcloud.common.persist.ConversationContextExecutor.execute(ConversationContextExecutor.java:67)
  81.      at com.vmware.vcloud.security.web.ConversationFilter.doFilter(ConversationFilter.java:45)
  82.      at com.vmware.vcloud.api.rest.diagnostics.RestApiDiagnosticsInterceptor.doFilter(RestApiDiagnosticsInterceptor.java:129)
  83.      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
  84.      at com.vmware.vcloud.security.web.ThreadLocalCleanerFilter.doFilter(ThreadLocalCleanerFilter.java:65)
  85.      at com.vmware.vcloud.api.rest.diagnostics.RestApiDiagnosticsInterceptor.doFilter(RestApiDiagnosticsInterceptor.java:129)
  86.      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
  87.      at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
  88.      at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
  89.      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
  90.      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331)
  91.      at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:77)
  92.      at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:144)
  93.      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331)
  94.      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:477)
  95.      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
  96.      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:521)
  97.      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
  98.      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
  99.      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
  100.      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
  101.      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
  102.      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
  103.      at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
  104.      at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
  105.      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
  106.      at org.eclipse.jetty.server.Server.handle(Server.java:349)
  107.      at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:449)
  108.      at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
  109.      at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:910)
  110.      at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
  111.      at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
  112.      at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
  113.      at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
  114.      at org.eclipse.jetty.server.ssl.SslSocketConnector$SslConnectorEndPoint.run(SslSocketConnector.java:665)
  115.      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
  116.      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
  117.      at java.lang.Thread.run(Unknown Source)
  118. " minorErrorCode="INTERNAL_SERVER_ERROR" message="Cannot send message to service with id: bd9bfdf1-0aee-40d9-be1e-243c507234ce. Check your service configuration." majorErrorCode="500" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://172.17.232.49/api/v1.5/schema/master.xsd">
  119. </Error>
Reply
0 Kudos
1 Solution

Accepted Solutions
rkamal
VMware Employee
VMware Employee
Jump to solution

Hi,

Use the PUT which is an update operation. POST is generally for creating new objects/performing actions on the objects.

Regards,

Rajesh Kamal.

View solution in original post

Reply
0 Kudos
9 Replies
rkamal
VMware Employee
VMware Employee
Jump to solution

Hi,

Try this API URL and see if there are any regisrered services - https://vcloud/api/admin/extension/service/query

If any try deleting that service.

Regards,

Rajesh Kamal.

bluecloud201110
Contributor
Contributor
Jump to solution

Thanks a lot Rajesh.  I found a couple of registered sample extensions using your recommended method:

  • <?xml version="1.0" encoding="UTF-8"?>
  • <AdminServiceReferences xmlns="http://www.vmware.com/vcloud/v1.5" total="2" pageSize="25" page="1" name="adminService" type="application/vnd.vmware.vcloud.query.references+xml" href="https://172.17.232.49/api/admin/extension/service/query?page=1&pageSize=25&format=references" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://172.17.232.49/api/v1.5/schema/master.xsd">
  •     <Link rel="alternate" type="application/vnd.vmware.vcloud.query.records+xml" href="https://172.17.232.49/api/admin/extension/service/query?page=1&pageSize=25&format=records"/>
  •     <Link rel="alternate" type="application/vnd.vmware.vcloud.query.idrecords+xml" href="https://172.17.232.49/api/admin/extension/service/query?page=1&pageSize=25&format=idrecords"/>
  •     <AdminServiceReference type="application/vnd.vmware.admin.service+xml" name="Json Service" id="urn:vcloud:externalService:6bf32929-ed87-40aa-93a9-41f8e7f1e511" href="https://172.17.232.49/api/admin/extension/service/6bf32929-ed87-40aa-93a9-41f8e7f1e511"/>
  •     <AdminServiceReference type="application/vnd.vmware.admin.service+xml" name="Echo Service" id="urn:vcloud:externalService:bd9bfdf1-0aee-40d9-be1e-243c507234ce" href="https://172.17.232.49/api/admin/extension/service/bd9bfdf1-0aee-40d9-be1e-243c507234ce"/>
  • </AdminServiceReferences>
  • However, I am not able to delete either of the services.  I get an exception saying the the service is enabled and I should disable it first.

    How do I disable it?   I can't find an operation to disable services in the REST API reference.

    DELETE  https://172.17.232.49/api/admin/extension/service/6bf32929-ed87-40aa-93a9-41f8e7f1e511

  • <?xml version="1.0" encoding="UTF-8"?>
  • <Error xmlns="http://www.vmware.com/vcloud/v1.5" stackTrace="com.vmware.vcloud.api.presentation.service.BadRequestException: Cannot delete service Json Service because it is enabled. Disable the service and try again.
  • Also, when I do a GET on either service, I don't get any information:

    GET https://172.17.232.49/api/admin/extension/service/6bf32929-ed87-40aa-93a9-41f8e7f1e511
  • <?xml version="1.0" encoding="UTF-8"?>
  • <vmext:Service xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1.5 http://172.17.232.49/api/v1.5/schema/vmwextensions.xsd">
  • </vmext:Service>
  • Reply
    0 Kudos
    rkamal
    VMware Employee
    VMware Employee
    Jump to solution

    Hi,

    1. There is no seperate operation to disable the service. Instead try to do a PUT/Update operation with the enabled flag to false. Then you should be able to Delete it.

    2. The very possible reason you are not seeing any data in the GET service call might you are not sending the application/*+xml;version=5.1 Accept header. You might be sending the 1.5 accept header.

    Regards,

    Rajesh Kamal.

    bluecloud201110
    Contributor
    Contributor
    Jump to solution

    Hi Rajesh,

    Thanks.  I was using the older version (1.5) in the REST header.  Changing it to 5.1 fixed it.

    However, I am unable to figure out the correct REST body format to send to disable the service.   I tried sending the same body as I did when registering the service, except that I changed the enabled field to "false.  However, I get an error that the service is already exists, so apparently this is not the correct request body to send.

    POST https://172.17.232.49/api/admin/extension/service


    <?xml version="1.0" encoding="UTF-8"?>
    <vmext:Service xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1.5 http://10.23.6.103/api/v1.5/schema/vmwextensions.xsd http://www.vmware.com/vcloud/v1.5 http://10.23.6.103/api/v1.5/schema/master.xsd" name="Echo Service" type="application/vnd.vmware.admin.service+xml" operationKey="echo">
        <vmext:Namespace>EchoNamespace</vmext:Namespace>
        <vmext:Enabled>false</vmext:Enabled>
        <vmext:RoutingKey>echo</vmext:RoutingKey>
        <vmext:Priority>10</vmext:Priority>
        <vmext:Exchange>ext</vmext:Exchange>
        <vmext:RequestFilters>
            <vmext:RequestFilter>
              <vmext:UrlPattern>/api/.*</vmext:UrlPattern>
            </vmext:RequestFilter>
        </vmext:RequestFilters>
    </vmext:Service>

    <?xml version="1.0" encoding="UTF-8"?>
    <Error xmlns="http://www.vmware.com/vcloud/v1.5" stackTrace="com.vmware.vcloud.api.presentation.service.BadRequestException: &quot;A service with the same namespace already exists.&quot;
    Reply
    0 Kudos
    rkamal
    VMware Employee
    VMware Employee
    Jump to solution

    Hi,

    Use the PUT which is an update operation. POST is generally for creating new objects/performing actions on the objects.

    Regards,

    Rajesh Kamal.

    Reply
    0 Kudos
    bluecloud201110
    Contributor
    Contributor
    Jump to solution

    Thanks for all your help, Rajesh.  I was able to delete the extensions and everything seems to be back to normal now (all the REST operations are working as expected).

    Cheers!

    Reply
    0 Kudos
    anuragvr
    Enthusiast
    Enthusiast
    Jump to solution

    Hi,

    I am unable to disable the service.   I tried sending the same body as I did when registering the service, except that I changed the enabled field to "false and “PUT” method instead of “POST” as you suggested.  However, I get an error "405 Method Not Allowed".

    PUT  https://xxx.xx.xxx.xx/api/admin/extension/service

    <?xml version="1.0" encoding="UTF-8"?>
    <vmext:Service xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5"
    xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1.5 http://xx.xx.xxx.xxx/api/v1.5/schema/vmwextensions.xsd http://www.vmware.com/vcloud/v1.5 http://xx.xx.xxx.xxx/api/v1.5/schema/master.xsd"
    name="FaultTolerance" type="application/vnd.vmware.admin.service+xml"
    operationKey="FaultTolerance">
    <vmext:Namespace>FaultTolerance</vmext:Namespace>
    <vmext:Enabled>false</vmext:Enabled>
    <vmext:RoutingKey>faulttolerance</vmext:RoutingKey>
    <vmext:Priority>10</vmext:Priority>
    <vmext:Exchange>availability</vmext:Exchange>
    <vmext:ApiFilters>
      <vmext:ApiFilter>
       <vmext:UrlPattern>/api/vApp/.*/ft/.*</vmext:UrlPattern>
      </vmext:ApiFilter>
    </vmext:ApiFilters>
    </vmext:Service>

    --Anurag

    Reply
    0 Kudos
    Todor_Todorov
    Hot Shot
    Hot Shot
    Jump to solution

    When modifying objects, you should specify the URL of the object. It's in the form: https://xxx.xx.xxx.xx/api/admin/extension/service/<uuid>

    This URL is returned when doing the POST operation against the /service URL.

    Regards,

    Todor Todorov

    Reply
    0 Kudos
    anuragvr
    Enthusiast
    Enthusiast
    Jump to solution

    Awesome, thanks for instant reply.

    My problem is resolved thank you very much.

    -Anurag

    Reply
    0 Kudos