473,574 Members | 8,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JAVA IO Exception Create Process

14 New Member
Am writing a code for database backup....by backupservlet is as given below

i get the following exception

[#|2007-10-31T16:05:25.741 +0530|INFO|sun-appserver-pe8.2|employeet ransaction.DBBa ckupServlet|_Th readID=22;| About to execute the command exp hrms/manager file=C:\ET\ET\E mployeeTransact ion\build\web\b ackupDir\Weekly .dmp log=C:\ET\ET\Em ployeeTransacti on\build\web\lo gDir\Weekly.log |#]
[#|2007-10-31T16:05:25.803 +0530|WARNING|s un-appserver-pe8.2|javax.ent erprise.system. stream.err|_Thr eadID=22;|
java.io.IOExcep tion: CreateProcess: exp hrms/manager file=C:\ET\ET\E mployeeTransact ion\build\web\b ackupDir\Weekly .dmp log=C:\ET\ET\Em ployeeTransacti on\build\web\lo gDir\Weekly.log error=2
at java.lang.Proce ssImpl.create(N ative Method)
at java.lang.Proce ssImpl.<init>(P rocessImpl.java :81)
at java.lang.Proce ssImpl.start(Pr ocessImpl.java: 30)
at java.lang.Proce ssBuilder.start (ProcessBuilder .java:451)
at java.lang.Runti me.exec(Runtime .java:591)
at java.lang.Runti me.exec(Runtime .java:429)
at java.lang.Runti me.exec(Runtime .java:326)
at employeetransac tion.DBBackupSe rvlet.processRe quest(DBBackupS ervlet.java:183 )
at employeetransac tion.DBBackupSe rvlet.doGet(DBB ackupServlet.ja va:307)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:747)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:860)
at sun.reflect.Gen eratedMethodAcc essor2305.invok e(Unknown Source)
at sun.reflect.Del egatingMethodAc cessorImpl.invo ke(DelegatingMe thodAccessorImp l.java:25)
at java.lang.refle ct.Method.invok e(Method.java:5 85)
at org.apache.cata lina.security.S ecurityUtil$1.r un(SecurityUtil .java:249)
at java.security.A ccessController .doPrivileged(N ative Method)
at javax.security. auth.Subject.do AsPrivileged(Su bject.java:517)
at org.apache.cata lina.security.S ecurityUtil.exe cute(SecurityUt il.java:282)
at org.apache.cata lina.security.S ecurityUtil.doA sPrivilege(Secu rityUtil.java:1 65)
at org.apache.cata lina.core.Appli cationFilterCha in.internalDoFi lter(Applicatio nFilterChain.ja va:257)
at org.apache.cata lina.core.Appli cationFilterCha in.access$000(A pplicationFilte rChain.java:55)
at org.apache.cata lina.core.Appli cationFilterCha in$1.run(Applic ationFilterChai n.java:161)
at java.security.A ccessController .doPrivileged(N ative Method)
at org.apache.cata lina.core.Appli cationFilterCha in.doFilter(App licationFilterC hain.java:157)
at org.apache.cata lina.core.Stand ardWrapperValve .invoke(Standar dWrapperValve.j ava:263)
at org.apache.cata lina.core.Stand ardPipeline.inv oke(StandardPip eline.java:551)
at org.apache.cata lina.core.Stand ardContextValve .invokeInternal (StandardContex tValve.java:225 )
at org.apache.cata lina.core.Stand ardContextValve .invoke(Standar dContextValve.j ava:173)
at org.apache.cata lina.core.Stand ardPipeline.inv oke(StandardPip eline.java:551)
at org.apache.cata lina.core.Stand ardHostValve.in voke(StandardHo stValve.java:17 0)
at org.apache.cata lina.core.Stand ardPipeline.inv oke(StandardPip eline.java:551)
at org.apache.cata lina.core.Stand ardEngineValve. invoke(Standard EngineValve.jav a:132)
at org.apache.cata lina.core.Stand ardPipeline.inv oke(StandardPip eline.java:551)
at org.apache.cata lina.core.Conta inerBase.invoke (ContainerBase. java:933)
at org.apache.coyo te.tomcat5.Coyo teAdapter.servi ce(CoyoteAdapte r.java:189)
at com.sun.enterpr ise.web.connect or.grizzly.Proc essorTask.doPro cess(ProcessorT ask.java:604)
at com.sun.enterpr ise.web.connect or.grizzly.Proc essorTask.proce ss(ProcessorTas k.java:475)
at com.sun.enterpr ise.web.connect or.grizzly.Read Task.executePro cessorTask(Read Task.java:371)
at com.sun.enterpr ise.web.connect or.grizzly.Read Task.doTask(Rea dTask.java:264)
at com.sun.enterpr ise.web.connect or.grizzly.Task Base.run(TaskBa se.java:281)
at com.sun.enterpr ise.web.connect or.grizzly.Work erThread.run(Wo rkerThread.java :83)
[#|2007-10-31T16:05:25.803 +0530|SEVERE|su n-appserver-pe8.2|employeet ransaction.DBBa ckupServlet|_Th readID=22;|stat e is null : false ::: state.isBusy() : false Exception in closing database connections.|#]

Expand|Select|Wrap|Line Numbers
  2.  Runtime s=Runtime.getRuntime();
  4.     //Process o=null;
  5.         String command = "exp "+usr+"/"+pwd+" file="+backupRealPath+backupFileName+" log="+logRealPath+logFileName;
  7.         java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.INFO," About to execute the command " + command);
  8.         try
  9.         {
  10.            Process o=s.exec(command);
  11.              java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.INFO,o.toString()+ " Process has started " );
  12.             // any error message?
  13.             StreamGobbler errorGobbler = new StreamGobbler(o.getErrorStream(), "ERROR");            
  14.             // any output?
  15.             StreamGobbler outputGobbler = new StreamGobbler(o.getInputStream(), "OUTPUT" );
  17.             // kick them off
  18.             errorGobbler.start();
  19.             outputGobbler.start();
  21.             // any error???
  22.             int exitVal = o.waitFor();
  23.             java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.INFO," Exit Value = " + exitVal);
  24.             errBuff = errorGobbler.getOutPut();
  25.             outBuff = outputGobbler.getOutPut();
  26.             servletOutputStream.println("The command "+command+" has been submitted.<br>");
  27.             servletOutputStream.println(errBuff.toString());
  28.             servletOutputStream.println(outBuff.toString());
  29.             if (exitVal == 0)
  30.                 servletOutputStream.println("The backup completed successfully.<br>");
  31.             else
  32.                 servletOutputStream.println("The backup terminated with error code "+exitVal+".<br>");
  33.         //   fos.flush();
  34.        //    fos.close();
  36.         } catch (Throwable t)
  37.           {
  38.             t.printStackTrace();
  39.           }                        
  41.           servletOutputStream.flush();
  42.           servletOutputStream.close();
My streamgobbler is
Expand|Select|Wrap|Line Numbers
  2. /*
  3.  * StreamGobbler.java
  4.  *
  5.  * Created on October 9, 2007, 9:53 PM
  6.  *
  7.  * To change this template, choose Tools | Template Manager
  8.  * and open the template in the editor.
  9.  */
  11. package employeetransaction;
  13. /**
  14.  *
  15.  * @author kvishwas
  16.  */
  17. import java.util.*;
  18. import java.io.*;
  19. import javax.servlet.ServletOutputStream;
  20. import org.apache.naming.java.javaURLContextFactory;
  22. /**
  23.  *
  24.  * @author kvishwas
  25.  */
  26. public class StreamGobbler extends Thread {
  28.     /** Creates a new instance of StreamGobbler */
  29.     InputStream is;
  30.     String type;
  31.     StringBuffer out;
  32.     OutputStream os;
  34.     public StreamGobbler(InputStream is, String type)
  35.     {
  36.         this.is = is;
  37.         this.type = type;
  38.         this.out = new StringBuffer();
  41.         }
  44.     /* 
  45.     public StreamGobbler(InputStream is, String type,OutputStream redirect)
  46.     {
  47.         this.is = is;
  48.         this.type = type;
  49.         this.os = redirect;
  50.     }
  51.     */
  53.     public void run()
  54.     {
  55.         try
  56.         {
  57.             PrintWriter pw =null;
  58.             if(os!=null)
  59.                 pw=new PrintWriter(os);
  61.             InputStreamReader isr = new InputStreamReader(is);
  62.             BufferedReader br = new BufferedReader(isr);
  63.             String line=null;
  64.             while ( (line = br.readLine()) != null)
  65.             {    
  66.                /* if(pw != null)
  67.                     pw.println(line);*/
  68.                 System.out.println(type + ">" + line);
  69.                String line1 = line + "<br>";
  70.                 out.append(line1);
  71.             }    
  72.               /*  if(pw != null)
  73.                     pw.flush();*/
  74.          } catch (IOException ioe)
  75.          {
  76.             ioe.printStackTrace();  
  77.          }
  78.     }
  80.     public StringBuffer getOutPut()
  81.     {
  82.         return out;
  83.     }
  86. }
Oct 31 '07 #1
1 4448
13,262 MVP
What happens when you run the command

Expand|Select|Wrap|Line Numbers
  1. exp hrms/manager file=C:\ET\ET\EmployeeTransaction\build\web\backupDir\Weekly.dmp log=C:\ET\ET\EmployeeTransaction\build\web\logDir\Weekly.log
manually on the console?
Nov 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: ptaz | last post by:
Hi I'm trying to run a web page but I get the following error. Ca anyone please tell me a solution to this. Thanks Ptaz HTTP Status 500 - type Exception report
by: Srinadh | last post by:
Hi all, We have files with about 20 to 30 fields per row. We are trying to update such files with about 60 rows as contiguous data in a CLOB field. It passes through. But when we try updating files with about 60 to 200 rows, we get the
by: Peter | last post by:
I am using CreateProcessWithLogonW to run an external application, the problem I am having is that the C# program does not wait until the external program finishes running before continuing. The external program is a console application and it does not interact with users, how can I make my C# program wait until the program initiated by...
by: thorax | last post by:
I'm having problems running a release build of an application. The application is a native C++ .NET 2003 MFC application which links to a number of other DLLs, one of which is mixed (SLGSE.dll) (VB.NET/C++). Most of the DLLS are statically linked to the main exe (directly or indirectly) but a few are dynamically linked at runtime. When...
by: SStory | last post by:
I have a service which has no U/I, that I use to ensure a certain tray application is running. I would like for the service which runs under "Local System", to create the process as a normal app for the user currently logged in.... Is there a way to do it.... or is there a way for a winforms app launched by a user to communicate with a...
by: tejineha | last post by:
i want to knw if any particular exception exists that is to be written in catch block when a field gets a same value for the field that is defined as primary key..as primary key cnot have same value... basicaly i donot want to print the error statement as given by server.
by: audiokarate | last post by:
Alright this is my hw problem. I am a newb with java and I am having a hard time coding. This is the problem and at the bottom is what I have so far. Any pointers in the right direction is greatly appreciated. When launched, your program will allow multiple voters to pick the presidential candidate of their choice. The program will tally...
by: ganeshp | last post by:
hi All, I have crated a thread and in that tread i have created one more thread? is it ok to do this ? i am not getting any errors, regards, Ganesh
by: mdshafi01 | last post by:
Hello my code is here. here i am unable to execute my perl programs . please help in this regards, #!/usr/bin/perl use warnings; use strict;
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.