3 Replies Latest reply on Feb 12, 2008 3:48 AM by Nishan Naseer

    Using ProcessBuilder to start a new process from a servlet

    Tina Muehle Newbie

      Hi,

      we are using a webapp inside JBoss 4.2.2.GA. Sometimes we experienced a problem and the JBoss hanges up. So now we would like to start an external jar file for the specific problem, so if this process fails, JBoss remains intact. Inside a servlet we tried something like this:

      String[] args = new String[]{
       "java",
       "-jar",
       "ownext.jar"
       };
      
       ProcessBuilder processBuilder = new ProcessBuilder(args);
       Process proc = processBuilder.start();
      
       InputStream is = proc.getInputStream();
       logProcessorResult(proc.getErrorStream());
      
       int exitVal = proc.waitFor();
       ...
      


      Unfortunately we are now running into a classpath problem with the message "unable to access ownext.jar". We put the ownext.jar in jboss_dir/server/default/lib. How can we resolve this?

      Thx,

      Tina.