This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat is stopping

 
priya pratheepp
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you stop the program:

you shouldn't be surprised that it stops.
 
priya pratheepp
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Thank you .Problem solved

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic