dcsimg
I have a problem while uploading 10MB file to the Server....
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sandhya_Sree
Posted On:   Wednesday, July 31, 2002 08:43 PM

Iam Uploading a file from a stand alone client program to the server thru a ListnerServlet .. In the Cient side the whole file is written to the OutputStream.. and the client opens the connection to the server using URL and HttpURLConnection. The code is as follows 1 FileInputStream instream =new FileInputStream("MIMESOAP.xml"); 2 URL url = new URL(http://192.168.32.10:8001/mhbweb/mhb/SOAPListenerServlet); 3 HttpURLConnection httpURL = (HttpURLConnection)(url.openConnection()); 4 httpURL.setRequestMethod("POST"); 5 httpURL.setDoOutput(true); 6 httpURL.setDoInput(true); 7 OutputStream    More>>


Iam Uploading a file from a stand alone client program
to the server thru a ListnerServlet ..


In the Cient side the whole file is written to the
OutputStream.. and the client opens the connection to the server using
URL and HttpURLConnection.

The code is as follows


1 FileInputStream instream =new FileInputStream("MIMESOAP.xml");

2 URL url = new URL(http://192.168.32.10:8001/mhbweb/mhb/SOAPListenerServlet);

3 HttpURLConnection httpURL = (HttpURLConnection)(url.openConnection());

4 httpURL.setRequestMethod("POST");

5 httpURL.setDoOutput(true);

6 httpURL.setDoInput(true);

7 OutputStream op= httpURL.getOutputStream();

//wrting the inputstream to the bufferedoutputstream

8 BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(op, 20000000);

9 int j=0;

10 while((j = instream.read()) != -1)

11 bufferedoutputstream.write(j);

12 bufferedoutputstream.flush();

13 bufferedoutputstream.close();

14 System.out.println("ResponseCode..."+httpURL.getResponseCode());

15 httpURL.getResponseCode();

16 op.close();

17 instream.close();




for the file of size less than 10MB its reading and writing
and is able to upload the file to the server...


But if the file size exceeds 10MB,its reading the
file and writing to the httpUTL outputstream but unable
to upload it to the server, i mean its not getting the
response code from the server its throwing exception
at Line Number14 in the above given code and the exception
in the client console
is as follows:


Exception in MAIN of Client....http://localhost:7001/mhbweb/mhb/SOAPListenerServ
let java.io.FileNotFoundException: http://localhost:7001/mhbweb/mhb/SOAPListenerServ
let at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:574) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:230)
at java.net.HttpURLConnection.getResponseMessage(HttpURLConnection.java:264)at Client.main(Client.java:14)




In the Weblogic Server COnsole it giving
the following error

<[WebAppServletContext(1691146,mhbWARrel2_0,/mhbWARrel2_0)]
Servlet failed with Exceptionjava.lang.OutOfMemoryError
< >



can any one help in soving this problem?




Thanks in Advance

Sandhya Sree

   <<Less
About | Sitemap | Contact