OutputStreamWriter doesn't write and no error message

Hi,
I wanted to try out a servlet but when I use OutputStreamWriter to write some text to a file on the server and use InputStreamReader to read the contents of the file, error returned is from InputStreamReader (FileNotFound Exception). Any ideas?
import java.applet.*;
import java.io.*;
import java.net.*;
public class TestApplet
    extends Applet {
  public TestApplet() {
  public void init() {
    try {
      jbInit();
    catch (Exception e) {
      e.printStackTrace();
  private void jbInit() throws Exception {
    try {
      // Write section
      URL url = new URL(this.getDocumentBase(), "test2.txt");
      URLConnection connection = url.openConnection();
      connection.setDoOutput(true);
      connection.setDoInput(true);
      BufferedWriter out = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream(), "UTF8"));
      out.write("1232423434");
      out.flush();
      out.close();
      // Reading section
      URL url2 = new URL(this.getDocumentBase(), "test2.txt");
      URLConnection connection2 = url2.openConnection();
      connection2.setDoOutput(false); // GET
      connection2.setDoInput(true);
      BufferedReader in = new BufferedReader(new InputStreamReader(connection2.getInputStream()));
      String line;
      StringBuffer result = new StringBuffer();
      while (null != ( (line = in.readLine()))) {
        result.append(line + "\n");
      in.close();
      System.out.println("contents = " + result + "|");
    catch (Exception e) {
      System.out.println("Exception e = " + e);
      e.printStackTrace();
}The error returned:
Exception e = java.io.FileNotFoundException: http://127.0.0.1/test/servlets/test2.txt
java.io.FileNotFoundException: http://127.0.0.1/test/servlets/test2.txt
     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:798)
     at sun.plugin.net.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
     at TestApplet.jbInit(TestApplet.java:93)
     at TestApplet.init(TestApplet.java:50)
     at sun.applet.AppletPanel.run(AppletPanel.java:353)
     at java.lang.Thread.run(Thread.java:534)

You can not just write and read files to a url. You can open a socket to the server and send the file over to a socket server that will write the file and then request the file back from the socket server. Or you can look into the Apache HttpClient and FileUpload packages to upload the file through a servlet and then download back through a servlet.

Similar Messages

  • I just downloaded Ilife 9 and now my Iphoto doesn't open. The error message says: You cannot open your library using this version. Quit and use the older version. What can I do?

    I just downloaded Ilife 9 and now my Iphoto doesn't open. The error message says: You cannot open your library using this version. Quit and use the older version. What can I do?

    iLife '09 is not available as a download - it is only available as a purchase
    iLife '11 is available as a DVD purchase and the compoments of it are available from the App Store (iPhoto '11 (version 9.1.5), etc)
    Exactly what did you do? And exactly what does the error message say?
    On the surface it appears that you are attemptying to open a new library with an older version (iPhoto '09 can not open an iPhoto '11 library for example)
    LN

  • I updated iTunes to 10.4 version and now it doesn't start and sen a messages "iTunes has detected an error and must be closed". Someone have the same problem and how can we repair our installation insted of change the windows XP installation? Best regard

    I updated iTunes to 10.4 version and now it doesn't start and send a messages "iTunes has detected an error and must be closed". Someone have the same problem and how can we repair our installation insted of change the windows XP installation? Best regards

    Only way to get iMac starting again was to re-install 10.4.4 from DVD, and then update it into 10.4.6. For a while it worked perfectly, just as before.
    Then I tried to print to CD with my EPSON Stylus Photo 950 from Adobe Photoshop Elements (2.0). It didn't print anything, but printer started flashing all lights. The print job was not performed, so I did remove it from the Printer Utility. After that the iMac started "ticking" again, same noise than before, after 10.4.7 installation. I did re-boot iMac. It never started, it does stuck on gray screen (gray block running clockwise). HW test from DVD didn't find any problems (extended search looping 3 times). But Disk Utility found hard drive to have inaccurate node structure, it could not fix it.
    Apple support recommended to use DiskWarrior. However, it does not support (yet) Intel Macs. I haven't got TechTool Pro 4.5.1 anywhere. iMac does start on to FireWire mode (T at boot), but I cannot see the disk from 10.2.8 iMac.
    So, obvisously the problem is not 10.4.7. I believe it to be ESPON printer driver compatibility on Mac OSX. This does not suprise me, EPSON printers *****, I shall never purchase one again. However, disk catalog structure should not get messed by one faulty printer driver!

  • Where to control and give error message before saving trade promotion?

    Hi Gurus,
    our CRM system is upgraded from 5.0 to 7.0 and we have some problems. One of them is, in 5.0 version, we check some conditions and display error message in the AUTHORITY_CHECK method of CRM_MKTPL. So the check is made and message displayed if errors found while entering the trade promortion, at the beginning. And it does not allow any save action too. After upgrade I write this code to CHECK_AUTHORITY method of  CRM_MKTPL_OL_OBJ. Now it is not make a control while a trade promotion is entered, so it doesn't stop saving trade promotion although there are errors. I can stop saving maybe in the method of CHECK_BEFORE_SAVE? But how can I display own check messages at the beginning of trade promotion? Please give idea.

    Astron,
    There are multiple BADIS for the Trade Promotions.
    Use CRM_MKTPL_OL_OBJ for Header Valiadtions and CRM_MKTPL_OL_ASG for the Item (assignment block validations).
    You need to use CHECK_ATTRIBUTES method of these BADIs to raise any errors.
    Just append you message to ET_MESSAGE_LOG and set EV_HAS_ERRORS to 'X'.
    If you need an error message on SAVE, use CHECK_BEFORE_SAVE method of the CRM_MKTPL_OL_OBJ BADI and append the messages and Mark REJECT_SAVE to 'X'.
    Further there are many methods that trigger on different events like Status change etc.,
    Regards,
    Masood Imrani S.

  • Wdr:select_options and highlight Error Message with a Link to Inputfield

    Hi,
    I have created a InputField on a View using WDR_SELECT_OPTIONS. I want to validate this Input Field and give
    Error Message, when User fill it with wrong Values. How can we achieve this and important is to mark it on Screen WITH a RED STAR. ( e.g. highlighted )
    Thanks!
    Best Regards
    Beserithan Malabakan

    I've not tried it with select options before, but you might wan to have a look at setting the REPORT_ATTRIBUTE_ERROR_MESSAGE method of the message object.  This way the message gets attached to any UI element bound to the context attribute you issue the message for. But as I type this and think about it some more; I see where the problem lies.  The Select Options component doesn't follow an approach of cross component context binding.  It dynamically generates its own context.
    If I had a little more time I would test this out; but it might be worth your while to research.  When you initialize the Select-Options, you normally get access to the interface controller:
    data: l_ref_cmp_usage type ref to if_wd_component_usage.
      l_ref_cmp_usage =   wd_this->wd_cpuse_select_options( ).
      if l_ref_cmp_usage->has_active_component( ) is initial.
        l_ref_cmp_usage->create_component( ).
      endif.
    * get a pointer to the interface controller of the select options
    *component
      wd_this->lv_wd_select_options =
           wd_this->wd_cpifc_select_options( ).
    * init the select screen
      wd_this->lv_sel_handler =
           wd_this->lv_wd_select_options->init_selection_screen( ).
    This interface controller (LV_WD_SELECT_OPTIONS in my case). Has a GET_API method that returns the component controller.  In turn you might be able to access the context of the Select-Options directly. Its a crazy idea, but worth a try.

  • Hard drive and critical error messages

    Hello, I have suddenly rec'd numerous hard drive errors "hard drive doesn't respond to system commands" and critical error messages "damaged hard drive clusters detected. private data is at risk."    "system has detected a problem with one or more installed IDE/SATA hard disks" along with other error messages.  I have a toshiba satellite A505 over a year old and never had a problem until now.  Was just surfing the web on a retail site and started getting all these pop-ups. desktop is missing most icons, favorite list gone.  not computer savvy when it somes to figuring the error messages out.  Any help appreciated.  Should I take it in somewhere to get fixed?  Please help.
    Thank You.

    not computer savvy when it somes to figuring the error messages out. ... Should I take it in somewhere to get fixed? 
    Yes, Katy. Be sure to back up all your important files. The machine you get back will most likely have all of your pictures, Xmas cards, favorites, contacts and so forth missing.
       Locate a Toshiba Service Center
    -Jerry

  • Updating iTunes 12.1 and get error message "The procedure entry point CMBlockBufferCopyDataBytes could not be located in the dynamic link library CoreMedia.dll - what went wrong and how to resolve this?

    Updating iTunes 12.1 and get error message "The procedure entry point CMBlockBufferCopyDataBytes could not be located in the dynamic link library CoreMedia.dll". What went wrong and how to resolve this?

    Entry point errors can often be fixed by deleting the offending dll, then repairing the component it is part of.
    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    If the advice above doesn't resolve things you could try this alternate version:
    iTunes 12.1.0.71 for Windows (64-bit - for older video cards) - itunes64setup.exe (2015-01-28)
    which is a 64-bit installer for the 32-bit version of the core application, similar to previous 64-bit releases.
    Or roll back to the previous build:
    iTunes 12.0.1.26 for Windows (32-bit) - iTunesSetup.exe (2014-10-16)
    iTunes 12.0.1.26 for Windows (64-bit) - iTunes64Setup.exe (2014-10-16)
    tt2

  • Loading and with error message :COLLECTION in SOURCE SYSTEM ENDED

    Hi,
    Facing problem with master data object while loading and with error message :COLLECTION in SOURCE SYSTEM ENDED
    This load is getting failed every day. It is a full load and records are getting transferered and added.
    when we check in details tab in RSMO all data packets in processing is green but in extraction some of the data selection scheduled are in yellow.We are changing QM status to green as records are added.
    Version i am using is BW 3.5
    Please let me know what will be the problem???
    Thanks,
    Edited by: lokesh thonsyd on Feb 18, 2009 8:55 AM

    First try to find out the reason for the load failure. Once you fix this, do a manual run of the infopackage and when successful you can continue with the rest of process chain.
    Sometimes, it doesn't help to just set a request to green status in order to run the process chain from that step on to the end.
    You need to set the failed request/step to green in the database as well as you need to raise the event that will force the process chain to run to the end from the next request/step on.
    Therefore you need to open the messages of a failed step by right clicking on it and selecting 'display messages'.
    In the opened popup click on the tab 'Chain'.
    In a parallel session goto transaction se16 for table rspcprocesslog and display the entries with the following selections:
    1. copy the variant from the popup to the variante of table rspcprocesslog
    2. copy the instance from the popup to the instance of table rspcprocesslog
    3. copy the start date from the popup to the batchdate of table rspcprocesslog
    Press F8 to display the entries of table rspcprocesslog.
    Now open another session and goto transaction se37. Enter RSPC_PROCESS_FINISH as the name of the function module and run the fm in test mode.
    Now copy the entries of table rspcprocesslog to the input parameters of the function module like described as follows:
    1. rspcprocesslog-log_id -> i_logid
    2. rspcprocesslog-type -> i_type
    3. rspcprocesslog-variante -> i_variant
    4. rspcprocesslog-instance -> i_instance
    5. enter 'G' for parameter i_state (sets the status to green).
    Now press F8 to run the fm.
    Now the actual process will be set to green and the following process in the chain will be started and the chain can run to the end.

  • Trying to update apps on iphone and getting error message, there is not enough available local storage to download these items. you can manage your local device storage usage in settings

    trying to update apps on iphone and getting error message, there is not enough available local storage to download these items. you can manage your local device storage usage in settings. What am I to do?

    The storage you purchased is in the cloud, and doesn't do anything with your pad.  Your problem is simply that you have too much content on your pad.   Go to settings, general, usage, and it will show you how much space you have avaliable on your pad.  If you let the screen sit for a while, all the apps will be displayed, and you can see how much stuff you have associated with each.
    You have to no option but to delete some of the content on your pad.  Videos, comics, pitcures and some music files use a lot of space.   The cloud allows you to leave stuff there, so you can get it when you need it.

  • "Error 16" solution doesn't solve problem, same error message pops up.  Further steps?

    Steps followed: all Adobe products (CS6 Suite and CC) have been removed (w/uninstaller and manual Library cleanup) and reinstalled (from discs and downloads); permissions corrected as per KB note on Error 16, to no change. This occurred after updating Mac OS to 10.9x. The OS was then reinstalled, new admin & standard users created (MacPro hardware passes all tests). "Error 16" permission solution performed at every stage to no change in error generation. Adobe Reader, Lightroom 4, and CS6Bridge do launch, but Acrobat Professional, Photoshop (13, CS6), and CC Photoshop stop launch w/error 16.  Stumped!

    Thanks for the suggestion, Gene, but it had no affect on the ³error 16²
    situation, I¹m afraid.  I think I¹m going to have to start with a new drive
    and import/update until I find the source of this issue.
    Jim
    "Error 16" solution doesn't solve problem, same error message pops up.
    Further steps?
    created by gener7 <https://forums.adobe.com/people/gener7>  in Photoshop
    General Discussion - View the full discussion
    <https://forums.adobe.com/message/7154907#7154907>
    Permissions problem.  Open Terminal and copy/paste this line: sudo chmod -R
    777 /Library/Application\ Support/Adobe Gene
    If the reply above answers your question, please take a moment to mark this
    answer as correct by visiting:
    https://forums.adobe.com/message/7154907#7154907 and clicking ŒCorrect¹ below
    the answer Replies to this message go to everyone subscribed to this thread,
    not directly to the person who posted the message. To post a reply, either
    reply to this email or visit the message page:
    Please note that the Adobe
    Forums do not accept email attachments. If you want to embed an image in your
    message please visit the thread in the forum and click the camera icon:
    https://forums.adobe.com/message/7154907#7154907 To unsubscribe from this
    thread, please visit the message page at
    , click "Following" at the
    top right, & "Stop Following" Start a new discussion in Photoshop General
    Discussion by email
    <mailto:[email protected]>  or
    at Adobe Community
    <https://forums.adobe.com/choose-container.jspa?contentType=1&containerType=14
    &container=4694>  For more information about maintaining your forum email
    notifications please go to https://forums.adobe.com/thread/1516624.
    >

  • Can anyone help me connect my Macbook Air to a SAMSUNG TV.  When I follow the basic instructions (Thunderbolt to HDMI connection) the screen on my computer goes grey and an error message appears inviting me to press any button to restart th

    Can anyone help me connect my Macbook Air to a SAMSUNG TV.  When I follow the basic instructions (Thunderbolt to HDMI connection) the screen on my computer goes grey and an error message appears inviting me to press any button to restart the Macbook.  When I do this nothing happens.  Only when I disconnect the computer from the TV does the Macbook allow me to login. The TV does not receive any signal from the Macbook even though I know the HDI port works fine.  Any ideas what I'm doing wrong?  Do I need to enable something on the Macbook?

    An update...
    I downloaded Apple's (rather large!) list of software updates today, and I was finally able to recognize my iPod again. I did a restore using the iPod updater from 06-2006, and all seemed to work OK. (I'm afraid to try the new one again!)
    Then I tried to re-load my music library from iTunes, and got stuck. It froze up after a while and wouldn't go any further.
    When I disconnected my iPod from my computer, I find 2 podcasts and nothing else, though iTunes told me it had transferred 600+ songs. Those 2 podcasts do play fine, and the basic iPod software all seems to be intact.
    So -- anyone get through this connection problem and have any ideas to share??
    iMac Mac OS X (10.4.7)

  • I have updated my iTunes to the latest edition and now my iTunes wont open saying MSVCR80.dll is missing from my computer and that i have to reinstall itunes. I have tried reinstalling twice now and this error message keeps appearing. What is going on?

    I have updated my iTunes to the latest edition and now my iTunes will not open saying MSVCR80.dll is missing from my computer and that i have to reinstall itunes. I have tried reinstalling twice now and this error message keeps appearing. What is going on?

    Solving MSVCR80 issue and Windows iTunes install issues.

  • Prompted to upgrade iTunes on computer. Won't let me and get error message MSVVR80.dll not found. Attempted to reinstall, won't let me. Can you have iTunes and iCloud on the same computer?

    Prompted to upgrade iTunes on computer. Won't let me and get error message MSVVR80.dll not found. Attempted to reinstall, won't let me. Can you have iTunes and iCloud on the same computer?

    Try following the instructions of tt2 in https://discussions.apple.com/thread/5822086

  • FM SSF_CLOSE failing and giving error message while printing a smartform

    Hi,
    for language spanish the smartform is not getting printed for output type SG11 but for english it is getting printed? What could be the reason? I debugged and found that SSF_CLOSE is failing and giving error message.
    Thanks and regards,
    AP.

    Hi Aparajita,
    for changing from one languages to another translations in SE63 is to be done, either search on SCN for using SE63 , or atleast see these wiki help .
    Transaction SE63 - Translation Tools for Translators (BC-DOC-TTL) - SAP Library
    Transaction SE63 (SAP Library - Translation Tools for Translators (BC-DOC-TTL))

  • Itunes was working fine. Tries to install latest upgrade and get error message about an invalid character in the path "Program Files (x86)". PC, Win7, nothing else appears to be having same issue.

    Itunes was working fine. Tried to install latest upgrade and get error message about an invalid character in the path "Program Files (x86)". PC, Win7, nothing else appears to be having same issue. Program still works, simply cannor upgrade.

    Thanks b noir,
    I tried this solution without success. After FixIt ran and didn't find a problem, either in looking for issues with "software upgrade" or "iTunes" it kindly offered to help me uninstall iTunes. I had thought of this as a possibilty but it seems to me that if you do that you lose a lot of "non-native-to-Apple" information you might have entered. I did this once and recovery was painfull. Is there a way to uninstall iTunes without losing all of that sort of thing? Any help would be appreciated.

Maybe you are looking for

  • Change display name of workflow email address in sharepoint 2010

    Hi How I can change display name of workflow email address in sharepoint 2010. I want to configure display name (from address)of email  for each site collection separately.for example I want to change "software unit"  in below pic to another name for

  • Save a doc/docx file as dotx

    In C++/MFC using MS word controller (and not Open xml) how to Save a doc/docx file as dotx?? I am opening the .doc/docxx file, and saving it as .dotx. It saves, but if tried to open when double clicking it, it is says something which means, incorrect

  • SubReports Issues in SSRS 2005 Reports Upgrade to 2012

    Hi there! We are planning to upgrade our SSRS 2005 reports to SSRS 2012. As I heard there will are some upgrade compatibility issues, I read the below MSDN article and found that the Reports that include subreports may fail in upgrade. Below is the a

  • Creating Bookmarks in Acrobat DC

    Just upgraded to Acrobat DC for Mac. Can't find the bookmark feature. Help!

  • Third Party RAM from DMS

    Hello, I have been reading all the threads about third party RAM and was checking to see if anyone has had any luck with the 8GB kit from Data Memory Systems. I have had good luck with RAM from them in the past, but the Mac Pro stuff sounds like a wh