9 Replies Latest reply on Sep 3, 2014 4:00 AM by virchete

    Rest API: POST Resource error

    virchete

      Hi,

       

      I am a developer of the jboss overlord project. We have an integration of our project with JON. Here are the installation steps we follow:

       

      https://developer.jboss.org/wiki/UseDtgovToDeployAnApplicationOnAJonrhqTarget 172.17.0.5

       

      From our project we call the jon rest api:

       

      https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Operations_Network/3.2/html/RestAPI/index.html#CreateCBRresourceRequest

       

      In the POST resource call there is a mistake. I imagine something is missing in the json createCBRresourceRequest  data:

       

      JSON:

      {"resourceName":"dtgov-demos-project-service-impl-1.4.0-20140901.111842-1.war","resourceId":0,"typeName":"Deployment","pluginName":null,"parentId":10118,"status":null,"typeId":0,"ancestry":null,"location":null,"description":null,"pluginConfig":{"path":"deployment"},"resourceConfig":{"runtimeName":"dtgov-demos-project-service-impl-1.4.0-20140901.111842-1.war"}}

       

      TRACE LOG:

       

      HTTP/1.1 404 Not Found
      Server=Apache-Coyote/1.1
      Content-Type=application/json
      Transfer-Encoding=chunked
      Date=Mon, 01 Sep 2014 11:19:39 GMT

       

      {
          "message": "ResourceType with name [Deployment] and plugin [null] not found"
      }

       

      In the JON instance, there is a jboss eap + switchyard instance that is managed.

       

      Thanks

      David

        • 1. Re: Rest API: POST Resource error
          lkrejci

          Each resource in RHQ must have a type. The resource type in the request above is identified by its name AND the plugin its coming from. The pluginName is not optional and must be provided. In case you're deploying your application to AS7-based server, the plugin would be "JBossAS7", EAP5 is "JBossAS5", EAP4 is "JBossAS", tomcat is "Tomcat", etc.

          • 2. Re: Rest API: POST Resource error
            virchete

            In our case, in the jon server it is added a group that contains an instance of Jboss eap 6.1 + Switchyard.

             

            My question here, is:

             

            Should be JBossAS7 the plugin name using Jboss eap6.1?

            Should be included something(like any plugin) in the jboss eap 6.1 which is being managed by the Jon Server?

            • 3. Re: Rest API: POST Resource error
              lkrejci

              For JBoss EAP 6.1, the plugin name is indeed JBossAS7.

               

              There is nothing needed inside the EAP server for it to be manageable by JON. The only thing we require is to be able to connect to the management endpoint of the EAP server. This can be configured on the JON side (the credentials or possibly SSL details).

              • 4. Re: Rest API: POST Resource error
                virchete

                Including the change you told me then, the response I receive from jon server is:

                 

                HTTP/1.1 302 Moved Temporarily
                Server=Apache-Coyote/1.1
                Location=http://localhost:7080/rest/resource/creationStatus/10011
                Content-Type=application/json
                Content-Length=45
                Date=Mon, 01 Sep 2014 15:56:08 GMT

                 

                Creation is running - please check back later

                 

                Then I think the creation of the resource has been done successfully.

                • 5. Re: Rest API: POST Resource error
                  virchete

                  But in the logs of jon, in the agent logs and in the jboss eap 6.1 I do not say anything.

                  Also taking a look in the jon admin console, I can not see anything inside of the inventory tag of the eap server.

                   

                  jon_group_view.jpeg

                  jon_group_view_detailed.jpeg

                   

                  In the screenshots you can see that there is like a red icon about the availability of the server, which maybe is a problem.

                  • 6. Re: Rest API: POST Resource error
                    lzoubek

                    Yes, it is a problem. JON must be able to manage your EAP in order to perform deployment. You can run Install a management user operation on your EAP resource, which does basically the same as($EAP6_HOME/bin/add-user.sh and then, on Inventory tab of your EAP go to Connection Settings and put correct credentials. If your EAP is running, it should get green and there should be some child resources discovered.

                    • 7. Re: Rest API: POST Resource error
                      lkrejci

                      In the screenshot, you're looking at compatible groups. Compatible groups are just groups of the resources of the same type. Were you expecting a new server to appear in that group? If so, you need to import that server from the discovery queue into RHQ's inventory and then add it to the compatible group manually. Alternatively, you can create a dynagroup definition that will automatically add the server to the group once it's imported into the inventory and the dynagroup is "recomputed" (which happens on a schedule).

                       

                      If the screenshot was meant to show that the server you're trying to deploy to is considered down, then you need to make sure that RHQ can connect to and authenticate with the EAP server. That's what I meant by "The only thing we require is to be able to connect to the management endpoint of the EAP server. This can be configured on the JON side (the credentials or possibly SSL details)." in my previous comment and what Libor described in more detail in the comment above.

                      • 8. Re: Rest API: POST Resource error
                        virchete

                        Hi Lukas! I put you the 2 screenshots to show you that the server is considered down. I have already done the steps you put in the first paragraph. Then I imagine I should include a management user in the EAP resource.

                         

                        I ll try and let you know.

                         

                        Thanks for the quick response.

                        • 9. Re: Rest API: POST Resource error
                          virchete

                          Lukas, Thanks a lot. I have tested and it works perfectly.