Strange error when downloading blob

ADF 11g
Hello
I have a pdf file uploaded to the DB as a blob column.
I am now trying to download it.
I've tried to convert the Kuba [http://kuba.zilp.pl/?id=1] example from ADF 10 to 11.
I have page showing an af:table.
Clicking on the filename column runs the following :
    public BindingContainer getBindings() {
        FacesContext fc = FacesContext.getCurrentInstance();       
        return (BindingContainer)fc.getApplication().evaluateExpressionGet(fc,"#{bindings}", BindingContainer.class);
    public String onDownLoad() {
         BindingContainer bindings = getBindings();
         DCIteratorBinding itr = (DCIteratorBinding) bindings.get ("SttAttachedFilesView1Iterator");
         Row r = itr.getCurrentRow();
         BlobDomain file = (BlobDomain)r.getAttribute("FileContent");
         String fileName = (String)r.getAttribute("FileName");
         FileOperations.downloadFile( fileName,  file);
         return null;
     }The actual download code is
public class FileOperations {
    public FileOperations() {
    public static String getMimeType(String fileName){
        String mime = null;
        String ext = fileName.toLowerCase();
             if(ext.endsWith(".pdf")) { mime = "application/pdf"; }
        else if(ext.endsWith(".doc")) { mime = "application/msword"; }
        else if(ext.endsWith(".ppt")) { mime = "application/vnd.ms-powerpoint"; }
        else if(ext.endsWith(".rar")) { mime = "application/octet-stream"; }
        else if(ext.endsWith(".zip")) { mime = "application/zip"; }
     return mime;
    public static synchronized void downloadFile( String fileName, BlobDomain blobDomain )
        FacesContext facesContext = FacesContext.getCurrentInstance();
        ExternalContext extContext = facesContext.getExternalContext();
        Long length = blobDomain.getLength();      
        String fileType = getMimeType(fileName);
        HttpServletResponse response = (HttpServletResponse) extContext.getResponse();
        response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
        response.setContentLength((int) length.intValue());
        response.setContentType( fileType );
        try {
            InputStream in = blobDomain.getBinaryStream();
            OutputStream out = response.getOutputStream();
            byte[] buf = new byte[1024];
            int count;
            while ((count = in.read(buf)) >= 0) {
                out.write(buf, 0, count);
            in.close();
            out.flush();
            out.close();
            facesContext.responseComplete();
        } catch (IOException ex) {
            System.out.println(ex.getMessage());
            ex.printStackTrace();
}Whats happening is the first time I click on the filename the file is downloaded from the DB correctly.
If I click a second time I get the following errors :
<25 juil. 2009 12.54. h CEST> <Error> <HTTP> <BEA-101083> <Connection failure.
java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '0' bytes instead of stated: '156751' bytes.
     at weblogic.servlet.internal.ServletOutputStreamImpl.ensureContentLength(ServletOutputStreamImpl.java:425)
     at weblogic.servlet.internal.ServletResponseImpl.ensureContentLength(ServletResponseImpl.java:1451)
     at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1494)
     at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1437)
     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
     Truncated. see log file for complete stacktrace
>
<25 juil. 2009 12.54. h CEST> <Error> <HTTP> <BEA-101104> <Servlet execution in servlet context "ServletContext@18785780[app:UpLoadDownload module:UpLoadDownload-ViewController-context-root path:/UpLoadDownload-ViewController-context-root spec-version:2.5]" failed, java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '0' bytes instead of stated: '156751' bytes..
java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '0' bytes instead of stated: '156751' bytes.
     at weblogic.servlet.internal.ServletOutputStreamImpl.ensureContentLength(ServletOutputStreamImpl.java:425)
     at weblogic.servlet.internal.ServletResponseImpl.ensureContentLength(ServletResponseImpl.java:1451)
     at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1494)
     at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1437)
     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
     Truncated. see log file for complete stacktrace
>It as if the inputStream is empty the second time round even though the lenght is correct.
If I close the application and restart I can download the file again.
I've added an execute button to re-execute the query after the first download but the problem persists.
Anybody got any ideas ?
Regards
Paul

If I add
OperationBinding operation = getBindings().getOperationBinding("Rollback");        
operation.execute();         to the end of the onDownLoad method the error dissapears and everything works as expected.
If I replace Rollback with either Commit or Execute the problem continues.
Whats going on here its as if the blob field isn't really there....
Regards
Paul
Bump - because I've been on holiday :-)
Edited by: Paul (MITsa) on 10-Aug-2009 04:20

Similar Messages

  • Patching: HTTP errors when downloading blobs from proxy controller to agent

    Hi all,
    I have a persistent issue which I can't figure out. Oracle support aren't much help.
    When applying a Recommended Baseline patchset to our managed Solaris 10 servers, I have observed that blobs are downloaded to the target servers at a rate of 1-2 blobs per minute. I consider this to be quite slow, but that's not my main problem.
    At some point during the blob downloads, http errors start appearing in /var/scn/update-agent/logs/error.log on the target server....
    HTTP request failed. Reason: Moved temporarily.
    HTTP request failed. Reason: Bad gateway.
    Eventually, the blob download job fails completely...
    118099456 Download aborted.
    Our servers are quite a way behind in their patching levels. Consequently, we often need to apply as many as 200 patches to a single server. We are lucky to download 100 patches (blobs) before the http errors begin.
    The errors would seem to indicate that the http servers on the proxy controllers are refusing any further connections midway through the blob downloads. I have tried tweaking the httpd.conf file on the proxy controllers - increased the number of httpd processes running and increased MaxClients to 100. None of this has helped.
    The proxy controllers have interfaces on the same subnet as the target servers. Network performance between proxy and asset is good.
    Has anyone else experienced similar issues with patching ?
    Does anyone have any suggestions for httpd.conf settings on the Proxy Controllers ?
    Cheers,
    Graham

    So I have figured out the issue and as Eddie mentioned it is because the email attribute is not synced.  For some reason when I go into Manage User Profiles I am unable to edit anything, i.e. I cannot add the email address.  
    I am able to create a whole new user, which I did (already existed in AD) and of course included the email attribute.  When I sign into sharepoint with this user I am then able to view IRM protected documents.
    I cannot figure out why the email attribute is not synced to SP.  As mentioned above it seems the UPS does not work in a standalone SP install, but my undesrtanding is that when i sign into SP it is going to AD to autheticate, so why then does it not
    also retrieve the email attribute as well?
    I created an SharePoint Active Directory Import job, it runs successfully, it imports all my users from AD, but again without the eamil attribute!  Very strange.  If anyone has any clues I am all ears.

  • Adobe Reader error when downloading a Form (IMM5257E - required for CIC - Canadá)

    I received an error when downloading a file viwh the Adobe Reader version 11.0.07.
    A message like this appear:
    To view the full contents of this document, you need a later version of the PDF viewer.

    Pat Willener!
    GREAT THANKS! GREAT THANKS! GREAT THANKS!
    I was using Google Chrome, and did not suspect that this could be the
    problem.
    I used I.E. and the download worked. So that's it.
    Great thanks again.
    Vilson Drehmer
    Rua Balduíno Pedro Vier, 693
    CEP 95.880-000 - Estrela - RS
    Fone: (51) 8401.2253
    E-mail: [email protected] <[email protected]>
    CRA-RS 6364
    2014-05-28 5:26 GMT-03:00 Pat Willener <[email protected]>:
        Adobe Reader error when downloading a Form (IMM5257E - required for
    CIC - Canadá)  created by Pat Willener<https://forums.adobe.com/people/pwillener>in *Adobe
    Reader* - View the full discussion<https://forums.adobe.com/message/6414530#6414530>

  • Having a constant error when downloading latest update for Illustrator CC, error message: Adobe Illustrator CC Latest Updates (December 2014) Installation failed. Error Code: U44M1P7

    Having a constant error when downloading latest update for Illustrator CC, error message:
    Adobe Illustrator CC Latest Updates (December 2014) Installation failed. Error Code: U44M1P7

    U44.. update error http://forums.adobe.com/thread/1289956 may help
    -more U44.. discussion http://forums.adobe.com/thread/1275963
    -http://helpx.adobe.com/creative-suite/kb/error-u44m1p7-installing-updates-ccm.html
    -http://helpx.adobe.com/creative-suite/kb/error-u44m1i210-installing-updates-ccm.html

  • I have a A12E6 error when downloading and installing apps

    I have an
    A12e6 error when downloading and installing apps   yesterday i had the A12e1 error so i used the cleaner tool and did a new install but today again i have an arror A12e6
    Do you have a solution for me???? (mac osx 10.7.5)
    kind regards Arold

    Hi Arold,
    Welcome To The Forums
    http://forums.adobe.com/thread/1197816 or http://forums.adobe.com/thread/1291134 may help,
    Thanks!
    Eshant

  • Strange error when Bootcamp attempts to create partition for Windows

    I get a strange error when I tell Bootcamp to create a partition for Windows. I get to the Create a Partition stage. I select 20GB for Windows leaving 91GB (39GB free) for OS X. I then click Partition and it gives me the following error
    *The disk cannot be partitioned because some files cannot be moved.*
    Back up the disk and use Disk Utility to format it as a single Mac OS Extended (Journaled) volume. Restore your information to the disk and try using Boot Camp Assistant again.
    My disk is formatted in Mac OS Extended (Journaled), I have closed all applications (besides Bootcamp Assistant) and I have even restarted and tried again to see if that might help. Nothing. I can't get it to partition. Any thoughts? Can I partition my disk manually through disk utility and then select it in Bootcamp?

    Hi,
    this gets asked at least a thousand times by now.
    Have a look at this thread for solution http://discussions.apple.com/thread.jspa?messageID=10540273&#10540273
    Regards
    Stefan

  • How can I get rid of a 1202 error when downloading products from itunes

    How can I get rid of an 1202 error when downloading products from itunes?

    You have probably downloaded the Norton program which is one of the least desirable helpmates you can invite in.
    Read this thread and follow the suggestions by Thomas R, one of our gurus in this field.
    https://discussions.apple.com/message/20005609#20005609

  • I get error when downloading books

    After oppressing my iPad I started to get error when downloading books on iBook . It looks that book is downloaded, bu I miss most of the pages, and ther is several pages were it sayes error and page is missing. This happens to all of the book I try to download, even the ones I downloaded from before.
    Does engine know what to do?

    Please repost here: http://forums.adobe.com/community/adobe_digital_editions

  • I get this error when downloading key not valid for use in specified state what do i do

    i get this error when downloading key not valid for use in specified state what do i do

    What is your operating system?  What are you trying to download?

  • Error when downloading application from Server

    Hi,
    I have installed MI Client 7.0 SPS 11 Patch 0 on Symbol Device ;OS Windows Mobile5.0
    i have successfully completed <b>first</b> synchronization .
    After that i assigned Mobile Component to the device and tried synchronizing.
    "Error when downloading application from http://<servername>:50000/meContainerSync/servlet/com.sap.ip.mi.http.MobileComponentServlet?Application=xyz&Type=APPLICATION&Runtime=JSP"
    Pl. suggest
    Note: In NWA under 'Device Maintenance' -> Mobile component
    The state of the aplication is <b>"Deployment Activated"</b>
    rgds,
    Kiran Joshua
    Message was edited by:
            Kiran Joshua

    Hi ALL,
    I resolved it on my own guys !!!
    Actually while downloading server url consists of hostname bcoz the hostfile entry in windows/system32/drivers/etc/hosts was only hostname.
    i entered FQDN name in the hostfile... It WORKED
    Being Saturday and Sunday...i cud not get any help from forums...i was really worried and Guys we need to think on this :-?
    rgds,
    Kiran Joshua

  • I have a strange error when I close  a combobox:

    I have a strange error when I close a combobox:
    <mx:ComboBox
    id="currencyComboBox"
    prompt="Select Currency" dropdownStyleName="dropdown"
    labelField="currencyName"
    >
    <mx:close>
    <![CDATA[
    selectedItem = ComboBox(event.target).selectedItem;
    calculateCustomerData();
    ]]>
    </mx:close>
    <mx:change>
    <![CDATA[
    selectedItem = ComboBox(event.target).selectedItem;
    calculateCustomerData();
    ]]>
    </mx:change>
    </mx:ComboBox>
    RangeError: Index '7' specified is out of bounds.
    at
    mx.collections::ListCollectionView/getItemAt()[E:\dev\3.0.x\frameworks\projects\framework \src\mx\collections\ListCollectionView.as:422]
    This only occurs when its dataprovider is from a result event
    rather than its dataprovider from a predifined arraycollection.
    private function handleGetBanks(event:ResultEvent):void{
    bankResult = new ArrayCollection((event.result as
    ArrayCollection).source);
    currencyComboBox.dataProvider = event.result as
    ArrayCollection;
    rather than using the following as a dataprovider:
    <mx:ArrayCollection id="currencies">
    <mx:Object label="AED" />
    <mx:Object label="AUD" />
    <mx:Object label="CAD" />
    <mx:Object label="EUR" />
    <mx:Object label="NZD" />
    <mx:Object label="USD" />
    <mx:Object label="ZAR" />
    </mx:ArrayCollection>
    Can anyone see what the problem might be?

    Sorry my mistake, the change event was being called before
    the close event. Then I could debug and find the problem

  • Strange Error when previewing or publishing

    Hi Muse Family
    I am getting a very strange error when I publish to BC or when I go to preview in browser:
    "Adobe Muse has encountered an error.. blah blah"
    and then a very confusing:
    "There should not be such ID exists in the mapping"
    It forces Muse to close.
    I can't think of any significant step I took to cause this problem from when it was working.

    To enable the frequent release of new features within Muse, the team is always simultaneously working on many different improvements only some of which are completed and exposed in any given release. In the 2014.1 update some of the underlying code related to SVG support was unintentionally enabled. When copying and pasting from some versions of Adobe Illustrator (and other sources) the result may be an SVG vector graphic in Muse, rather than an image. While the SVG may appear to work in Design view, it can cause failures when exporting or publishing from Muse. This functionality will be disabled in an imminent dot release, 2014.1.1. We advise users to remove SVG content from their sites. Until 2014.1.1 is available, the graphics will need to be brought into Muse as .png, .jpg, .gif or .psd images using File > Place or Import, rather than Copy/Paste.
    Sorry for the inconvenience. SVG support will be fully implemented, tested and included in a future major update of Muse.
    Additional discussion in this thread <Re: I can paste vectors in muse now, it shows up in preview, and even in a browser preview, but not when I upload.>.

  • My phone keeps getting an error when downloading the new ios

    Even when i connect to itunes i keep getting an error when downloading the new os.  I have made 11 attempts.

    download is corrupt.  I finally solved it.  I had changed my password on my appleid and had not updated it in my phone.  After i got the same error on 3 different desktops i decided the error was in my phone and updated all my settings and the update worked the first time. 
    Thanks for your interest

  • Strange error when trying to validate a business rule

    I get this strange error when I try to validate a business rule:
    Detail:Cannot calculate. Essbase Error(1200369): Error optimizing formula for [69972] (line 38): can not cross members from the same dimension
    The rule is:
    FIX (@RELATIVE("SG&A", 0))
    "69972" = (("60001" -> "C1130" -> "All Projects" -> "All Employees") + ("69971" -> "C1130" -> "All Projects" -> "All Employees")) * "SG&A % of C1130" -> "No Cost Center" -> "PNULL" -> "No Employee" * (("Headcount" -> "All Projects" -> "All Employees") - ("C1130"->"Headcount" -> "All Projects" -> "All Employees")) / (("Headcount" -> "SG&A" -> "All Projects" -> "All Employees") - ( "C1130"->"Headcount" -> "SG&A" -> "All Projects" -> "All Employees")) ;
    ENDFIX

    Error msg states that you have used crossdim operator with the member of same dim. Cross check again.
    EX:
    "C1130"->"Headcount" -> "SG&A" -> "All Projects" -> "All Employees"
    Are all of these members belong to different dimesions?

  • I keep getting network connections error when downloading update for iPhone 4. Any suggestions?

    I keep getting network connections error when downloading update for iPhone 4. Any suggestions?

    I think I solved the problem by initiating the update in a different way, from the itunes panel where I can click to start the update, instead of saying yes when asked if I want to update when itunes launches in response to the iphone being plugged into the computer.

Maybe you are looking for