FileWriter Problem, cannot write a file larger than 8K

Hi,
My servlet write 2 files. The problem is the second file I wrote cannot exceed 8K
PrintWriter os = new PrintWriter(new FileWriter("temp\\q0.dat"));
os.close();
PrintWriter os2 = new PrintWriter(new FileWriter("temp\\q1.html"));
I have the following write statement:
os2.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">");
os2.println("<HTML><HEAD><TITLE> Q1 </TITLE>");
os2.println("</HEAD><BODY><FORM METHOD=POST ACTION=\"\"><BLOCKQUOTE><TABLE border=\"0\">");
The problem is if I use this kind of statement, some println statement not appear in the destination file q1.html (those lines at bottom)
then if I turn these 3 statement and change to 1 print statement, more letter write to q1.html?
Pls tell me what's wrong with my program! Thank you

You didn't close the second PrintWriter after you finished using it?

Similar Messages

  • Servlet I/O Stream problem: cannot write into file, error 500

    I am a new Java developer and now, I am facing a problem regarding the error 500. I try to grab records from a table with a date as a constraint. There are two servlets involed: a) saveRecord and b) getRecord. Servlet getRecord will grab data from a database while another servlet, saveRecord will get the data from servlet getRecord and save it into a file. The codes are as below:
    =========================================================================================================================================
    // Servlet Name : saveRecord
    BufferedInputStream instr     = null;
    BufferedOutputStream outstr     = null;
    PostMethod http_post          = null;
    http_post = new PostMethod("getRecord");
    http_client.executeMethod(http_post);
    instr     = new BufferedInputStream(http_post.getResponseBodyAsStream());
    outstr     = new BufferedOutputStream(new FileOutputStream("c:\student.csv"), false));
    int byte_at;
    while (-1 != (byte_at = instr.read())) {
         outstr.write(byte_at);
    =========================================================================================================================================
    // Servlet Name : getRecord
    ServletOutputStream out     = response.getOutputStream();
    StringBuffer str_buf     = new StringBuffer();
    str_buf = generateStudentAc();
    out = response.getOutputStream();
    FileStream(out, response, str_buf);
    // Function Called
    private StringBuffer generateStudentAc() {
         StringBuffer str_buf = new StringBuffer();
         String date = "2000-01-01";
         statement = connection.createStatement();
         resultset = statement.executeQuery("SELECT NAME, ADDRESS FROM STUDENT WHERE DATE>'" + date + "';
         // Write column headers               
    str_buf.append("NAME,ADDRESS");
    String data_row;
    while (resultset.next()) {
              data_row = "\n";
              data_row += "\"" + resultset.getString("STUDENT") + "\"";
              data_row += ",\"" + resultset.getString("ADDRESS") + "\"";
              // Write row
              str_buf.append(data_row);
         return str_buf;
    // Function called
    private void FileStream(ServletOutputStream out, HttpServletResponse response, StringBuffer str_buf) {
         BufferedOutputStream buf_out = null;
    // Create input/output streams
         buf_out     = new BufferedOutputStream(out);
         int length     = str_buf.length();
         // Read/Write
         for (int i = 0; i < length; i++) {
              buf_out.write(str_buf.charAt(i));
    =========================================================================================================================================
    Then, the result will be post back to a JSP page. It didn't work when the records in database growing bigger ( > 100 000 records) but works nice while the records are still in a small quantities ( < 20 000 records). It seems that no record can be inserted into the file and the JSP page becomes blank. When I opened the csv file, I found a message"Error 500:" inside it.
    Hope you all experts can help to figure out this problem. TQ

    I am amatuer in Java Programming, so I don't know how to implement serializable interface but I will look through it.
    However, as I mention before, the code run perfectly if there are not much records un the table. But once there are more and more table added in (> 1000 000 records) in the table, it becomes unstable - sometime it works but most of the time it doesn't. So, I didn't find any different event I replaced the code with String date = "=2000-01-01".
    Anyway, thanks for your help.

  • Cannot open a db file larger than 2GB

    Hello,
    I have an Oracle Express Edition 10g running on Redhat Enterprise Linux 4 server.
    I have an Oracle database file which is 2.1 GB in size. I am not able to open this file using the application or the Oracle sql developer. The error message that I get is:
    ORA-01110: data file 5: '/usr/lib/oracle/xe/oradata/XE/service_3_0.dbf'
    ORA-27041: unable to open file
    Linux Error: 13: Permission denied
    I think this has to do with the fact that since it is not a 64-bit Linux but a 32-bit Linux, it does not support files larger than 2GB. What do you think I should do to tackle this problem?
    Best Regard
    Thayalan

    Hello,
    I have an Oracle Express Edition 10g running on
    Redhat Enterprise Linux 4 server.
    I have an Oracle database file which is 2.1 GB in
    size. I am not able to open this file using the
    application or the Oracle sql developer. The error
    message that I get is:
    ORA-01110: data file 5:
    '/usr/lib/oracle/xe/oradata/XE/service_3_0.dbf'
    ORA-27041: unable to open file
    Linux Error: 13: Permission denied
    I think this has to do with the fact that since it is
    not a 64-bit Linux but a 32-bit Linux, it does not
    support files larger than 2GB. What do you think I
    should do to tackle this problem?
    Best Regard
    ThayalanThat's interesting! I had no problems with opening files 32767MB in size on the very same 32 bit RH EL 4.0. How did you conclude that your file is too large, based on the error message which reads "Linux Error: 13: Permission denied"? Have you tried reading the manual page for the "open" system call and see when does it return EACCESS (error 13), found in /usr/include/asm-i386/errno.h. My man page for open says the following:
    ERRORS
    EACCES The requested access to the file is not allowed, or search per-
    mission is denied for one of the directories in the path prefix
    of pathname, or the file did not exist yet and write access to
    the parent directory is not allowed. (See also path_resolution(7).)
    What lead you to the conclusion that your file is too big? Do you have an access to a system administrator who knows how to use "strace"? If your system admin doesn't know how to use "strace", he too deserves waterboarding.

  • How to create one ISO file large than 2G

    hi,
    here when I create one ISO with 3G(larger than 2G) on solaris 10 machine, I met below error:
    mkisofs: File too large. cannot fwrite 32768*1
    Anyone has suggestion for this problem? How to create one ISO files larger than 2G?
    See the detail logs information:
    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    mkisofs -o my.iso -A "Software DVD" -D -L -P "Study "-p CBC/XLE -r -T -V R50 -v iso
    mkisofs: The option '-L' is reserved by POSIX.1-2001.
    mkisofs: The option '-L' means 'follow all symbolic links'.
    mkisofs: Mkisofs-2.02 will introduce POSIX semantics for '-L'.
    mkisofs: Use -allow-leading-dots in future to get old mkisofs behavior.
    mkisofs: The option '-P' is reserved by POSIX.1-2001.
    mkisofs: The option '-P' means 'do not follow symbolic links'.
    mkisofs: Mkisofs-2.02 will introduce POSIX semantics for '-P'.
    mkisofs: Use -publisher in future to get old mkisofs behavior.
    Warning: creating filesystem that does not conform to ISO-9660.
    mkisofs 2.01 (sparc-sun-solaris2.10)
    Scanning iso
    Scanning iso/rac_stage3
    Using RAC_S000 for /rac_stage2 (rac_stage1)
    Using RAC_S001 for /rac_stage1 (rac_stage3)
    Using INSTA000.1;1 for ..
    Writing: The File(s) Start Block 48
    0.42% done, estimate finish Thu Feb 1 16:12:35 2007
    0.84% done, estimate finish Thu Feb 1 16:12:36 2007
    1.26% done, estimate finish Thu Feb 1 16:12:36 2007
    1.69% done, estimate finish Thu Feb 1 16:12:36 2007
    2.11% done, estimate finish Thu Feb 1 16:12:36 2007

    87.65% done, estimate finish Thu Feb 1 16:14:54 2007
    88.07% done, estimate finish Thu Feb 1 16:14:54 2007
    mkisofs: File too large. cannot fwrite 32768*1
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Thanks!

    does it matter "copy protection" ? for the problem that i have?
    my computer is alwyes get stuck while i trying to made a dvd or image
    i made few disks wite menu in the past & i had not problems at all

  • Can't display PDF file larger than 2Mb

    Would like to ask if someone knows that any setting that would allow the PDF file larger than 2Mb be displayed within web browser IE 7, for some strange reasons, the PDF file will stop download at arround 800 some Kb, and I waited for almost 15 minutes with no further action.
    Back ground info:- MS Vista Home Premium SP1, 2G RAM, over 60G available HDD space, IE Temp file size set to 100M
    Appreciated for any help
    -David

    Mike I have a similar problem with down loading PDF files larger that 3MB. I have three computers with Win XP, IE7 and 56K connection. I have tried to down load three different PDF files from the same source - 1.3MB 2.3MB and 5.3MB. The Computer with Reader 7.0 downloads and opens all files. The computers with Reader 8.1.2 and 9.0 downloads and opens the smaller files but stop at 3.2 MB on the larger file with an error message "The file is damaged and could not be repaired".
    As fixes to the problem I have tried turning off any accelerators, installing and using Monzilla foxfire (then removed it since I had the same problem), increasing the cash size from 250MB to 1GB, Saving the file to the desktop rather than opening the file. I have not found useful help in Adobe Reader knowledge base.
    Any suggestions?
    Carl

  • Cannot write configuration file

    Hello,
    I have a problem loading up a project I have taken over from some one else. I need some guidance as I can't seem to find the solution. However im not that familiar with .NET or MVS as I once
    was. The message I get is as follows :-
    Microsoft Visual Studio
    Creation of the virtual directory localhost:49623/ failed with the error: Filename: \\?\C:\Users\firstname.surname\Documents\IISExpress\config\applicationHost.config
    Error: Cannot write configuration file
    However I have checked the permissions and can't see anything obvious. Under guidance from another developer I have also updated :-
    www.nuget.org/
    and
    www.nuget.org/packages/Microsoft.AspNet.Mvc
    I am using a Windows 7 enterprise edition Dell Lattitude laptop. With MVS as follows
    Microsoft Visual Studio Professional 2012
    Version 11.0.50727.1 RTMREL
    Microsoft .NET Framework
    Version 4.5.50938
    Installed Version: Professional
    Microsoft Visual Studio Tools for Applications 2012   04938-088-1153812-02395
    Microsoft Visual Studio Tools for Applications 2012
    Office Developer Tools   04938-088-1153812-02395
    Microsoft Office Developer Tools
    Team Explorer for Visual Studio 2012   04938-088-1153812-02395
    Microsoft Team Explorer for Visual Studio 2012
    Visual Basic 2012   04938-088-1153812-02395
    Microsoft Visual Basic 2012
    Visual C# 2012   04938-088-1153812-02395
    Microsoft Visual C# 2012
    Visual C++ 2012   04938-088-1153812-02395
    Microsoft Visual C++ 2012
    Visual F# 2012   04938-088-1153812-02395
    Microsoft Visual F# 2012
    Visual Studio 2012 Code Analysis Spell Checker   04938-088-1153812-02395
    Microsoft® Visual Studio® 2012 Code Analysis Spell Checker
    Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.
    The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V.
    All rights reserved.
    Visual Studio 2012 SharePoint Developer Tools   04938-088-1153812-02395
    Microsoft Visual Studio 2012 SharePoint Developer Tools
    NuGet Package Manager   2.8.60318.667
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit docs.nuget.org/.
    PreEmptive Analytics Visualizer   1.0
    Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.
    SQL Server Analysis Services  
    Microsoft SQL Server Analysis Services Designer
    Version 11.0.5058.0
    SQL Server Data Tools   11.1.20627.00
    Microsoft SQL Server Data Tools
    SQL Server Integration Services  
    Microsoft SQL Server Integration Services Designer
    Version 11.0.3436.0
    SQL Server Reporting Services  
    Microsoft SQL Server Reporting Services Designers
    Version 11.0.3436.0
    Web Developer Tools   1.0.30710.0
    Microsoft Web Developer Tools contains the following components:
    Page Inspector: Tool that offers an efficient way to decompose Web Applications and diagnose front-end issues.
    Web Publishing: Extensions required for Web Publishing for both hosted servers as well as on premises.
    Web Form Templates: Includes the default templates for Web Form Applications.
    Editor Extensions: Includes HTML, CSS, and JS editor extensions that greatly enhance the development experience.

    I see some others have had success by removing encryption on the IISExpress folder and removing the Read Only attribute as well.
    See this post for details.
    Others have had success by doing the following:
    - Run Command Prompt (cmd) in Admin Mode
    - Enter the following command: DISM /Online /Cleanup-image /Restorehealth
    ...as detailed here.

  • Trying to install itunes on my new windows 8 laptop and getting an error message cannot write to file?

    error message cannot write to file when trying to install itunes on windows 8 laptop.

    Hi Stacy,
    Welcome to Apple Support Communities.
    Take a look at the article below, it provides a lot of great tips that will resolve most iTunes installation issues.
    Issues installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/ht1926
    If you run into any issues, just reply with details about the step you're on and what you're seeing.
    -Jason

  • I'm trying to download my Master CS6 onto a new hard drive because my old one crashed and I keep getting a message saying " Cannot write the file" or "I don't have permission to access the requested resource." ? What does this mean?

    I'm trying to download my Master CS6 onto a new hard drive because my old one crashed and I keep getting a message saying " Cannot write the file" or "I don't have permission to access the requested resource." ? What does this mean?

    Yes- it is a Mac. I went through adobes system requirements and re- downloaded supportive software. The notice seems to happen near the end of the down load with the messages above. I'll look into your suggestion. Thank you- appreciated.

  • Cannot write class file...

    I have no idea what this means. This app was running just
    fine. Then wham.
    Here is the error message:
    Errors reported by Java compiler: Found 1 semantic error
    compiling
    "D:/CFusionMX/wwwroot/WEB-INF/cfclasses/cfApplication2ecfm855244706.java":
    1. public final class cfApplication2ecfm855244706 extends
    coldfusion.runtime.CFPage{ <-------------------------> ***
    Error: Cannot write class file "cfApplication2ecfm855244706.class"
    because that name conflicts with the name of the class file
    "cfapplication2ecfm855244706.class" in directory "cfclasses". This
    is illegal because file names are case-insensitive in this system.
    If anyone can tell me where to look and what to do here, I
    would be very grateful.
    Thanks,
    Lee

    Try clearing out your cfclasses directory which is located on
    your machine at D:\CFusionMX\wwwroot\WEB-INF\cfclasses. Then
    restart CF.

  • Large file handling tips Help for illustrator file larger than 3 gb

    Can anyone provide advice for large file handling tips.  Help for illustrator file larger than 3 gb ie how often, when, and should I clear the clipboard? are here other tips?
    Thanks,
    Gavin

    My key tip is to EXPECT corruption. Keep every save separately so you can go back before damage (which might not be visible). Don't just keep a single old file or rely on daily backups.

  • Opening file larger than 4 GB

    Have a large panorama tiff that would not open in PS CC. Error was file larger than 4GB.. What options do I have to open large file as this one in PS CC.

    If you're on windows ,open the version 64 of Photoshop installed on your machine:
    C:\Program Files\Adobe\Adobe Photoshop CC

  • REP-50127 Cannot write into file

    Our situation:
    DB Oracle 10.2.0.3
    Reports server version: 10.1.2.0.2
    We are generating reports in PDF and storing them in the Oracle OCM (previous IFS) system.
    Once in a while we get an error.
    The report trace gives the following:
    [2010/9/29 7:10:9:739] Exception 50127 (): Cannot write into file Invoicexxx.PDF
    oracle.reports.RWException: IDL:oracle/reports/RWException:1.0
    at oracle.reports.utility.Utility.newRWException(Utility.java:758)
    at oracle.reports.utility.Utility.copyFile(Utility.java:469)
    at oracle.reports.server.DesFile.sendFile(DesFile.java:85)
    at oracle.reports.server.Destination.send(Destination.java:484)
    at oracle.reports.server.JobObject.distribute(JobObject.java:1594)
    at oracle.reports.server.JobManager.updateJobStatus(JobManager.java:2332)
    at oracle.reports.server.EngineCommImpl.updateEngineJobStatus(EngineCommImpl.java:134)
    at oracle.reports.server._EngineCommImplBase._invoke(_EngineCommImplBase.java:94)
    at com.sun.corba.se.internal.corba.ServerDelegate.dispatch(ServerDelegate.java:353)
    at com.sun.corba.se.internal.iiop.ORB.process(ORB.java:280)
    at com.sun.corba.se.internal.iiop.RequestProcessor.process(RequestProcessor.java:81)
    at com.sun.corba.se.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:106)
    [2010/9/29 7:10:9:739] State 56016 (JobManager:updateJobStatus): Job 642218 status is: Executed successfully but there were some errors when distribute the ou
    tput
    REP-50159: Executed successfully but there were some errors when distribute the output
    REP-50127: FILE : Cannot write into file Invoicexxx.PDF
    [2010/9/29 7:10:9:740] State 56004 (EngineInfo:setState): Engine rwEng-1 state is: Ready
    [2010/9/29 7:10:9:741] Exception 50159 (): Executed successfully but there were some errors when distribute the output
    oracle.reports.RWException: IDL:oracle/reports/RWException:1.0
    at oracle.reports.server.JobManager.runJobInEngine(JobManager.java:1110)
    at oracle.reports.server.ExecAsynchJobThread.run(ExecAsynchJobThread.java:54)
    [2010/9/29 7:10:9:741] Exception 50159 (): Executed successfully but there were some errors when distribute the output
    oracle.reports.RWException: IDL:oracle/reports/RWException:1.0
    at oracle.reports.server.JobManager.runJobInEngine(JobManager.java:1110)
    at oracle.reports.server.ExecAsynchJobThread.run(ExecAsynchJobThread.java:54)
    There is enough diskspace available so that's not the issue.
    Does anybody know what triggers the error and how we can avoid it?
    Edited by: vccservice on Sep 30, 2010 11:02 AM

    no freespace in the tablespace is also the reason for this error

  • PS Touch needs a warning message when importing files larger than 2048x2048 max resolution

    I opened 6500x5000 px files into PS Touch in iPad for some minor retouching. PS Touch - without notification - reduced the images to fit within 2048 x 2048 px. It happily let me open these files, work on them and save and never let me know it was reducing the file size, rendering all the work I did utterly useless since 2048x2048 is far too small for print res for these files.
    PS Touch needs a notification or warning when importing files larger than the app's max resolution. Resizing files without notification is just asinine.

    Hi Jeff,
    For improvements or feature requests - please create an Idea for others to vote for:
    Thanks,
    Ignacio

  • Satellite P500/01R reads data but cannot write data files to CD

    I recently bought a Satellite P500/01R laptop. I am able to read a data CD but cannot write data files to CD. The CD is read/write.
    Any ideas?

    Hi
    Did you try different burning software?
    Im using the Nero and in my opinion one of the best burning applications.
    There I can choose between CD, DVD, DL or Blueray (only possible if CD/DVD drive supports this too.)
    Did you also check different CDs from different manufacturers?
    You should do this since not all disks are 100% compatible.
    I had many issues with different CD or DVD in most cases it was an compatibility issue I tested TDK and these kind of disk is compatible with my CD/DVD drive
    Im using the R standard.

  • How do i get files larger than 2 gigs on a usb drive and still be able to use on a mac and pc?

    how do i get files larger than 2 gigs on a usb drive and still be able to use on a mac and pc?

    You can format the drive using ExFAT or you can format the drive NTFS then use third-party software on the Mac to enable writing to it: NTFS 11.2.443.
    Disk Utility 12.x- Format a disk for Windows computers

Maybe you are looking for

  • Using Pages as the email Editor in Mail

    I find OS X Mail very limited in spelling error correction and grammar correction. Is there any way to use Pages as my email editor or would it be faster to learn how to spell?

  • Opening pdf files

    Why can I not open certain pdf files in my email?

  • HP P7-1235 Video

    I have a P7-1235, and recently purchased a Radeon HD 7850, and a new Rosewill 500 Watt PS. I am having trouble disabling onboard video tho as it does not have the option in the BIOS, do I need to completely uninstall the existing video from onboard t

  • My ipad is locked to icloud prompt

    my ipad is locked in an icloud prompt

  • Mouse slow after sleep

    Hello I have a 2009 2.8ghz IMAC with 2gb of RAM running 10.5.8 OS. The mac iteself seems to be of good performance generally, but after coming out of sleep mode, more and more frequently the mouse pointer performance is slow, not reponding quickly to