Transferring files to a server JEE on EDGE/GPRS of BB

Hello

hope that I did not create a redundant question. I looked for a similar problem, but failed. Sorry if something equal is already there and please point me to it then.

I have a problem with the transfer of a file of 8310 to a JEE server. The problem is that the end of the file server is not recognized on the side. If the file is transferred in fact well (I can open it on file system), but the socket connection breaks and I am not able to use it more.

Here is my code:

mobile side:

DataOutputStream os;

private void writeFile(String fileName ) throws IOException {
            System.out.println(fileName);
            FileConnection fconn = (FileConnection) Connector.open(fileName, Connector.READ);
            InputStream input = fconn.openDataInputStream();
            int available = input.available();
            byte[] data = new byte[available];
            int len = 0;
            while ((len = input.read(data)) != -1) {
                os.write(data, 0, len);
            }
            os.flush();
            input.close();
            fconn.close();
    }

server-side:

private void recieveFile(File file, DataInputStream is) throws IOException {
        System.out.println(" Fetching file... " + file);
        FileOutputStream outputStream = new FileOutputStream(file);
        byte[] buffer = new byte[1600];
        int len = 0;
        while ((len = is.read(buffer)) != -1) {
            outputStream.write(buffer, 0, len);
            System.out.print(".");
        }
        outputStream.close();
        is.close();
        System.out.println("Image recieved-----------------------");
    }

The problem is that the next blocks on the server side...

len = is.read(buffer)) != -1

.. .to present, after that the last byte of the file has been received. The result is a timeout that closes the connection.

Also, here is the output of the relevant server console:

.Thread-17, READ: TLSv1 Application Data, length = 1320
.Thread-17, READ: TLSv1 Application Data, length = 1320
.Thread-17, READ: TLSv1 Application Data, length = 1320
.Thread-17, READ: TLSv1 Application Data, length = 1320
.Thread-17, READ: TLSv1 Application Data, length = 1320
.Thread-17, READ: TLSv1 Application Data, length = 1320
.Thread-17, READ: TLSv1 Application Data, length = 1320
.Thread-17, READ: TLSv1 Application Data, length = 1320
.Thread-17, READ: TLSv1 Application Data, length = 1320
.Thread-17, READ: TLSv1 Application Data, length = 1320
.Thread-17, READ: TLSv1 Application Data, length = 1320
.Thread-17, READ: TLSv1 Application Data, length = 662
.Thread-17, received EOFException: ignored
Thread-17, called closeInternal(false)
Thread-17, SEND TLSv1 ALERT:  warning, description = close_notify
Thread-17, WRITE: TLSv1 Alert, length = 22
Image recieved-----------------------

I don't know how to avoid this problem. Thanks a lot for your suggestions.

I guess that you establish the HttpConnection POST with the server before sending data.  Are you setting Content-Length header? You can find starting from fconn.fileSize ().  I know that, even if it is not necessary, this header is extremely useful.

In this way, you don't have to wait for that - 1 returned by the read().  Check the remaining length and read the bytes Math.min (buffer.length, remainingLength).  Once your remainingLength is equal to zero, close the file and the input stream.

Tags: BlackBerry Developers

Similar Questions

  • Muse CC 2015 update error: «some files on the server may be missing or incorrect...» »

    After an update to the Muse CC 2015, I get this error: "some files on the server may be missing or incorrect. Clear the cache of the browser, and then try again. "If the problem persists please contact the author of the Web site." I went as far as the incorporation of images and still get this error. I have not edited my CSS or Scripts. I have added Google Analytics to index.html

    The site worked fine before the update. I have no errors or missing files in my links or layers.

    I use Mac OS 10.10.3 with Chrome, Safari and Firefox. I watched it via a laptop, iPhone and the desktop, I get the error on all 3 browsers via the bureau on Safari via iPhone, etc.

    I can't find anything current about this problem in Muse CC 2015. Help, please. Thank you!

    Please see "some files on the server may be missing or incorrect" Warning Message>.

    If this does not help solve you the problem, please post the URL of your site and let us know how the site is transferred (i.e. with the help of publish, using the file > Upload FTP host, or by using the file > export to HTML and other FTP client software)?

  • Some files on the server may be missing or incorrect. Clear the cache of the browser, and then try again. If the problem persists please contact the author of the Web site

    Help! I've just updated my Web site for the first time since the upgrade to the new version of Muse. All files are transferred successfully using Filezilla on my server but I get this error message on all browsers: some files on the server may be missing or incorrect. Clear the cache of the browser, and then try again. If the problem persists, please contact Web site author.

    Web site: 2020artgallery.com

    Hello

    Check this thread some files on the server may be missing or incorrect

  • Automatically download client file to CF Server

    I have a scenario where I need to automatically download a client CF server without using a browser. WebDAV redirector won't do what I use https. I wrote a ColdFusion web service for managing the file once I understand, but I have no idea how to do to consume this service from the client without a user openning a browser. Here's my simple web service code...

    < cfproperty >
    < cffunction = "uploadFile" access returntype = name "remotely" = "Sub" hint = "Secure Web Service to process the upload of a file" >
    < name cfargument = "appUserID" type = "string" required = "yes" >
    < name cfargument = "appPassword" type = "string" required = "yes" >
    < cfargument = "uploadFile" type name = "binary" required = "yes" >
    < name cfargument = "workgroupID" type = "string" required = "yes" >
    < cfset uploadDir = #APPLICATION.defaultRootValue # & ' / filestore/groups / "& #workgroupID # & ' / ' >"
    < cffile action = "upload" filefield = "" #uploadFile # "destination =" #uploadDir #">"
    < / cffunction >
    < / cfproperty >

    I found a solution - and Yes, the best things in life are free! You should check out a tool called curl.
    http://curl.haxx.se/

    curl is a command line tool for transferring files with URL syntax, support for FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, FILE and LDAP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP download, HTTP form from upload, proxies, cookies, user + authentication password (Basic, Digest, NTLM, Negotiate, kerberos...), recovery of file transfer, proxy tunnel and a bus of other useful stuff. Text CURL

  • In XP, film transferred files, but they won't play, they freeze and system must be rebooted

    can t drop and drag a file as before transfer then went there and freezes the file

    * original title - transfer files video but then won t read files in folder freezes thay file then must restart the pc to run other peograms, but freezes always transferred files *.

    Thanks I found the pyoblem it's a hostile codec had nothing to do with your thanks for suggestions to try however have a gooday

  • Installation of Windows 7 Home Premium 64 Vista Home Premium 64. It hangs on the last part of "transferring files, settings and programs.

    Install Windows 7 Home Premium 64 Vista Home Premium 64.  It hangs on the last part of "transferring files, settings and programs.  Before installation, the installation program tells me Logitech Quickcam 9.0.2 and Mirotune ATSC Capture Device was born to be unintalled.  But neither are installed that I can see.  What can I do?

    so eager to upgrade to Windows 7, it will depend on if the manufacturer of your computer/laptop has windows 7 drivers available for your computer/laptop as to whether Windows 7 will work properly on your machine

    check with them

    and read this

    Windows 7 upgrade advisor

    http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=1b544e90-7659-4BD9-9e51-2497c146af15

    Windows 7 system requirements

    http://Windows.Microsoft.com/en-us/Windows7/products/system-requirements

  • I transferred files from my old laptop to my Vista running a new but can't open them as they say that they are not supported

    I transferred files using a windows vista belkin easy transfer cable to windows 7

    * original title - I moved from my old laptop to my new files but can't open them as they say that they are not supported. Some files that I can open it but its just gibberish. Any suggestions would be appreciated.*

    Hello

    You must have the program, the files were written in vista installed in windows 7 to read

    you do not have file extensions

    read this

    You must have the program installed to be able to read the files of programs

    for example, if it's a .doc file, you installed Word

    .xls, you need Excel

    . PPS, you need Powerpoint

    etc.

    but fortunately, there are FREE viewers provided by Microsoft for the file extensions above which will save you having to buy Microsoft Office

    Here are the download links for free Microsoft Word, Excel and PowerPoint viewers:

    http://www.Microsoft.com/downloads/details.aspx?FamilyId=3657ce88-7cfa-457a-9aec-f4f827f20cac&displaylang=en

    Word Viewer

    View, print and copy Word documents, even if you don't have Word installed. This download is a replacement for Word Viewer 2003 and all previous Word Viewer versions.

    http://www.Microsoft.com/downloads/details.aspx?FamilyId=1CD6ACF9-CE06-4E1C-8DCF-F33F669DBC3A&displaylang=en

    Excel Viewer

    Open, view, and print Excel workbooks, even if you don't have Excel installed. This download is a replacement for Excel Viewer 97 and all previous Excel Viewer versions.

    http://www.Microsoft.com/downloads/details.aspx?FamilyId=048dc840-14e1-467D-8dca-19d2a8fd7485&displaylang=en

    PowerPoint 2007 Viewer

    Microsoft Office PowerPoint 2007 Viewer allows you to view the presentations of all the features created in PowerPoint 97 and later versions.

    and you can try the FREE Open Office applications game to read these file extensions

    http://www.OpenOffice.org/

    and here's how to set file associations

    How do I... Change file extension associations in Windows Vista?

    http://www.TechRepublic.com/article/How-do-i-change-file-extension-associations-in-Windows-Vista/6172036

  • Error code: 0x8007045D when transferring files to the card reader.

    Original title: Error code: 0x8007045D

    Error code: 0x8007045D when transferring files to the card reader. Lost files. Running Windows 7.

    Hi Bernard Major,.

    1 did you change the permission for the files you are trying to copy?

    2. What place you are trying to copy the files?

    3. are you able to copy the same files on another computer?

    You can try to copy files to another location on the computer and check.

    Step 1:

    I recommend you to check if you have enough permission on the card reader to transfer files.

    See the link to apply authorization:

    What to know before applying permissions to a file or folder

    http://Windows.Microsoft.com/en-us/Windows7/what-to-know-before-applying-permissions-to-a-file-or-folder

    Step 2:

    If you're still having problems, then run Check disk to repair the bad sectors.

    a. Click Start, in the start search bar type cmd, right-click on the command prompt icon in the box programs and then click Run as administrator.

    b. Type X: (for the card reader drive letter) and press enter

    c. at the command prompt, type chkdsk /f and then press ENTER.

    Now, type chkdsk/r

    Note: CHKDSK would attempt to recover bad sectors on the hard disk, in the course of this process there are chances of DATA loss from that particular area. You can save the data on the disk before you perform a checkdisk.

    For more information, refer to the article below.

    Error message when you try to perform a full backup on a Windows Vista-based computer: "the application cannot be performed because of an i/o device error."

    http://support.Microsoft.com/kb/952272

    Note: This article remains valid for Windows 7 also.

    I also suggest you to check this problem with another USB plug.

    Hope this information is useful.

    Jeremy K
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum let us know what you think.

    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Publication of files on the server side is not visible!

    Hello

    I post an image of a device using the following code:

    PNGEncoder encoder = new PNGEncoder(bit, true);
    byte[] imageBytes = encoder.encode(true);
    
    connection = (HttpConnection)Connector.open("url");
                connection.setRequestMethod(HttpConnection.POST);
                connection.setRequestProperty("Content-Language", "en-US");
                connection.setRequestProperty("Content-Type", "multipart/form-data");
                connection.setRequestProperty(HttpProtocolConstants.HEADER_CONTENT_LENGTH, String.valueOf(imageBytes.length));
    
    OutputStream os = connection.openOutputStream();
    String newLine = "\r\n";
    String contDisp="Content-Disposition:form-data; name=\"Image.jpg\";filename=\"Image.jpg\"";
    String contEnc = "Content-Transfer-Encoding: binary";
    String type="Content-Type:image/jpeg";
    os.write(contDisp.getBytes());
    os.write(newLine.getBytes());
    os.write(type.getBytes());
    os.write(newLine.getBytes());
    os.write(contEnc.getBytes());
    os.write(newLine.getBytes());
    os.write(imageBytes);
    os.flush();  
    
    int responseCode = connection.getResponseCode();
    if(responseCode != HttpConnection.HTTP_OK){
        connection.close();
        Dialog.alert("Status: "+String.valueOf(responseCode));
    }
    

    The POST request works very well, but I can't get the file on the server side. The application has no file as an attachment, what am I doing wrong?

    Thank you

    You are not set or a border for the body in several part. In addition, the content-length header is supposed to be the length in bytes of the entire body, including the part headers. I'm surprised that the server isn't hard to refer a complaint.

    Do you need to send this as a request for several part? Looks like you send just a single file. Try to assign the image/jpeg content type and write the bytes of the image in the output stream, with no header.

    PNGEncoder encoder = new PNGEncoder(bit, true);byte[] imageBytes = encoder.encode(true);
    
    connection = (HttpConnection)Connector.open("url");connection.setRequestMethod(HttpConnection.POST);connection.setRequestProperty(HEADER_CONTENT_TYPE, CONTENT_TYPE_IMAGE_JPEG);connection.setRequestProperty(HEADER_CONTENT_LENGTH, String.valueOf(imageBytes.length));
    
    OutputStream os = connection.openOutputStream();os.write(imageBytes);os.close(); // not just flush()
    
    int responseCode = connection.getResponseCode();if(responseCode != HttpConnection.HTTP_OK){    connection.close();    Dialog.alert("Status: "+String.valueOf(responseCode));}
    

    (If you declare your class as long as HttpProtocolConstants of execution, you can use the names unqualified as I did here).

    If you need the file sideways name server, I would send it as additional path added to the URL info.

  • Best way to upload images files to a server

    Hello developers!

    I ve developed a picture of sotores wich App of the cam on the SD card. Now, I want to store that the images (jpeg files) on a server instead. Does anyone have suggestions on the best way to do it? Thak you for your advice!

    Jose

    Do HTTP POST request to the server and transfer your images via a HTTP POST request.

    See the links below:

    http://www.java2s.com/code/Java/J2ME/SampletodemonstrateHttpGETandPOSTfromMIDlet.htm

    http://codetrips.blogspot.com/2007/04/HTTP-post-from-J2ME-MIDlet.html

  • I am transferring files to new computer. I can't my favorites to be transferred.

    I am transferring files to new computer.  I can't my favorites to be transferred.

    What web browser do you use? Sounds like Firefox:

    Backup and restore bookmarks - Firefox - MozillaZine ...

    If you use Internet Explorer

    How import and export the folder Of Internet Explorer Favorites to a ...

  • Files from the server does not update the when editing in Machine Windows 7

    I am editing the files on a server with a machine running windows 7 pro. Some files are not updated when changes are made, but the machine seems to be storing it locally. Does anyone have an idea on how to fix this? Thank you!

    Hello

    As you are working on a Windows Server environment I suggest you you posted the question under Windows Server TechNet forum for assistance from the public pro IT. see the following link:

    http://social.technet.Microsoft.com/forums/en/category/w7itpro

    Hope this helps

  • How to send a file in the server of the University Complutense of MADRID using the Code?

    Hello

    I tried several times to upload a file to the server of the University Complutense of Madrid from the adf page, but I can't do it.

    First: I have used this method to do, but it feel that the file downloaded successfully and when I open the server I haven't found this...

    public String addNewContent() {}
    InputStream fileStream = null;

    try {}
    createConnection();
    String filePath = "C:\\Users\\Administrator\\Desktop\\ucm classes\\Class1.java";
    String autherName = "weblogic";
    fileStream = new FileInputStream (filePath);
    = New File (filePath);
    String [] fileTitle = filePath.split("/");
    long fileLength = new File (filePath) .length ();
    param.getBinder (.putLocal (CMConstants.CM_SERVICE_NAME),
    CMConstants.CM_CHECKIN);
    param.getBinder () .putLocal ("dDocType", "Application");
    Title of the downloaded file
    param.getBinder () .putLocal ("dDocTitle", fileTitle [fileTitle.length - 1]);
    Name of the author
    param.getBinder () .putLocal ("dDocAuthor", autherName);
    Content security for (Group and account)
    param.getBinder () .putLocal ("dSecurityGroup", "Public");
    param.getBinder () .putLocal ("dDocAccount", "");
    param.getBinder () .putLocal ("dFormat", "text/html");
    param.getBinder () .putLocal ("xCollectionID",
    (getFolderIdFromPath ("/ Contribution dossiers/22 /"))) ;
    param.getBinder () .addFile ("primaryFile", file);
    param.setServiceResponse (param.getIdcClient (.sendRequest (param.getIdcContext ()),
    (param.getBinder ()));

    InputStream myInputStream = param.getServiceResponse () .getResponseStream ();
    String myResponseString = param.getServiceResponse () .getResponseAsString ();
    System.out.println ("downloaded file Details: \n" +)
    myResponseString);

    DataBinder myResponseDataBinder =
    param.getServiceResponse () .getResponseAsBinder ();

    System.out.println ("file uploaded successfully");
    } catch {(IdcClientException idcce)
    System.out.println ("IDC customer Exception occurred. Cannot download the file. Message: «+»
    idcce.getMessage () + ", the stack trace:");
    idcce.printStackTrace ();
    } catch (IOException ioe) {}
    System.out.println ("IO Exception has occurred. Cannot download the file. Message: «+»
    ioe.getMessage () + ", the stack trace:");
    ioe.printStackTrace ();
    } catch (Exception e) {}
    System.out.println ("Exception occurred. Cannot download the file. Message: «+»
    e.getMessage () + ", the stack trace:");
    e.printStackTrace ();
    } {Finally
    If (param.getServiceResponse ()! = null) {}
    param.getServiceResponse (m:System.NET.Sockets.Socket.close ());
    }
    If (fileStream
    ! = null) {}try {}fileStream.close ();} catch (Exception e) {}e.printStackTrace ();}}}

    Returns a null value.

    }

    ----------------------------------------------------------------------

    Second: I used this method, but it did not work also

    public String uploadFile() {}
    try {}
    String inputFile1 ="";
    UF UploadedFile = (UploadedFile) inputFile1.getValue ();
    String filePath="C:\\Setup\\mmm.txt; »
    InputStream fileStream = null;
    try {fileStream = new FileInputStream (filePath) ;} catch (FileNotFoundException e) {}}
    String [] fileTitle = filePath.split("/");
    long fileLength = new File (filePath) .length ();

    //DataBinder Binder = IdcClient.crea
    param.getBinder (.putLocal (CMConstants.CM_SERVICE_NAME),
    CMConstants.CM_CHECKIN);
    param.getBinder () .putLocal ("dDocAuthor",
    "weblogic"); If the user is admin, can specify any user
    param.getBinder () .putLocal ("dDocTitle", "titleee");
    param.getBinder () .putLocal ("dDocName", "nameee");
    param.getBinder () .putLocal ("dDocType", "DigitalMedia");
    param.getBinder () .putLocal ("xCollectionID",
    getFolderIdFromPath ("/ files/11 Contribution")); parent folder
    param.getBinder () .putLocal ("dSecurityGroup", "Public");
    param.getBinder () .putLocal ("dDocAccount:", "");
    param.getBinder () .putLocal ("xComments", "Review of Montreal");
    param.getBinder () .putLocal ("xWCTags", "Montréal");

    param.getBinder () .addFile ("primaryFile",
    new TransferFile (fileStream, 'child',
    fileLength,
    "text/html"));
    ServiceResponse response =
    param.getIdcClient (.sendRequest (param.getIdcContext ()),
    param.getBinder ());

    } catch (Exception e) {}
    System.out.Print("");
    }

    Returns a null value.
    }

    -------------------------------

    Can someone tell me what's wrong? !

    Thank you

    This will definitely work

    package demo;
    
    import java.io.*;
    import oracle.stellent.ridc.*;
    import oracle.stellent.ridc.model.*;
    import oracle.stellent.ridc.protocol.*;
    import oracle.stellent.ridc.protocol.intradoc.*;
    import oracle.stellent.ridc.common.log.*;
    import oracle.stellent.ridc.model.serialize.*;
    import oracle.stellent.ridc.protocol.http.*;
    import java.util.List;
    
    /*
     * This is a class used to test the basic functionality
     * of submitting a checkin to Content Server using RIDC.
     */
    
    public class TestRIDCCheckin {
    
        public static void main(String[] args) {
            // Create a new IdcClientManager
            IdcClientManager manager = new IdcClientManager();
            try {
                // Create a new IdcClient Connection using idc protocol (i.e. socket connection to Content Server)
                IdcClient idcClient = manager.createClient("idc://localhost:4444");
                // Create new context using the 'sysadmin' user
                IdcContext userContext = new IdcContext("sysadmin");
                // Create an HdaBinderSerializer; this is not necessary, but it allows us to serialize the request and response data binders
                HdaBinderSerializer serializer = new HdaBinderSerializer("UTF-8", idcClient.getDataFactory());
    
                // Databinder for checkin request
                DataBinder dataBinder = idcClient.createBinder();
                dataBinder.putLocal("IdcService", "CHECKIN_UNIVERSAL");
                //dataBinder.putLocal("dDocName","TestRIDCCheckin");
                dataBinder.putLocal("dDocTitle", "Test RIDC Checkin");
                dataBinder.putLocal("dDocType", "Document");
                dataBinder.putLocal("dDocAccount", "");
                dataBinder.putLocal("dSecurityGroup", "Public");
                dataBinder.addFile("primaryFile", new File("c:/test.txt"));
    
                //dataBinder.putLocal("doFileCopy", "1");
    
                // Write the data binder for the request to stdout
                serializer.serializeBinder(System.out, dataBinder);
                // Send the request to Content Server
                ServiceResponse response = idcClient.sendRequest(userContext, dataBinder);
                // Get the data binder for the response from Content Server
                DataBinder responseData = response.getResponseAsBinder();
                // Write the response data binder to stdout
                serializer.serializeBinder(System.out, responseData);
    
            } catch (IdcClientException ice) {
                ice.printStackTrace();
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
        }
    
    }
    
  • Site shows "files on the server may be missing...". "click ok, and the Web site opens.  ??

    When you try to open my site of online customers I am reached by the text next message (see photo below)

    Screen Shot 2016-10-04 at 5.23.18 PM.png

    What the devil?  Can't figure out how to fix... Help.

    Hello PaulFredette,

    Apologize for the frustration.

    This is a doc that we created on this issue - some files on the server may be incorrect or missing.

    All the reasons that may explain the origin of this problem are mentioned here.

    Please check and let me know if this helps.

    Kind regards

    Ankush

  • Some files on the server may be missing or incorrect. Clear the cache of the browser, and then try again. If the problem persists, please contact Web site author.

    Hello I am trying to download my site www.novopro.co.uk screw "Publish to FTP" I have updated a page and downloaded from the website and now I get this warning on everypage. Some files on the server may be missing or incorrect. Clear the cache of the browser, and then try again. If the problem persists, please contact Web site author. If I click ok the site will load, but I get this error on everypage. I removed all widgets party 3 E, g, engines search, galleries etc.

    I looked through the forum, but not seen no real solution to the issue, I looked at the 'Muse.assets' in the JSConsole and the only script to update is touchswipe.js I do not understand why its doing so, my host said there is no problems with the servers smd ive only uploaded the site (all files) several times.

    My client is now a little inpatient as im yet to find a solution and I'd like to solve this problem as soon as possible. Please can someone help me shed light on the issue and im using the latest version of adobe Muse. Adobe Muse CC 2015.2.1

    Thanks in advance.

    In addition to what was suggested above, you can see if there are other solutions in this doc "some files on the server may be missing or incorrect" Warning Message that can help you and let us know?

Maybe you are looking for