Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

CM API Java method getClientConfig causes run time error

Highlighted

CM API Java method getClientConfig causes run time error

New Contributor

I'm using the CM API Java Bindings in a Scala app to control/automate various aspects of cluster management.

 

So far all the API methods I've tried have worked as advertised.

 

However, I'm having issues downloading configuration data using the getClientConfig method.

 

Here's a code snippet which illustrates the problem:

 

    def dumpConfig(myCluster: ServicesResourceV13, myService: String) = {
        myCluster.listRoleTypes(myService).asScala.toList.foreach(
            roleType =>
                logger.info(" " + roleType.toString)
        )

 

        if (myService == "hdfs")
            logger.info(myCluster.getClientConfig(myService).getContentType.toString)
    }

 

The roles are accessed successfully but when the getClientConfig method gives this run-time error:

 

    [main] WARN org.apache.cxf.jaxrs.provider.DataSourceProvider - Unsupported DataSource class:     org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource
    [main] ERROR org.apache.cxf.jaxrs.utils.JAXRSUtils - Problem with reading the data, class org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource, ContentType: application/octet-stream.
    Exception in thread "main" javax.ws.rs.client.ResponseProcessingException: Problem with reading     the data, class org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource, ContentType:     application/octet-stream.
    at org.apache.cxf.jaxrs.impl.ResponseImpl.reportMessageHandlerProblem(ResponseImpl.java:439)
    at org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:379)
    at org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:524)
    at org.apache.cxf.jaxrs.client.ClientProxyImpl.handleResponse(ClientProxyImpl.java:870)
    at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:764)
    at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:235)
    at com.sun.proxy.$Proxy35.getClientConfig(Unknown Source)
    at CMAPI$.dumpConfig(CMAPI.scala:107)
    at CMAPI$$anonfun$main$8.apply(CMAPI.scala:331)
    at CMAPI$$anonfun$main$8.apply(CMAPI.scala:328)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at CMAPI$.main(CMAPI.scala:327)
    at CMAPI.main(CMAPI.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
    Caused by: javax.ws.rs.WebApplicationException: HTTP 500 Internal Server Error
    at org.apache.cxf.jaxrs.utils.ExceptionUtils.toWebApplicationException(ExceptionUtils.java:106)
    at org.apache.cxf.jaxrs.provider.DataSourceProvider.readFrom(DataSourceProvider.java:68)
    at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1374)
    at org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:370)
    ... 16 more

 

I can't see what I'm doing wrong and any help with this would be much appreciated. 

 

Don't have an account?
Coming from Hortonworks? Activate your account here