2 Replies Latest reply on Aug 17, 2007 3:21 AM by dilip_anant

    Spawning processes from JBoss App Server

    dilip_anant

      Hi There,

      I am new to Jboss and this is my first post in the forum.

      We have an application that does data collection from disparate systems and checks for their availability. My application checks if a system is up or not by pinging the IP and checking if certain services are running on machines by doing a command line check, for e.g doing a
      sc \\servername query W3SVC to check if the IIS server is up or not. The code for the data collection is in Java and the data is used to view a dashboard. I was able to ping different machines and was able to get responses.

      The problem is that in some cases my application gives me a negative result for a ping whereas i can see that iam able to get a response from the command prompt. I tried to understand why this was occuring and tried deploying the application in other secure systems but to no avail. Finally i thought that it could be some issue related to the JBoss security. In that hope i write here.

      Is there any Jboss security policy that restricts new command processes (like ping, sc\\ query) from being spawned?

      I would appreciate if anyone could help me with this.

      thanks,
      Dilip

        • 1. Re: Spawning processes from JBoss App Server
          genman

          No, not by default.

          You might want to post your code. My advice is to come up with a baseline implementation that works (perhaps just calls "ping 127.0.0.1") then develop the code into the more complex commands you need to run.

          • 2. Re: Spawning processes from JBoss App Server
            dilip_anant

            This is the code snippet that does the job:

            Runtime r = Runtime.getRuntime();
            serverIPOrHostName = (String) bfuParameters.get(SERVERIP_HOSTNAME);
            service = (String) bfuParameters.get(SERVICE_NAME);

            String cmd = SERVICECHECK + SYMBOL + serverIPOrHostName + QUERY + service;
            p = r.exec(cmd);

            inp = p.getInputStream();
            byte[] dataInput = new byte[320];
            inp.read(dataInput);
            String inputData = new String(dataInput);

            //Logger added to read the service response.
            logger.error(inputData);
            //Checks for specified sequence of characters in the string and
            //returns boolean.
            if (inputData.contains(SERVICE_RUNNING)) {
            result = 1;
            } else {
            result = 0;
            }