Error while downloading a file

I have written a servlet that downloads a file from my server on to my mobile.
i have written the following code to download the file:
URL url = new URL(path);
                    URLConnection connection = url.openConnection();
                    InputStream stream = connection.getInputStream();
                    BufferedInputStream in = new BufferedInputStream(stream);
                    FileOutputStream fos = new FileOutputStream(fileName);
                    BufferedOutputStream out = new BufferedOutputStream(fos);
                    int i;
                    while ((i = in.read()) != -1)
                        //System.out.println("Reading the file");
                        out.write(i);
                    out.flush();The code has no errors, but i m unable to download the file. The mobile gives me an error saying:
Services: Empty File
Can anyone please help me out with this problem.
with regards,
Shirish

This way to download files from server looks odd. You're issuing a new URL connection, likely to self. This may be slower than accessing the file directly using FileInputStream.
But anyway, you haven't set the contenttype and contentlength accordingly. Likely the mobile is aborting the download immediately since the headers have sent a contentlength of 0 bytes.
Check at the bottom of http://balusc.xs4all.nl/srv/dev-jep-pdf.html for some downloadFile() snippets, which might provide useful insights how to download files.

Similar Messages

  • Error While downloading the file A server Error has occurred, please try again later Downloading Yahoo mail Application Attachments  Trying to download My Photos and movie 3 items so i can delete them all

    I have icloud and a new iPhone5 ! They work good , took pictures and a few short movies, plugged in my phone to my iMac transfered Items to iPhoto then inported items to iMovie. when getting to know what i was doing i decided to delete pictures and movies i no longer wanted. when i looked for a few missing items i opend Finder and there some where buyt i had already trashed them and deleted the doubles. Still could not find missing pictures and movies 3 items and today after calling yahoo about a different complant with sending feed back for Yahoo mail Applications login . i opened up Attachments Not the Large Attachments just Attachments and there were the 3 items i had been hunting for to Trash and delete. the mail Attachments file does not have the Option to delet Files and photos and movies. When i tried to Download the 3 items a window shows up that says Error While Downloading the Files, A Server Error has occured, please Try Again later. nothing works how do i remove the Trapped photo and movie Blank Files and trash them?  Onece they get into my downloads i can do something with them as i understand.    That part of it kind of keeps me in Question also because why should i have to down load my own files of Attachments / Pictures and movies if they are comming from my iMac?    How much better is iLife11 then iPhoto08 and iMovie08 .  Thanks Greg

    Hello,
    Thank you for your post.
    This is a quick note to let you know that we are performing research on this issue.
    If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Simon Wu
    TechNet Community Support

  • Firefox crashes whenever i want to install any addon or download any file. Some times i am receiving error while downloading any file like "could not be saved, because you cannot change the contents of that folder"

    I am the user of latest firefox 3.6.6 browser. I am getting problems of frequent crashes whenever i tries to install any addon. The crashes also occures whenever i want to download any file.
    I am also receiving errors while downloading any file like:
    "C:\Users\****\AppData\Local\Temp\******.001.part could not be saved, because you cannot change the contents of that folder.
    Change the folder properties and try again, or try saving in a different location. I already changed it many many times but still the same problem."
    Adobe flash palyer is also giving problems of not responding. I am using updated version of it already. Java is also updated.
    I already uninstalled firefox compeletly and re installed it many many times but still the same problem. I also scanned my computer with avira and malware bytes' Anti malware and got no dection. Please ractify this problem ASAP lest my profession will suffer.
    == Crash ID(s) ==
    b7f518f2-8d86-41ca-8bab-aee632100709; 1d790e10-d8eb-4904-98c9-94bc62100708; f042d319-b9f8-42ed-a8cb-57c7d2100708

    Please help.
    It is getting worse
    Adobe flash player is crashing. I already uninstalled and re installed the latest ver. Also it is hanging randomly.
    Please help.

  • Error while downloading a file via APEX screen

    While I try to download a file using the below code;
    an HTTP 404 error is coming although the proc is being called and the parameter is correctly being passed.
    Please help.
    create or replace procedure download_myfile1(p_id in number)
    as
    v_mime varchar2(255);
    v_length number;
    v_file_name varchar2(2000);
    Lob_loc BLOB;
    BEGIN
    -- -- Selecting the details from the table whoch contains the extracts
    select EXTRACT_FILE,FILE_NAME,dbms_lob.getlength(EXTRACT_FILE) into lob_loc,v_file_name,v_length from table_name where ID = p_id;
    -- -- set up HTTP header
    -- -- use an NVL around the mime type and
    -- if it is a null set it to application/octect
    -- application/octect may launch a download window from windows
    owa_util.mime_header( 'application/octet', FALSE );
    -- set the size so the browser knows how much to download
    --v_file_name := substr(v_file_name,1,instr(v_file_name,'.')-1);
    htp.p('Content-length: ' || v_length);
    -- the filename will be used by the browser if the users does a save as
    htp.p('Content-Disposition: attachment; filename="'||v_file_name|| '"');
    -- close the headers
    owa_util.http_header_close;
    -- download the BLOB
    wpg_docload.download_file( lob_loc );
    end download_myfile1;
    It shows a POP up window by which u can save or opens the file. But no pop up displayed in this case.
    -Shreya

    Hi,
    Made the same changes but still getting the same error.
    The earlier URL also that I had mentoned would dynamically make this url mentioned by you and then shows the pop up window.
    However when I am right clicking on the download link and then clicking 'Save target as' then this error message is provided:
    Internet Cannot download [schema name].download_myfile2 from [DNS name]
    Internet Explorer was not able to open this Internet Site.The requested site is either unavailable or cannot be found .Please try again.
    Please help..
    Thanks in Advance ...
    Shreya
    Edited by: 935203 on Jul 9, 2012 11:58 PM

  • Error while downloading PDF file from FTP Server

    Hi Friends,
    I have sent a PDF file with data to FTP , Then i want to check that uploaded pdf file , whether that is correct or not?
    for that , i have downloaded that file from FTP and i am trying to open the file . but it is giving this problem .
    "There was an error opening the document . The file is damaged and could not be repaired."
    will you suggest me regarding this.
    thanks in advance.
    balaji.T.

    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
              EXPORTING
           SRC_SPOOLID                    = spoolno
                src_spoolid                    = wa_file-rqident
                no_dialog                      = ' '
          DST_DEVICE                     =
          PDF_DESTINATION                =
              IMPORTING
                pdf_bytecount                  = numbytes
                pdf_spoolid                    = pdfspoolid
          OTF_PAGECOUNT                  =
                btc_jobname                    = jobname
                btc_jobcount                   = jobcount
              TABLES
                pdf                            = pdf
              EXCEPTIONS
                err_no_otf_spooljob            = 1
                err_no_spooljob                = 2
                err_no_permission              = 3
                err_conv_not_possible          = 4
                err_bad_dstdevice              = 5
                user_cancelled                 = 6
                err_spoolerror                 = 7
                err_temseerror                 = 8
                err_btcjob_open_failed         = 9
                err_btcjob_submit_failed       = 10
                err_btcjob_close_failed        = 11.
    because of this one PDF internal table is obtained.
           OPEN DATASET L_FILENAME  FOR OUTPUT in text mode  MESSAGE MSG.
      LOOP AT pdf.
        CONCATENATE pdf-tdformat       "Material group
                     pdf-TDLINE       "Basic Material
               INTO ITEXT-TLINE ..
        APPEND ITEXT.
        TRANSFER ITEXT TO L_FILENAME.
      ENDLOOP.

  • "error while downloading jar file"

    I receive this error while trying to download a MIDlet from the web (using the P800 device).I write the jad URL , then continue to installation , and then receive the error I wrote in the subject.
    I have no idea what it is , this MIDlet was downloaded before successfully on the P900 and on other devices.
    the MIDlet is MIDP 1.0
    thanks in advance

    Try to download the .jar directly. Atleast my T610 seems to accept the jar easier than going via the jad.
    Regards
    Roland

  • Error while downloading the file

    Hi, I have created a rssfeed file when i connect to iTunes and use my local webserver to look up the feed file it downloads all the episodes without any issues.
    From the main webserver the feed file does not work,although the paths and everything is correct.get the message "There was a problem downloading ... . The URL could not be found on the server". the file exists on the server and everything is fine according to feedValidator ... any help this is making me crazy

    Hi, I have created a rssfeed file when i connect to iTunes and use my local webserver to look up the feed file it downloads all the episodes without any issues.
    From the main webserver the feed file does not work,although the paths and everything is correct.get the message "There was a problem downloading ... . The URL could not be found on the server". the file exists on the server and everything is fine according to feedValidator ... any help this is making me crazy

  • Error while downloading data into excel file.

    Hi,
        I have a requirement to download data available in xstring to excel file.
    I have a RFC which has export parameter 'file_data' of type xstring. When i call RFC
    from web dynpro abap application it gives data out pout in xstring format.
    I am opening excel file using that xstring data as below
    cl_wd_runtime_services=>attach_file_to_response(
    i_filename = 'file.xls'
    i_content = ls_data_source-data_source   ***[xstring data from RFC]
    i_mime_type = 'x-excel/application'
    i_in_new_window = abap_true ).
    But excel file not coming in correct format. its  giving an error while download
    excel file
    Error is
          " the file you are trying to open , 'file[1].xls', is in a different format than
    specified by the file extension. Verify that the file is not corrupted and is from
    a trusted source before opening the file. Do you want to open the file now? "
    If i click on 'YES' button file opening but not in proper excel format. Data is coming
    in tab delimiter format in excel file.
    Please suggest any solution for this problem.
    Thanks,
    Venkat.

    Hi Thomas,
    Following is the logic implemented in RFC which is giving XSTRING as export parameter
    STEP1      create a dynamic internal table
               Create field catalog for the table   using LVC_FIELDCATALOG_MERGE
                   CALL METHOD cl_alv_table_create=>create_dynamic_table
                        EXPORTING
                           it_fieldcatalog = it_fieldcat
                         IMPORTING
                           ep_table        = dyn_table.
                  CREATE  EXCEL SHEET BY SENDING FIELD CATALOG AND DATA TAB
    STEP2 # Convert text table to xstring.
            CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'
              IMPORTING
                buffer   = l_content
              TABLES
                text_tab = lt_data_tab
              EXCEPTIONS
                failed   = 1
                OTHERS   = 2.
    STEP3  *# Psss Data to Netweaver
              PERFORM pass_data_to_nw USING is_import
                                      CHANGING es_attachment_metadata.

  • Object not found ERROR while downloading JAD over OTA

    Hellow everybody !
    I am getting Error while downloading JAD file over OTA in mobile..
    I am putting JAD and JAR in same folder ...
    and while I am trying to download JAR file directly then then Error like malformed content
    anybody know that when it happens?
    Premal

    check on your system with giving url on IE whether it open jar or not.

  • Error while downloading Detroit MI W2 Magnetic media File.

    Hello Guys,
    We are getting a Run time error while downloading a w2 magnetic media file for MI, and its only for a particular tax company.
    Any help is appreciated.
    ST22 Dump:
    Runtime Errors         CREATE_DATA_ILLEGAL_LENGTH
    Exception              CX_SY_CREATE_DATA_ERROR
    Date and Time          01/10/2011 13:58:44
    Short text
    CREATE DATA: Illegal value for the length of an object of the type "X"
    What happened?
    Error in the ABAP Application Program
    The current ABAP program "RPCTRTU0_ALV" had to be terminated because it has
    come across a statement that unfortunately cannot be executed.
    What can you do?
    Note down which actions and inputs caused the error.
    To process the problem further, contact you SAP system
    administrator.
    Using Transaction ST22 for ABAP Dump Analysis, you can look
    at and manage termination messages, and you can also
    keep them for a long time.
    Error analysis
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_CREATE_DATA_ERROR', was not
    caught in
    procedure "DOWNLOAD_CTXFU0" "(FORM)", nor was it propagated by a RAISING
    clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    A data object of the type "X" with length 0 was to be created using
    CREATE DATA. The value 0 is not within the allowed range.
    Allowed range for the length specification:
    Typ C, N, X: 1 .. 65535
    TYP P:       1 .. 16
    Thanks,
    Krish

    Hello Mr. Krish,
    I believe that this error has been corrected because you had to send the W2 form .
    But this issue was caused due to the fact that your file HR_F_W2_TAPE_DEC does not have a header line. The note 1553756 was delivered to correct this dump.
    Best Regards,
    Jaime

  • Error while downloading. message on E71 GPS USA Ma...

    “Error while downloading” message on E71 with updated GPS USA Maps
    I’m sure I’m not the only one having this problem but I recently updated my maps on my Straight Talk Nokia E71. The phone says I have map download V 3.03 10wk bo4 Mw Open GL LM MN, Map version 0.1.25.114.and I’m using Nokia Ovi Suite 2.2.1.23. After I installed V3.03, I installed it and download the 1.46GB USA map file and the three turn by turn files. But when I first started the GPS app I started getting the following error “Error while downloading”(This is on phone only)
    I have tried to factory reset the phone, re-format the 8GB memory card, remove City data and GF files and even unloaded OVI Suite and reload it. But every time I select GPS app and start to find places or my position, I get "Error while downloading" message. I’m new to this phone and didn’t get a respectable book from Straight Talk. So I don’t know much about this phone or Nokia OS. What is this error and how do I fix it. Also when I try to sync from the phone I get the response "system error". Ovi suite on the PC says I have downloaded all the USA maps and English voice  with street names. Please help I’m at a lost.
    Computer specs
    I am running Win-Vista, with a Broadband connection. 3 GB Ram, 2 gig Pentium dual core.
    Tran’s flash card has plenty room left on card over 5 gigs left.
    If I need to delete a file on the phone please tell me the exact file name because I’m not sure which one to remove from the apps folder.
    Solved!
    Go to Solution.

    @Action_Jackson
    Welcome to the forum!
    Whilst easy for me to say as keep very little data on device, I would suggest backup essential data then delete E:\cities + ,qf file followed by resetting device to "Out of box" state by keying in #7370# then 12345 (default Nokia lock code unless altered by yourself). At this point you would need to open OVI Maps application on device to re-initialise application and re-define necessary folder structure on memory card for device to be recognised by OVI Suite > Maps to re-download your regional mapping.
    Happy to have helped forum with a Support Ratio = 42.5

  • Html error while downloading table entries to Excel.

    Hi,
    I am getting an error while downloading table entries from webdynpro to excel. After some entries below error script comes and  this is not comming all the times.
    Is this because of large size?Can anyone please suggest me on this?
    <u>Here is the dump:</u>
    [code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>                                   
    <head>                                   
         <title>Error Report</title>                              
    <style>                                   
    td {font-family : Arial, Tahoma, Helvetica, sans-serif; font-size : 14px;}                                   
    A:link                                    
    A:visited                                    
    A:active                                    
    </style>                                   
    </head>                                   
    <body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" rightmargin="0">                                   
    <table width="100%" cellspacing="0" cellpadding="0" border="0" align="left" height="75">                                   
    <tr bgcolor="#FFFFFF">     
        <td align="left" colspan="2" height="48"><font face="Arial, Verdana, Helvetica" size="4" color="#666666"><b>  500   Internal Server Error</b></font></td>     
    </tr>     
    <tr bgcolor="#3F73A3">     
        <td height="23" width="84"><img width=1 height=1 border=0 alt=""></td>     
        <td height="23"><img width=1 height=1 border=0 alt=""></td>     
        <td align="right" height="23"><font face="Arial, Verdana, Helvetica" size="2" color="#FFFFFF"><b>SAP J2EE Engine/6.40 </b></font></td>     
    </tr>     
    <tr bgcolor="#9DCDFD">     
        <td height="4" colspan="3"><img width=1 height=1 border=0 alt=""></td>     
    </tr>     
    </table>     
    <br><br><br><br><br><br>     
    <p><font face="Arial, Verdana, Helvetica" size="3" color="#000000"><b>  Application error occurs during processing the request.</b></font></p>     
    <p><font face="Arial, Verdana, Helvetica" size="2" color="#000000"><table><tr><td valign="top"><b> Details:</b></td><td valign="top"><PRE><pre>com.sap.engine.services.servlets_jsp.server.exceptions.WebIllegalStateException: The stream has already been committed.     
         at com.sap.engine.services.servlets_jsp.server.runtime.client.HttpServletResponseFacade.sendError(HttpServletResponseFacade.java:792)
         at com.sap.engine.services.servlets_jsp.server.runtime.client.HttpServletResponseFacade.sendError(HttpServletResponseFacade.java:780)
         at com.sap.engine.services.servlets_jsp.server.runtime.client.HttpServletResponseFacade.sendError(HttpServletResponseFacade.java:768)
         at com.sap.tc.webdynpro.serverimpl.core.url.WebDynproExchangeHandler.responseCachedWebResource(WebDynproExchangeHandler.java:98)
         at com.sap.tc.webdynpro.serverimpl.core.url.WebDynproExchangeHandler.doExchange(WebDynproExchangeHandler.java:189)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doExchangeProcessing(DispatcherServlet.java:164)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:119)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
    </pre></PRE></font></td></tr></table></font></p>     
    </body>     
    </html>[/code]
    Thanks,
    Sanjeev

    Hallo Sanjeev,
    How do you exactly "download the table entries from Web Dynpro to Excel?"
    I wrote a new <b>Wiki Code Tutorial </b>which demonstrates how to download an Excel file from a Web Dynpro <i>Table </i>UI element <b>on-demand</b>. In this scenario the resource gets re-created on every request. The solution is based on re-initializing the context with a new  0-byte resource object within the calculated context attribute getter method.
    See <a href="https://wiki.sdn.sap.com/wiki/display/Snippets/ExportingTableDatainWebDynproJava-SAPNetWeaver04s">Exporting Table Data in Web Dynpro Java - SAP NetWeaver 04s</a>
    Regards, Bertram

  • Error While Downloading "SAP NetWeaver 7.0 JavaTrials"  from SDN

    Hi All,
    I was trying to download "SAP NetWeaver 7.0 JavaTrials"  from SDN , a sneak preview version of EP7.0.
    i got this error while downloading it ...
    "Invalid Archive Directory" and because of that i was not able to save the file.
    Can anyone guide me what is the reason for this and whats the solution to it.
    Regards,
    Vinoth.M

    Hi,
    The file type is *.tgz instead of .rar.Also im not able to download the entire file,when i starts downloading it completes with no time and when i try to open im getting the error "Invalid Archive Directory".Does this appears because of the file gets corrupted??
    Thanks,
    Vinoth.M

  • Error while download oracle 10g release2 for linux x-86

    Hi,
    I got errors while downloading oracle 10g r2 for linux x-86 from
    http://www.oracle.com/technology/software/products/database/index.html
    i got htis error:
    source file not found
    contact administrator.
    how do i download?

    Works for me in western Canada right now.
    You might want to try again, and if it still happens try clearing your browser cache and cookies.

  • Error while download HR integrator having parameter

    We created HR integrator and then selected Standalone_Integrator_Queries for assigning parameters which are following.
    Example:
    Integrator Name - CUSTOM TEST People3 INTG
    SQL Where Clause – WHERE EFFECTIVE_DATE = '31-DEC-4712' AND EMPLOYEE_NUMBER = $PARAM$.EMPLOYEE_NUMBER
    1st Parameter Name – EMPLOYEE_NUMBER
    1st Parameter Type – Varchar2
    1st Parameter Prompt– EMPLOYEE_NUMBER
    Below error while download file for particular employee.
    SQL error: ORA-00904: "EFFECTIVE_DATE": invalid identifier occurred processing stored SQL for Content 800:GENERAL_362_CNT.
    Download parameters are not complete
    Secondly, now if remove effective parameter coditions and reload the same then layout taking twice input for the employee field, is there any table which is configured parameter with integrator
    thanks

    Dear
    I have incorporated both option as you suggested but still there is not getting all employee when pass blank employee number at the time of Parameter.
    if this is working try to evolve it into something like:
    SQL Where Clause – WHERE (EMPLOYEE_NUMBER = $PARAM$.MY_EMPLOYEE_NUMBER or $PARAM$.MY_EMPLOYEE_NUMBER is null)
    SQL Where Clause – WHERE (EMPLOYEE_NUMBER = nvl($PARAM$.MY_EMPLOYEE_NUMBER, EMPLOYEE_NUMBER)
    Secondly user ("936671") suggested to use where_clause in such manner but this where system doesn't accespt due to (:PER) SHORT NAME.
    should i apply patch for this or need to change some profiles setting.
    thanks

Maybe you are looking for