Two Laptop Bag*
The moose likes Tomcat and the fly likes Tomcat is stopping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat is stopping" Watch "Tomcat is stopping" New topic
Author

Tomcat is stopping

priya pratheepp
Ranch Hand

Joined: Apr 02, 2008
Posts: 59
Hi friends

When i run the below program tomcat is stopping...pls help me

Using mulipart request i am copying a file from local mac to serer and doing some process there

<%@page language="java" import="java.io.*,java.util.*,com.oreilly.servlet.MultipartRequest"%>


<%

try
{//1
response.setContentType("text/html");
MultipartRequest multi = new MultipartRequest(request, "/var/tomcat/webapps/ROOT/invoiceline/");
out.println("<HTML>");
out.println("<HEAD><TITLE></TITLE></HEAD>");
out.println("<BODY>");

Enumeration files = multi.getFileNames();
while (files.hasMoreElements())
{//2
String name = (String) files.nextElement();
String filename = multi.getFilesystemName(name);
String type = multi.getContentType(name);
File f = multi.getFile(name);

//String s3=args[0];
String path = "/var/tomcat/webapps/ROOT/invoiceline/" + filename;
String s3 = "/var/tomcat/webapps/ROOT/invoiceline/" + filename;

// String outfile=args[1];
String filename_out = multi.getFilesystemName(name)+"_out";
String outfile = multi.getFilesystemName(name)+"_out";
boolean flag1 = false;



boolean flag = true;
BufferedWriter bufferedwriter = new BufferedWriter(new FileWriter(outfile, flag));
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(new FileInputStream(s3)));
String invoiceno="",invoiceold="";
int lineno1 =10;
int lineno =0;

// Read a line of text
while (!flag1)
{
String s5 = bufferedreader.readLine();
if(s5 == null)
{
flag1 = true;
} else
{
int id = 0; int tokenCount;
String words[] = new String [500];
StringTokenizer st;
st = new StringTokenizer(s5,"\t");
tokenCount = st.countTokens();
while (st.hasMoreTokens()) // make sure there is stuff to get
{
words[id] = st.nextToken();
id++;
}

invoiceno=words[6];
if(invoiceold.equals(invoiceno))
{
lineno=lineno+10;
bufferedwriter.write( words[0]+"\t"+words[1]+"\t"+words[2]+"\t"+words[3]+"\t"+words[4]+"\t"+words[5]+"\t"+words[6]+"\t"+lineno+"\t"+words[8]+"\t"+words[9]+"\t"+words[10]+"\t"+words[11]+"\t"+words[12]+"\t"+words[13]+"\t"+words[14]+"\t"+words[15]+"\t"+words[16]+"\t"+words[17]+"\n");
}
else
{
lineno =10;
bufferedwriter.write( words[0]+"\t"+words[1]+"\t"+words[2]+"\t"+words[3]+"\t"+words[4]+"\t"+words[5]+"\t"+words[6]+"\t"+lineno1+"\t"+words[8]+"\t"+words[9]+"\t"+words[10]+"\t"+words[11]+"\t"+words[12]+"\t"+words[13]+"\t"+words[14]+"\t"+words[15]+"\t"+words[16]+"\t"+words[17]+"\n");
}
invoiceold=words[6];
bufferedwriter.flush();
}//elsepart
}//while part

// Close our input stream
bufferedreader.close();
bufferedwriter.close();
}
}
// Catches any error conditions
catch (IOException e)
{
System.err.println ("Unable to read from file");
System.exit(-1);
}




%>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

If you stop the program:

you shouldn't be surprised that it stops.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
priya pratheepp
Ranch Hand

Joined: Apr 02, 2008
Posts: 59
Hi

Thank you .Problem solved

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat is stopping
 
Similar Threads
HTTP Status 405
servlets-urgent pl reply
How to upload a file using servlets to a webserver
Problem in file uploading
problem retrieving from database