Search code examples
javaapihyperic

Hyperic HQ Api getting an agent


I'm a newbie with Hyperic but I'm so happy about discovering this tool it's very powerful and I think it can be adapted perfectly to my necessities. I have a problem using the API. I'm trying to use it through java directly and I'm trying to get my agent because I need it in further operations.

If I use the directly from command line it works perfectly.

./hqapi.sh agent list --host localhost --port 7080 --user hqadmin --password hqadmin --secure false



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<AgentsResponse>

    <Status>Success</Status>

    <Agent id="10001" address="127.0.1.1" port="2144" version="4.4.0"         unidirectional="false"/>

</AgentsResponse>

But when I try to get this agent in Java I get an error that I don't know how to solve.

AgentsResponse agentsResponse = agentApi.getAgents();

  if(agentsResponse.getStatus() != ResponseStatus.SUCCESS){
  log.info("Fail retrieving agent " + agentsResponse.getError().getReasonText());
  log.info("More info " + agentsResponse.getError().getErrorCode());

Fail retrieving agent Unable to deserialize result More info UnexpectedError

I'm using hyperic 4.4.0 so I'm using HQAPI V3.2. My java class is running inside Apache ServiceMix 4.5.3 and I added this library to my Maven repository using the .jar that is provided.

Any help will be so appreciated.

Thank you very much to everybody.


Solution

  • I solved it. After a while I noticed that .xsd file that builds java objects from XML file was not included inside my bundle.