Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Error while installing component on a host via Ambari REST API

avatar

I am trying to install a component on a host via API:

$ curl -u admin -i -H "X-Requested-By:ambari" -X PUT \
  -d '{"HostRoles": {"state": "INSTALLED"}}' \
  http://<ambari>:8080/api/v1/clusters/clustername/hosts/node1.hortonworks.com/host_components/ZOOKEEP...

... getting error:

Caused by: java.lang.NullPointerException
at org.apache.ambari.server.state.ConfigHelper.getPropertyValuesWithPropertyType(ConfigHelper.java:489)
at org.apache.ambari.server.controller.AmbariManagementControllerImpl.createHostAction(AmbariManagementControllerImpl.java:1934)
at org.apache.ambari.server.controller.AmbariManagementControllerImpl.doStageCreation(AmbariManagementControllerImpl.java:2336)
at org.apache.ambari.server.controller.AmbariManagementControllerImpl.addStages(AmbariManagementControllerImpl.java:2593)
at org.apache.ambari.server.controller.internal.HostComponentResourceProvider.updateHostComponents(HostComponentResourceProvider.java:612)
at org.apache.ambari.server.controller.internal.HostComponentResourceProvider$4.invoke(HostComponentResourceProvider.java:753)

The operation fails with "Server Error"

Any ideas?

1 ACCEPTED SOLUTION

avatar
Rising Star

1. Why not use Blueprint? Or are you trying to add a service to an existing cluster?

2. Do you have cluster-env with smokeuser defined? It looks like ZooKeeper install fails without it.

curl -u admin:admin -i -H "X-Requested-By: ambari -X PUT -d '{"Clusters" : {"desired_configs": {"type": "cluster-env","tag": "20150924","properties": {"smokeuser":"ambari-qa"}}}}' http://127.0.0.1:8080/api/v1/clusters/Sandbox

should get you thru, but you might want to look at an existing working cluster and define all the standard properties that come in cluster-env.

View solution in original post

11 REPLIES 11

avatar
Rising Star

Did adding smokeuser work, @wgonzalez@hortonworks.com?

avatar
New Member

Are you getting an error when trying to install a component or service?

$ curl -u admin -i -H "X-Requested-By:ambari"-X PUT -d '{"HostRoles": {"state": "INSTALLED"}}' http://<ambari>:8080/api/v1/clusters/clustername/hosts/node1.hortonworks.com/host_components/ZOOKEEP...

The above API will fail because ZOOKEEPER is not the name of a host component. It should either be ZOOKEEPER_CLIENT or ZOOKEEPEER_SERVER. On the trunk build I get a NoSuchResourceException when using ZOOKEEPER as the component name. With the correct component name, the API succeeded.

The API to install the ZOOKEEPER service was successful:

curl -u admin:admin -i -H "X-Requested-By: ambari"-X PUT -d '{"ServiceInfo": {"state" : "INSTALLED"}}' http://127.0.0.1:8080/api/v1/clusters/Sandbox/services/ZOOKEEPER