2 Replies Latest reply: May 22, 2013 9:21 AM by jtahlborn RSS

    Peculiar tomcat out of memory problem..

    919316
      I have this peculiar situation. I have tomcat unzipped to a certain folder. When i start 'catalina.bat' from command line, everything is fine. But i actually want to start tomcat from within my application. I have tried using both Runtime.exec and ProcessBuilder but when i do, tomcat just runs out of memory... i watched task manager closely.. when i start tomcat from commandline, tomcat[in task manager it is java.exe] takes about 37mb but once i start it from within the application or in the ide(Netbeans), this version [also java.exe] just starts from zero, to 50, 100, 200 and stops around 280mb and tomcat doesnt respond anymore.. Sample code is shown below:

      //using Runtime.exec

      Runtime rt = Runtime.getRuntime();
      Process child = rt.exec("C:\\Program Files (x86)\\Scoolware\\apache-tomcat-7.0.40-windows-x86\\apache-tomcat-7.0.40\\bin"+"\\startup.bat");
      child.waitFor();

      //using ProcessBuilder
      ProcessBuilder builder = new ProcessBuilder("C:\\Program Files (x86)\\Scoolware\\apache-tomcat-7.0.40-windows-x86\\apache-tomcat-7.0.40\\bin"+"\\startup.bat");
      builder.redirectOutput(Redirect.INHERIT);
      Process process = builder.start();

      Help would be highly appreciated.. Thanks