4 Replies Latest reply on Sep 24, 2010 10:43 AM by John Sanda

    Creating resources using the new JAVA API

    Kirk Maskalenko Newbie

      Just downloaded the new JOPR 2.3 and trying to register a resource using the Java APIs (ResourceFactoryManager). I am able to connect OK and search and delete using ResourceManagerRemote but creating resource fails silently, No error is returned. I do see log messaging about a failure ("No resource key specified for failed request") but that is not an argument in the API call. Is additional documentation or examples available in using the APIs?

      Kirk

        • 1. Re: Creating resources using the new JAVA API
          Pete ZZ Newbie

          I have a similar issue using JON 2.4.

          Following the  script from this POC http://community.jboss.org/wiki/JON23ScriptedGroupDeploymentsUsingTheCLIAPI

          i tried to deploy a war file to JBoss AS server

            var deployConfig = new Configuration();
                  deployConfig.put( new PropertySimple("deployDirectory", "deploy"));
                  deployConfig.put( new PropertySimple("deployZipped", "true"));
                  deployConfig.put( new PropertySimple("createBackup", "false"));

          and the script ran successfully but from the "History of create child resource requests" section of the JON console it has:

           

          org.rhq.core.util.exception.WrappedRemotingException:javax.persistence.NoResultException: No entity found for query -> org.rhq.core.util.exception.WrappedRemotingException:No entity found for query

           

           

          Web Application (WAR)No resource key specified for failed requestFailure
          • 2. Re: Creating resources using the new JAVA API
            Heiko Rupp Master

            The source snippet you posted is not enough to judge what may be going wrong. Can you please post the full source?

            • 3. Re: Creating resources using the new JAVA API
              John Sanda Apprentice

              The create/delete methods in ResourceFactoryManagerRemote are asynchronous in that they use a fire and forget model. They send the request down to the agent and immediately return. As part of those operations though, they log an entry onto their respective audit trails. In the case of creating a resource, this comes in the form of a CreateResourceHistory object. In the case of deleting a resource, this comes in the form of a DeleteResourceHistoryObject. When the operation completes on the agent machine, the agent calls back to the server updating the history object with the status of the operation. This is a common work flow pattern throughout RHQ.

               

              I actually brought up this very issue on the rhq-devel mailing list. Earlier this morning I committed changes (not yet pushed to the remote repo though) so that the create/delete operations in ResourceFactoryManagerRemote return the history objects. With a reference to the history, it will be possible to poll the server for the status of the operation. The history objects also include an error message field that should get populated with a stacktrace or other error message should the operation fail.

               

              - John

              • 4. Re: Creating resources using the new JAVA API
                John Sanda Apprentice

                Hi Pete,

                 

                Make sure that you specify the correct  resource type id. I have seen this error in scripts when the resource  type id for the new resource being deployed is not specified correctly.  So if you are deploying a war file to a JBoss AS instance you need to  specify the resource type id of the "Web Application (WAR)" resource  type and not the "JBossAS" type.

                 

                If this is in fact the  problem you encountered like I think it is, then the exception is  coming out of ContentManagerBean where it trying to determine the  underling ResourceType of the package being deployed. Maybe I can look  at providing some better error messages in this code.

                 

                - John