i get the following exception
[#|2007-10-31T16:05:25.741+0530|INFO|sun-appserver-pe8.2|employeetransaction.DBBackupServlet|_ThreadI D=22;| About to execute the command exp hrms/manager file=C:\ET\ET\EmployeeTransaction\build\web\backup Dir\Weekly.dmp log=C:\ET\ET\EmployeeTransaction\build\web\logDir\ Weekly.log|#]
[#|2007-10-31T16:05:25.803+0530|WARNING|sun-appserver-pe8.2|javax.enterprise.system.stream.err|_ThreadID =22;|
java.io.IOException: CreateProcess: exp hrms/manager file=C:\ET\ET\EmployeeTransaction\build\web\backup Dir\Weekly.dmp log=C:\ET\ET\EmployeeTransaction\build\web\logDir\ Weekly.log error=2
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java :451)
at java.lang.Runtime.exec(Runtime.java:591)
at java.lang.Runtime.exec(Runtime.java:429)
at java.lang.Runtime.exec(Runtime.java:326)
at employeetransaction.DBBackupServlet.processRequest (DBBackupServlet.java:183)
at employeetransaction.DBBackupServlet.doGet(DBBackup Servlet.java:307)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:747)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:860)
at sun.reflect.GeneratedMethodAccessor2305.invoke(Unk nown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(Se curityUtil.java:249)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject .java:517)
at org.apache.catalina.security.SecurityUtil.execute( SecurityUtil.java:282)
at org.apache.catalina.security.SecurityUtil.doAsPriv ilege(SecurityUtil.java:165)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:257)
at org.apache.catalina.core.ApplicationFilterChain.ac cess$000(ApplicationFilterChain.java:55)
at org.apache.catalina.core.ApplicationFilterChain$1. run(ApplicationFilterChain.java:161)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:263)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:551)
at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:225)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:173)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:551)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:170)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:551)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:132)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:551)
at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:933)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:189)
at com.sun.enterprise.web.connector.grizzly.Processor Task.doProcess(ProcessorTask.java:604)
at com.sun.enterprise.web.connector.grizzly.Processor Task.process(ProcessorTask.java:475)
at com.sun.enterprise.web.connector.grizzly.ReadTask. executeProcessorTask(ReadTask.java:371)
at com.sun.enterprise.web.connector.grizzly.ReadTask. doTask(ReadTask.java:264)
at com.sun.enterprise.web.connector.grizzly.TaskBase. run(TaskBase.java:281)
at com.sun.enterprise.web.connector.grizzly.WorkerThr ead.run(WorkerThread.java:83)
|#]
[#|2007-10-31T16:05:25.803+0530|SEVERE|sun-appserver-pe8.2|employeetransaction.DBBackupServlet|_ThreadI D=22;|state is null : false ::: state.isBusy() : false Exception in closing database connections.|#]
Expand|Select|Wrap|Line Numbers
- Runtime s=Runtime.getRuntime();
- //Process o=null;
- String command = "exp "+usr+"/"+pwd+" file="+backupRealPath+backupFileName+" log="+logRealPath+logFileName;
- java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.INFO," About to execute the command " + command);
- try
- {
- Process o=s.exec(command);
- java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.INFO,o.toString()+ " Process has started " );
- // any error message?
- StreamGobbler errorGobbler = new StreamGobbler(o.getErrorStream(), "ERROR");
- // any output?
- StreamGobbler outputGobbler = new StreamGobbler(o.getInputStream(), "OUTPUT" );
- // kick them off
- errorGobbler.start();
- outputGobbler.start();
- // any error???
- int exitVal = o.waitFor();
- java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.INFO," Exit Value = " + exitVal);
- errBuff = errorGobbler.getOutPut();
- outBuff = outputGobbler.getOutPut();
- servletOutputStream.println("The command "+command+" has been submitted.<br>");
- servletOutputStream.println(errBuff.toString());
- servletOutputStream.println(outBuff.toString());
- if (exitVal == 0)
- servletOutputStream.println("The backup completed successfully.<br>");
- else
- servletOutputStream.println("The backup terminated with error code "+exitVal+".<br>");
- // fos.flush();
- // fos.close();
- } catch (Throwable t)
- {
- t.printStackTrace();
- }
- servletOutputStream.flush();
- servletOutputStream.close();
Expand|Select|Wrap|Line Numbers
- /*
- * StreamGobbler.java
- *
- * Created on October 9, 2007, 9:53 PM
- *
- * To change this template, choose Tools | Template Manager
- * and open the template in the editor.
- */
- package employeetransaction;
- /**
- *
- * @author kvishwas
- */
- import java.util.*;
- import java.io.*;
- import javax.servlet.ServletOutputStream;
- import org.apache.naming.java.javaURLContextFactory;
- /**
- *
- * @author kvishwas
- */
- public class StreamGobbler extends Thread {
- /** Creates a new instance of StreamGobbler */
- InputStream is;
- String type;
- StringBuffer out;
- OutputStream os;
- public StreamGobbler(InputStream is, String type)
- {
- this.is = is;
- this.type = type;
- this.out = new StringBuffer();
- }
- /*
- public StreamGobbler(InputStream is, String type,OutputStream redirect)
- {
- this.is = is;
- this.type = type;
- this.os = redirect;
- }
- */
- public void run()
- {
- try
- {
- PrintWriter pw =null;
- if(os!=null)
- pw=new PrintWriter(os);
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- String line=null;
- while ( (line = br.readLine()) != null)
- {
- /* if(pw != null)
- pw.println(line);*/
- System.out.println(type + ">" + line);
- String line1 = line + "<br>";
- out.append(line1);
- }
- /* if(pw != null)
- pw.flush();*/
- } catch (IOException ioe)
- {
- ioe.printStackTrace();
- }
- }
- public StringBuffer getOutPut()
- {
- return out;
- }
- }