Why am I getting "Can't write file"? from jsp

I have the following code:
public String OpenRAF(String fileName) {
try {
file = new File("http://www.domain/filename.prn");
} catch (java.lang.NullPointerException npe) {
writeError(npe);
} catch (java.lang.IllegalArgumentException iae) {
writeError(iae);
if (!file.isFile()) {
retn = "Not a file:" + file.getAbsoluteFile();
if (!file.canRead()) {
retn = "Can't read file:" + file.getAbsoluteFile();
if (!file.canWrite()) {
retn = "Can't write file:" + file.getAbsoluteFile();
try {
raf = new java.io.RandomAccessFile(file, "rw");
} catch (java.io.FileNotFoundException fnfe) {
rtn = false;
Why am I getting the "Can't write file http://www.domain/filename" from this jsp?
I would like to open this file read,write and update it with the RandomAccessFile api, but I can't seem to get write permissions. I have granted 777 permissions on the file.
Is this a Tomcat file permission issue or something?
Thanks.

Thanks,
But I want to read,write to a file in the application Server. How do I get the path correct?
I want to use something like java.io.RandomAccessFile("somepath", "rw");
I should be able to access the filesystem somehow? The only way I could find the file was using the URL. Whenever I used a relative or absolute path, I could not access the file.
How do I know what the filesystem path is on an application server (Tomcat 4.1) from a Jsp 1.4?
Thanks again

Similar Messages

  • Can't write files!!!

    I need some code or a clear tutorial that explains how to write files using an applet. i want to create a game that you can save on so i want to save it to the server. can anyone help?
    thnx

    that site doesn't fully explain how to write files to
    a database from an applet. can u give something else.Well, it does answer some questions as to why you can't write files from an applet and I thought it would give you a better understanding of it and you could narrow your search into finding an answer. I guess I was wrong.
    Good luck though.

  • Can we write files and leave them as read-only

    Hey Adobe AIR Community,
    Another Adobe AIR question for you: Can we write files to the file system and leave them as read-only in  Adobe AIR?
    In the future, we would overwrite these files (or delete them and  write a new one).
    Thanks,
    Mauricio

    Please provide us with your Event Viewer administrative logs by following these steps:
    Click Start Menu
    Type eventvwr into Search programs and files (do not hit enter)
    Right click eventvwr.exe and click Run as administrator
    Expand Custom Views
    Click Administrative Events
    Right click Administrative Events
    Save all Events in Custom View As...
    Save them in a folder where you will remember which folder and save as Errors.evtx
    Go to where you saved Errors.evtx
    Right click Errors.evtx -> send to -> compressed (zipped) folder
    Upload the .zip file to Onedrive or a file sharing service and put a link to it in your next post
    If you have updated to win 8.1 and you get the error message "the system cannot find the file specified" it is a known problem.  The
    work around is to edit the registry.  If you are not comfortable doing this DONT.  If you are, backup the key before you do
    Press Win+"R" and input regedit
    Navigate to:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels. Delete "Microsoft-Windows-DxpTaskRingtone/Analytic"
    Wanikiya and Dyami--Team Zigzag

  • Error while relocating (Can't write file (no space)) - Help please

    I have been having trouble relocating master files since upgrading to Leopard. The problem doesn't seem to affect only Aperture. I can happen when using Finder or another application to move files from one drive to another. Other types of files don't seem to be affected, just my library of image files.
    The copy operation runs for a while then hangs up. The application doing the copy reports an error that that's the end. Aperture gives this error message: Error while relocating (Can’t write file (no space)). The Finder reports plenty of available space on the destination drive!
    I remember seeing a thread--but can't find it now--about a problem with certain xmp metatdata embedded into files causing problems with file operations.
    Hoping for a solution!
    Message was edited by: thomas80205

    It's possible that you might have a corrupt file. Have you tried to copy different files on to the destination drive? If those files copy fine, then narrow down the offending file by copying less images at a time.

  • How can i format my external hard drive to write files from Mac without loosing the files that i alredy have on my external hard when i used it with windows?

    How can i format my external hard drive to write files from Mac without loosing the files that i alredy have on my external hard when i used it with windows?
    I have been using Windows to write files to my 1TB WD external hard drive and I do not want to format to loose the files capacity of around 500GB
    Someone, Please help

    Hi Allen,
    Is there any way to store the back up to Mac and restore after formating?

  • Can I transfer files from a Mini running 10.4.11 to a new Mini running Lion? States I need to upgrade Migration Assistant, but I see no viable path I can take. OPtions to get photos over to new Mini?

    Can I transfer files from a Mini running 10.4.11 to a new Mini running Lion? States I need to upgrade Migration Assistant, but I see no viable path I can take. OPtions to get photos over to new Mini?

    Thanks Mende1; I know that PPC apps won't function on Intel machines but I can migrate the Universal apps, right? There is such a large gap between Tiger and Mountain Lion - can I still migrate files directly from one to the other taking the Universal apps as well? Sorry, I'm not very computer savvy!
    Len57

  • I cannot get .arw or jpeg files from my Sony A6000 to be taken into my Lightroom 4.4 via the normal "synchronise" process.  I have updated my Pc to Adobe RAW/DNG 8.4 with no improvement.  Can you help please?

    I cannot get .arw or jpeg files from my Sony A6000 to be taken into my Lightroom 4.4 via the normal "synchronise" process.  I have updated my Pc to Adobe RAW/DNG 8.4 with no improvement.  Can you help please?

    With regards to your .arw files:
    You need to either purchase and install Lightroom 5.4 -- OR -- download and install and use the FREE Adobe DNG Converter version 8.4, did you actually launch and use the DNG Converter?
    There should be no problem importing JPG files into Lightroom from your camera, what happens when you try? Is there an error message?

  • How can I get data in flat file from Pool table and cluster table ?

    Hi,
    I am working in one Achiving project. My requirement is to get data into flat file from Cluster table and pool table.
    Is there any tool avilable to download data into flat file from pool table and cluster table ?
    if table name given in the selection screen then data will be downloaded into flat file.
    waiting for quick response.
    Best Regards,
    Bansidhar

    Data cannot be retrived directly form the cluster table
    as the Cluster results are stored in Cluster Key say for example PCLkey
    and form that Key we need to fetch the data
    these clustes are not the part of PNP or PNPCE tables
    for ur info kindly check

  • Can I move files from one caralog to another?

    Can I move files from one caralog to another?

    No. you cannot.
    This, among many other reasons, is why multiple catalogs are not recommended.
    (You could import the photo into another catalog, and delete from the first catalog ... and without first using the command File->Write Tags, you will lose your tags, captions and other metdata; version sets, stacks, album/collection membership are lost in any case)

  • Windows Easy Transfer can't transfer files from Windows Vista or Windows XP

    I'm running a English Windows Vista Ultimate and just bought a
    ENGLISH Windows 8.1. I've downloaded the WET for Windows vista and tried to complete the second portion of the transfer by specifying the saved .MIG file WET created. Then I got the error message: "Windows Easy Transfer can't transfer
    files from Windows Vista or Windows XP".
    The truth is, Microsoft was too busy integrating special effects to it's operating system and claimed it as fully polished instead of making sure built-in tools were worth using.
    Another harsh reality is that THERE IS NO WAY TO TRANSFER a file from Windows Vista to Windows 8. That's because engineers didn't even bother to make that possibility happen. Just Google: "Transfer from windows vista to windows 8" and you'll see
    there are no relevant Microsoft web page about this.
    Worse, Microsoft is giving excuses. To solve this issues, they came with a toolbox of fake scenarios in order to confuse clients even further, while they know damn well the Windows Easy Transfer is NOT EASY and certainly in multiple cases
    DOES NOT TRANSFER jack to begin with.

    I somewhat agree with you.
    Trying to transfer from 7 to 8.1 and although it looks like the "7" side of the equation is working, the "8" side isn't.
    "7" is trying to connect to "8" but "8.1" is being just plain stupid.
    Not even sure why the MIG file step is even necessary if all I want to do is transfer one file between two machines.  Said file is really BIG, or i'd just use my network, and the "8.1" rig doesn't have a dvd reader...
    Per the MIG step... my file again, is big... I'd need to "mig" this file just to send it? Can't even get to the step where I'd mig-it and if i did, how long would that take?
    So this is what progress is all about... geez... gimmie a NULL MODEM CABLE !!!

  • How to get InputStream of uploaded file from request?

    The situation:
    Client is uploading xml file to server.
    <form METHOD=POST ENCTYPE = "multipart/form-data" action="SendFile" accept="text/xml">
              <input type="file" name="SentFile" />
              <input type="submit" value="go"/>
    </form>Then I need to parse data from file.
    I want to use method javax.xml.parsers.DocumentBuilder.parse(InputStream is)
    But, how to get InputStream of uploaded file from request?

    You cannot get the InputStream of the uploaded file directly. The InputStream you can obtain from request.getInputStream() contains a lot of other data as well as the uploaded file. You will have to parse the data in the InputStream to find the data that belongs to the file.
    A short cut is to use the HTTP Multipart File Upload available from www.jenkov.com. It simplifies file upload and makes it easy to obtain an InputStream for only the uploaded file. It also handles upload of multiple files. It is free, open source, Apache license, so if it doesn't fit your needs, you can always read the code and see how it works. Then write your own upload servlet.

  • How can i download file from a pageflow portlet in Webloigc Portal?

    How can i download file from a portlet in Webloigc Portal?
    My Question is, when i download files used codes in a pageflow listed below,
    it didn't work. but in non-portal environments, it worked well.
    How can I download a file from a portlets in portal??
    Thx in advanced.
    this.getResponse().setContentType ( "application/ms-excel" ) ;
    this.getResponse().setHeader ( "Content-Disposition" ,"attachment;filename="
    +new String("Excel.xls".getBytes(),"iso-8859-1")) ;
    sth.write(this.getResponse().getOutputStream());

    i always use an old fashioned method when i have to do this, i create a new jsp that contains a scriptlet that writes to the ServletOutputStream.
    <i>outputWriter.jsp</i>
    // define your own class to get file here, otherwiser use netui-data:callControl tag
    <code><pre>
    File file = FileControl.getFile(fileName);
    String fileName = (String) request.getParameter("fileName");
    response.setContentType(file.getContentType());
    ServletOutputStream sos = response.getOutputStream();
    InputStream is = file.getInputStream();
    for(int i = 0; (i = is.read()) != -1;)
    sos.write(i);
    sos.close();
    </pre>
    </code>
    i then call this jsp from the jsp to which i forward in my action using a simple url rewrite with file name on the url.
    <a href=outputWriter.jsp?fileName=nameOfFileToDownload                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Can I restore files from a Snow Leopard

    Can I restore files from a Snow Leopard Time Machine backup onto Lion?

    DaveH123 wrote:
    Not really a reply, but I have the same question.  I purchased a new iMac and installed Lion.  I used the Migration Assistant to copy everything to the new machine, but I would like to have a backup copy in case something gets lost.
    Why don't you just do a new backup?
    Can I restore individual files from the Time Machine backup on Computer A running Snow Leopard to Computer B running Lion?
    Yes, via #16 in Time Machine - Frequently Asked Questions.  But the permissions from Computer A will be restored, too, so the user account you restore them to on computer B may or may not have permission to see or change them.

  • I cannot open a pdf file with aole-mail. I can open pdf files from windows explorer. I have associated pdf with adobe reader. My operating system is window

    I cannot open a pdf file with aol e-mail. I went to preferences in Adobe Reader but did not know what to enter for Incoming IMAP and outgoing SMTP. I can open pdf files from windows explorer as  I have associated .pdf files with adobe reader. My operating system is windows 7.
    When I try to open the pdf file within aol e-mail I get a message: 'Your security settings do not allow this file to be downloaded'.  I have not changed my security settings (Tools, Internet Options, security).

    Or http://helpx.adobe.com/acrobat/kb/pdf-browser-plugin-configuration.html

  • How can I access files from a flash drive that were previously saved using a Windows computer? When I attempt to open the file on MacBook Pro, it is asking to "convert file to"; I also have Microsoft Word installed on the Mac as well.

    How can I access files from a flash drive that were previously saved using a Windows computer? When I attempt to open the file on MacBook Pro, it is asking to "convert file to"; none of the options I choose work. I also have Microsoft Office (with Word) installed on the Mac as well.

    Format the external drive as FAT32 or ExFAT. Both computers will then be able to read and write to it.

Maybe you are looking for

  • How to change JNDI service provider for EJB's?

    I need EJBean's home interface to be bound to another JNDI provider, not Weblogic. How can I do it? The most simple solution is not working: to specify <jndi-name> in weblogic-ejb-jar.xml for bean as "xxx:bean_name". By JNDI rules for such names cont

  • TS1369 my iphone is stuck on apple logo

    my iphone is stuck on apple logo and wont connect to itunes or my computer

  • Image Distortion in Flash

    Hi. I have been struggling in Flash to find out if advanced bitmap distortion is possible in flash. I am talking about the same distortion effects that Photoshop generates by going to Filter > distort menu. Especially the spherize, Wave and Twirl eff

  • Where is old DNS configuration stashed?

    I upgraded my Mac Mini Server to OS X Mavericks and then downloaded to OS X Server application.  All the DNS configuration data has gone missing.  Does anyone know where the old data has been stashed? My home network is relatively small but it is sti

  • How to extend (widen) an infotype

    Hello, I need to extend the SAP infotype 0029, substitute the standart screen for my screen. I don't know how to do that. Could you give a link with explanation or maybe explain it here. Thank You,